From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Bottorff Subject: Definitive answer to org-mode export HTML versus LaTeX Date: Tue, 29 Jan 2019 10:06:20 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fba09a05809af9ca" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:37973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goVuR-00022s-CZ for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 11:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goVuQ-0003aI-Ac for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 11:06:47 -0500 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]:34619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goVuQ-0003Te-3R for emacs-orgmode@gnu.org; Tue, 29 Jan 2019 11:06:46 -0500 Received: by mail-oi1-x232.google.com with SMTP id r62so16607787oie.1 for ; Tue, 29 Jan 2019 08:06:32 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode Mailinglist --000000000000fba09a05809af9ca Content-Type: text/plain; charset="UTF-8" I keep being stymied by the apparent incompatibility of HTML and LaTeX export. Here's what I have in my .org file header: #+LATEX_CLASS: article #+LATEX_CLASS_OPTIONS: [american] #+LATEX_HEADER: \usepackage{tikz} #+LATEX_HEADER: \usepackage{commath} #+LATEX_HEADER: \usepackage{stackengine} #+LaTeX_HEADER: \usepackage{pgfplots} #+LaTeX_HEADER: \usepackage{sansmath} #+LATEX_HEADER: \usepackage{mathtools} #+LaTeX_HEADER: \usepackage{amsmath} In reality, I don't know if this gets seen by org-mode export to HTML, perhaps by export to LaTeX? So to start, here is working piece of markup that displays great in both HTML and LaTeX: #+begin_src latex :packages '(("" "tikz")) :exports results :results output raw :file other12.png :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 500 \usetikzlibrary{decorations.pathreplacing} \begin{tikzpicture}[scale=1] \draw[step=1cm,thin,gray!60] (-6,-6) grid (6,6); \draw[<->] (-6,0)--(6,0) node[right]{$x$}; \draw[<->] (0,-6)--(0,6) node[above]{$y$}; \draw[line width=2pt,blue,-stealth](0,0)--(4,-3) node[anchor=south west]{$\boldsymbol{(4,-3)}$}; \draw[line width=2pt,gray,-stealth](2,3)--(6,0) node[anchor=south west]; \draw[line width=2pt,gray,-stealth](-5,4)--(-1,1) node[anchor=south west]; \draw[line width=2pt,gray,-stealth](-3,-1)--(1,-4) node[anchor=south west]; \draw [decorate,color=red,decoration={brace,amplitude=10pt},xshift=-0pt,yshift=0pt] (-5.0,1.0) -- (-5.0,4.0) node [red,midway,xshift=-0.65cm] {\footnotesize $-3$}; \draw [decorate,color=red,decoration={brace,amplitude=10pt,mirror,raise=1pt},xshift=-0pt,yshift=0pt] (-5,1) -- (-1,1) node [red,midway,yshift=-0.6cm] {\footnotesize $4$}; \end{tikzpicture} #+end_src The following also displays in both HTML and LaTeX correctly: \begin{align*} \|x\|&=\sqrt{4^2+(-3)^2} \\ &= \sqrt{25} \\ &= 5 \end{align*} as well as this: \begin{equation*} x = \begin{pmatrix} \phantom{-} 4 \\ -3 \\ \end{pmatrix} \end{equation*} but this on the HTML side \setstackEOL{\\} \begin{equation*} x=\parenVectorstack[r]{4\\-3\\2} \end{equation*} doesn't know what \setstackEOL{\\} is, nor \parenVectorstack[r] and displays mangled. The LaTeX export looks fine, though. And if I put it in a LaTeX babel code block, it disappears from the HTML entirely, while, again, the LaTeX export displays just fine. Confusing is how the Tikz code block is displayed in both HTML and LaTeX, but any other attempt at a LaTeX code block is ignored and left completely out of the HTML export. My educated guess is that the org-mode HTML export processes is handled by MathJax, which is a subset of LaTeX. But then I'd like to know definitively what can be done and what cannot be done LaTeX-wise for the HTML export. LB --000000000000fba09a05809af9ca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I keep being stymied by the apparent= incompatibility of HTML and LaTeX export. Here's what I have in my .or= g file header:

#+LATEX_CLASS: article
#+= LATEX_CLASS_OPTIONS: [american]
#+LATEX_HEADER: \usepackage{tikz}=
#+LATEX_HEADER: \usepackage{commath}
#+LATEX_HEADER: \= usepackage{stackengine}
#+LaTeX_HEADER: \usepackage{pgfplots}
#+LaTeX_HEADER: \usepackage{sansmath}
#+LATEX_HEADER: \use= package{mathtools}
#+LaTeX_HEADER: \usepackage{amsmath}

In reality, I don't know if this gets seen by org-mode = export to HTML, perhaps by export to LaTeX? So to start, here is working pi= ece of markup that displays great in both HTML and LaTeX:

#+begin_src latex :packages '(("" "tikz")) = :exports results :results output raw :file other12.png :imagemagick yes :im= inoptions -density 600 :imoutoptions -geometry 500

\usetikzlibrary{decorations.pathreplacing}

=C2=A0= \begin{tikzpicture}[scale=3D1]
=C2=A0 =C2=A0 \draw[step=3D1cm,th= in,gray!60] (-6,-6) grid (6,6);
=C2=A0 =C2=A0 \draw[<->] (-= 6,0)--(6,0) node[right]{$x$};
=C2=A0 =C2=A0 \draw[<->] (0,-= 6)--(0,6) node[above]{$y$};
=C2=A0 =C2=A0 \draw[line width=3D2pt,= blue,-stealth](0,0)--(4,-3) node[anchor=3Dsouth west]{$\boldsymbol{(4,-3)}$= };
=C2=A0 =C2=A0 \draw[line width=3D2pt,gray,-stealth](2,3)--(6,0= ) node[anchor=3Dsouth west];
=C2=A0 =C2=A0 \draw[line width=3D2pt= ,gray,-stealth](-5,4)--(-1,1) node[anchor=3Dsouth west];
=C2=A0 = =C2=A0 \draw[line width=3D2pt,gray,-stealth](-3,-1)--(1,-4) node[anchor=3Ds= outh west];
\draw [decorate,color=3Dred,decoration=3D{brace,ampli= tude=3D10pt},xshift=3D-0pt,yshift=3D0pt] (-5.0,1.0) -- (-5.0,4.0) node [red= ,midway,xshift=3D-0.65cm]=C2=A0
{\footnotesize $-3$};
= =C2=A0 =C2=A0 \draw [decorate,color=3Dred,decoration=3D{brace,amplitude=3D1= 0pt,mirror,raise=3D1pt},xshift=3D-0pt,yshift=3D0pt] (-5,1) -- (-1,1) node [= red,midway,yshift=3D-0.6cm] {\footnotesize $4$};
=C2=A0 \end{tikz= picture}

#+end_src

The fo= llowing also displays in both HTML and LaTeX correctly:

\begin{align*}
\|x\|&=3D\sqrt{4^2+(-3)^2} \\
= &=3D \sqrt{25} \\
&=3D 5
\end{align*}
as well as this:

\begin{equation*}
=C2= =A0 =C2=A0 x =3D \begin{pmatrix}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \pha= ntom{-} 4 \\
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-3 \\
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \end{pmatrix}
=C2=A0\end{equatio= n*}

but this on the HTML side

=
\setstackEOL{\\}
\begin{equation*}
x=3D\parenVecto= rstack[r]{4\\-3\\2}
\end{equation*}

does= n't know what \setstackEOL{\\} is, nor \parenVectorstack[r] and display= s mangled. The LaTeX export looks fine, though. And if I put it in a LaTeX = babel code block, it disappears from the HTML entirely, while, again, the L= aTeX export displays just fine. Confusing is how the Tikz code block is dis= played in both HTML and LaTeX, but any other attempt at a LaTeX code block = is ignored and left completely out of the HTML export.

=
My educated guess is that the org-mode HTML export processes is handle= d by MathJax, which is a subset of LaTeX. But then I'd like to know def= initively what can be done and what cannot be done LaTeX-wise for the HTML = export.

LB
--000000000000fba09a05809af9ca--