Search code examples
emacsorg-modeorg-babel

org-mode html export


I have a org file with source, documentation and latex code. Latex stuff draws a bunch of graphs explaining how functions interact with each other. According to,

http://orgmode.org/manual/LaTeX-fragments.html

org-mode should export latex code as images when using html export.

#+TITLE: Test
#+AUTHOR: Blah
#+LATEX_HEADER: \usepackage{tikz}
#+OPTIONS: LaTeX:dvipng

#+begin_latex

  \begin{tikzpicture}
    \draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
  \end{tikzpicture}

#+end_latex

Above works if I use pdf export so my latex setup is working also dvipng is present on my system but when exporting to html latex block is completely ignored.


Solution

  • I wasn't able to make tikzpicture blocks working but #+begin_latex and #+end_latex shouldn't be use, as said in your link to the Org-Mode documentation, only \begin{...} LATEX_CODE end{...} is required.

    This snippet should work.

    #+OPTIONS:      LaTeX:dvipng
    * Test
      Blah
    
      \begin{equation}                          % arbitrary environments,
      x=\sqrt{b}                                % even tables, figures
      \end{equation}                            % etc
    
      If $a^2=b$ and \( b=2 \), then the solution must be either $$
      a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
    
      Done !