emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Definitive answer to org-mode export HTML versus LaTeX
Date: Tue, 29 Jan 2019 10:06:20 -0600	[thread overview]
Message-ID: <CAFAhFSVwfqOAVyTvHcYmgbL7Uwk6GXt9Yn9jA1SXkPV_K=yFCg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2787 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3598 bytes --]

             reply	other threads:[~2019-01-29 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 16:06 Lawrence Bottorff [this message]
2019-01-29 21:52 ` Definitive answer to org-mode export HTML versus LaTeX Nick Dokos

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAFAhFSVwfqOAVyTvHcYmgbL7Uwk6GXt9Yn9jA1SXkPV_K=yFCg@mail.gmail.com' \
    --to=borgauf@gmail.com \
    --cc=emacs-orgmode@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).