public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Paul Laffitte
	<paullaffitte-1ViLX0X+lBJGWvitb5QawA@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: LaTeX algorithm to HTML using SVG images
Date: Tue, 27 Aug 2019 12:29:28 -0700	[thread overview]
Message-ID: <yh480kd0gqz9t3.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <ad859f30-bf09-4f90-a9d9-33ed5b14cbc4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


I'm not sure what you mean by latex extensions.
But have you tried using MathJaX?  It can be configured to
generate SVG.

Paul Laffitte <paullaffitte-1ViLX0X+lBJGWvitb5QawA@public.gmane.org> writes:

> Hello,
>
> I'm trying to figure out a way to render HTML with quality-lossless (I mean 
> not in a .png format for instance) algorithms from LaTeX using extensions. 
> In a more wider perspective, I would render markdown containing LaTeX using 
> extensions into HTML and eventually render this HTML into PDF.
>
> My goal is to be able to take notes and do my homework in my Scientific 
> Computing class. Here are my needs points by points:
> - Markdown: Because it's easy and fast to write.
> - LaTeX: Because I need to write matrices, algorithms and other 
> mathematical stuff.
> - HTML: Because I would like to be able to use CSS to stylize my notes, and 
> eventually having it in a web format. (This is kind of optional but I 
> really would like to have it)
> - SVG: Because text is quality-lossless, it's weird if when I zoom the text 
> is fine but the maths aren't (maths are the main point of the document)
> - PDF: Because having all of this and not being able to get a PDF from it 
> is just non-sense.
>
> Currently, I'm able to do all of this but using extensions in LaTeX, 
> because yes, algorithms comes from extensions. I use webtex to render the 
> LaTeX parts into SVG using this command:
> *pandoc 22_08.2.md --from markdown+tex_math_dollars --to=pdf -o **22_08.2**.pdf 
> -t html5 --webtex='https://latex.codecogs.com/svg.latex?'*
>
> I tried other engine than webtex but they whether doesn't support 
> extensions or SVG rendering.
>
> I'm so close to have this working perfectly well, and it would be so nice. 
> Does any one has any idea about how I could do? *Is there any LaTeX 
> rendering engine supported by pandoc that is able to both render without 
> quality loss and use LaTeX extensions?*
>
> PS: You can find join with this thread an example of a markdown file and 
> his html and pdf outputs that I generate. You can also see that on the page 
> 2 I had to write my pseudo-code with markdown raw code (```).
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ad859f30-bf09-4f90-a9d9-33ed5b14cbc4%40googlegroups.com.
> $$
> \begin{aligned}
> 	x_{1} + 2x_{2} + x_{3} &= -1 \\
> 	-3x_{1} + x_{2} + x_{3} &= 0 \\
> 	x_{1} + 2x_{3} &= 1 \\
> \end{aligned}
> \implies
> \overset{A}{
> 	\begin{bmatrix}
> 	1 & 2 & 1 \\
> 	-3 & 1 & 1 \\
> 	1 & 0 & 3 \\
> 	\end{bmatrix}
> }
> \overset{x}{
> 	\begin{bmatrix}
> 	x_{1} \\
> 	x_{2} \\
> 	x_{3} \\
> 	\end{bmatrix}
> } =
> \overset{b}{
> 	\begin{bmatrix}
> 	-1 \\
> 	0 \\
> 	1 \\
> 	\end{bmatrix}
> }
> $$
>
> Using the formula $Row_{i} := Row_{i} - (\frac{A_{ik}}{A_{kk}}) \cdot Row_{k}$:
>
> ---
>
> $A_{ik} = A_{21}$ hence $i = 2$ and $k = 1$
>
> $Row_{2} := Row_{2} - (\frac{A_{21}}{A_{11}}) \cdot Row_{1}$
>
> $= \begin{bmatrix}-3 & 1 & 1\end{bmatrix} - (\frac{-3}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}$
>
> $= \begin{bmatrix}0 & 7 & 4\end{bmatrix}$
>
> $$
> \begin{bmatrix}
> 	1 & 2 & 1 \\
> 	0 & 7 & 4 \\
> 	1 & 0 & 3 \\
> \end{bmatrix}
> $$
>
> ---
>
> $A_{ik} = A_{31}$ hence $i = 3$ and $k = 1$
>
> $Row_{3} := Row_{3} - (\frac{A_{31}}{A_{11}}) \cdot Row_{1}$
>
> $= \begin{bmatrix}1 & 0 & 3\end{bmatrix} - (\frac{1}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}$
>
> $= \begin{bmatrix}0 & -2 & 2\end{bmatrix}$
>
> $$
> \begin{bmatrix}
> 	1 & 2 & 1 \\
> 	0 & 7 & 4 \\
> 	0 & -2 & 2 \\
> \end{bmatrix}
> $$
>
> ---
>
> $A_{ik} = A_{32}$ hence $i = 3$ and $k = 2$
>
> $Row_{3} := Row_{3} - (\frac{A_{32}}{A_{22}}) \cdot Row_{2}$
>
> $= \begin{bmatrix}0 & -2 & 2\end{bmatrix} - (\frac{-2}{7}) \cdot \begin{bmatrix}0 & 7 & 4\end{bmatrix}$
>
> $= \begin{bmatrix}0 & 0 & \frac{22}{7}\end{bmatrix}$
>
> $$
> \begin{bmatrix}
> 	1 & 2 & 1 \\
> 	0 & 7 & 4 \\
> 	0 & 0 & \frac{22}{7} \\
> \end{bmatrix}
> $$
>
> ---
>
> $$
> \overset{A}{
> 	\begin{bmatrix}
> 	1 & 2 & 1 \\
> 	-3 & 1 & 1 \\
> 	1 & 0 & 3 \\
> 	\end{bmatrix}
> } =
> \overset{L}{
> 	\begin{bmatrix}
> 	1 & 0 & 0 \\
> 	-3 & 1 & 0 \\
> 	1 & \frac{-2}{7} & 1 \\
> 	\end{bmatrix}
> }
> \overset{U}{
> 	\begin{bmatrix}
> 	1 & 2 & 1 \\
> 	0 & 7 & 4\\
> 	0 & 0 & \frac{22}{7} \\
> 	\end{bmatrix}
> }
> $$
>
> $$
> Lw = b
> \implies
> \overset{L}{
> 	\begin{bmatrix}
> 	1 & 0 & 0 \\
> 	-3 & 1 & 0 \\
> 	1 & \frac{-2}{7} & 1 \\
> 	\end{bmatrix}
> }
> \overset{w}{
> 	\begin{bmatrix}
> 	w_{1} \\
> 	w_{2} \\
> 	w_{3} \\
> 	\end{bmatrix}
> } =
> \overset{b}{
> 	\begin{bmatrix}
> 	-1 \\
> 	0 \\
> 	1 \\
> 	\end{bmatrix}
> }
> $$
>
> ```
> for j = 1 to n:
> 	j = 1
> 	w1 = b1 / L11 = -1 / 1 = -1
> 	for i = j + 1 to n:
> 		i = 2
> 		b2 = b2 - L21 * w1 = 0 - (-3) * (-1) = -3
> 		i = 3
> 		b3 = b3 - L31 * w1 = 1 - 1 * (-1) = 2
> 	j = 2
> 	w2 = b2 / L22 = -3 / 1 = -3
> 	for i = j + 1 to n:
> 		i = 3
> 		b3 = b3 - L32 * w2 = 2 - (-2 / 7) * (-3) = 8 / 7
> 	j = 3
> 	w3 = b3 / L33 = (8 / 7) / 1 = 8 / 7
> 	for i = j + 1 to n:
> 		i = 4 -> skip
> ```
>
> $$
> Ux = w
> \implies
> \overset{U}{
> 	\begin{bmatrix}
> 	1 & 2 & 1 \\
> 	0 & 7 & 4 \\
> 	0 & 0 & \frac{22}{7} \\
> 	\end{bmatrix}
> }
> \overset{x}{
> 	\begin{bmatrix}
> 	x_{1} \\
> 	x_{2} \\
> 	x_{3} \\
> 	\end{bmatrix}
> } =
> \overset{w}{
> 	\begin{bmatrix}
> 	w_{1} \\
> 	w_{2} \\
> 	w_{3} \\
> 	\end{bmatrix}
> } =
> \overset{w}{
> 	\begin{bmatrix}
> 	-1 \\
> 	-3 \\
> 	\frac{8}{7} \\
> 	\end{bmatrix}
> }
> $$
>
> ***Paul Laffitte*** *6222808130*
>
> \begin{aligned} x_{1} + 2x_{2} + x_{3} &= -1 \\ -3x_{1} + x_{2} + x_{3} &= 0 \\ x_{1} + 2x_{3} &= 1 \\ \end
> {aligned} \implies \overset{A}{ \begin{bmatrix} 1 & 2 & 1 \\ -3 & 1 & 1 \\ 1 & 0 & 3 \\ \end{bmatrix} } \overset{x}
> { \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{bmatrix} } = \overset{b}{ \begin{bmatrix} -1 \\ 0 \\ 1 \\ \end
> {bmatrix} } 
>
> Using the formula 
> Row_{i} := Row_{i} - (\frac{A_{ik}}{A_{kk}}) \cdot Row_{k}
> :
>
> -------------------------------------------------------------------------------
>
> A_{ik} = A_{21}
> hence 
> i = 2
> and 
> k = 1
>
> Row_{2} := Row_{2} - (\frac{A_{21}}{A_{11}}) \cdot Row_{1}
>
> = \begin{bmatrix}-3 & 1 & 1\end{bmatrix} - (\frac{-3}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}
>
> = \begin{bmatrix}0 & 7 & 4\end{bmatrix}
>
> \begin{bmatrix} 1 & 2 & 1 \\ 0 & 7 & 4 \\ 1 & 0 & 3 \\ \end{bmatrix} 
>
> -------------------------------------------------------------------------------
>
> A_{ik} = A_{31}
> hence 
> i = 3
> and 
> k = 1
>
> Row_{3} := Row_{3} - (\frac{A_{31}}{A_{11}}) \cdot Row_{1}
>
> = \begin{bmatrix}1 & 0 & 3\end{bmatrix} - (\frac{1}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}
>
> = \begin{bmatrix}0 & -2 & 2\end{bmatrix}
>
> \begin{bmatrix} 1 & 2 & 1 \\ 0 & 7 & 4 \\ 0 & -2 & 2 \\ \end{bmatrix} 
>
> -------------------------------------------------------------------------------
>
> A_{ik} = A_{32}
> hence 
> i = 3
> and 
> k = 2
>
> Row_{3} := Row_{3} - (\frac{A_{32}}{A_{22}}) \cdot Row_{2}
>
> = \begin{bmatrix}0 & -2 & 2\end{bmatrix} - (\frac{-2}{7}) \cdot \begin{bmatrix}0 & 7 & 4\end{bmatrix}
>
> = \begin{bmatrix}0 & 0 & \frac{22}{7}\end{bmatrix}
>
> \begin{bmatrix} 1 & 2 & 1 \\ 0 & 7 & 4 \\ 0 & 0 & \frac{22}{7} \\ \end{bmatrix} 
>
> -------------------------------------------------------------------------------
>
> \overset{A}{ \begin{bmatrix} 1 & 2 & 1 \\ -3 & 1 & 1 \\ 1 & 0 & 3 \\ \end{bmatrix} } = \overset{L}{ \begin{bmatrix}
> 1 & 0 & 0 \\ -3 & 1 & 0 \\ 1 & \frac{-2}{7} & 1 \\ \end{bmatrix} } \overset{U}{ \begin{bmatrix} 1 & 2 & 1 \\ 0 & 7 &
> 4\\ 0 & 0 & \frac{22}{7} \\ \end{bmatrix} } 
>
> Lw = b \implies \overset{L}{ \begin{bmatrix} 1 & 0 & 0 \\ -3 & 1 & 0 \\ 1 & \frac{-2}{7} & 1 \\ \end{bmatrix} }
> \overset{w}{ \begin{bmatrix} w_{1} \\ w_{2} \\ w_{3} \\ \end{bmatrix} } = \overset{b}{ \begin{bmatrix} -1 \\ 0 \\ 1
> \\ \end{bmatrix} } 
>
> for j = 1 to n:
>     j = 1
>     w1 = b1 / L11 = -1 / 1 = -1
>     for i = j + 1 to n:
>         i = 2
>         b2 = b2 - L21 * w1 = 0 - (-3) * (-1) = -3
>         i = 3
>         b3 = b3 - L31 * w1 = 1 - 1 * (-1) = 2
>     j = 2
>     w2 = b2 / L22 = -3 / 1 = -3
>     for i = j + 1 to n:
>         i = 3
>         b3 = b3 - L32 * w2 = 2 - (-2 / 7) * (-3) = 8 / 7
>     j = 3
>     w3 = b3 / L33 = (8 / 7) / 1 = 8 / 7
>     for i = j + 1 to n:
>         i = 4 -> skip
>
> Ux = w \implies \overset{U}{ \begin{bmatrix} 1 & 2 & 1 \\ 0 & 7 & 4 \\ 0 & 0 & \frac{22}{7} \\ \end{bmatrix} }
> \overset{x}{ \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{bmatrix} } = \overset{w}{ \begin{bmatrix} w_{1} \\ w_
> {2} \\ w_{3} \\ \end{bmatrix} } = \overset{w}{ \begin{bmatrix} -1 \\ -3 \\ \frac{8}{7} \\ \end{bmatrix} } 
>
> Paul Laffitte 6222808130


      parent reply	other threads:[~2019-08-27 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 19:00 Paul Laffitte
     [not found] ` <ad859f30-bf09-4f90-a9d9-33ed5b14cbc4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-08-27 19:29   ` John MacFarlane [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yh480kd0gqz9t3.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=paullaffitte-1ViLX0X+lBJGWvitb5QawA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).