Hi List,
When I'm exporting LaTeX fragments to HTML, there is a per file option:
#+OPTIONS: tex:tDo the right thing automatically (MathJax)
#+OPTIONS: tex:nilDo not process LaTeX fragments at all
#+OPTIONS: tex:verbatimVerbatim export, for jsMath or so
I like the default (MathJax) way since it looks much better. However,
MathJax
can't render everything in LaTeX such as the "algorithmic" package.
For large fragments, I use the method described in
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html
by using org-babel to export a png file and include it in the resulting
HTML file.
This works good now when I set the global TeX export option to MathJax,
and manually make
fragments that Mathjax can't render as images.
However when the formula is simple, this is not a good solution. For
example, \coloneqq is
a command from package "mathtools", which MathJax doesn't support currently.
Using the org-babel solution will not only make the source code messy,
but also can't make
the image inline. (Maybe it can, how?)
I can set #+OPTIONS: tex:dvipng such that formula $a \coloneqq b$ can
rendered inline,
without much extra work. So I'm wondering whether I can specify some of
the fragments exporting
as images, while use MathJax for the rest.
An example file is attached. If there is any solution/workaround, please
let me know.
Thanks for your reading!
Best regards,
Xiaolong
#+OPTIONS: tex:t
$a = x \times y$ is rendered as Mathjax.
$a \coloneqq b$ is rendered wrong.
For large environment, use org babel for rendering.
#+header: :exports results :file test.png :results value raw file append
#+header: :imagemagick yes :iminoptions -density 600 -trim :imoutoptions
-geometry 400
#+header: :fit yes :headers '("\\usepackage{algorithmic}")
#+begin_src latex
\begin{algorithmic}
\REPEAT
\STATE $ \theta_j \coloneqq \theta_j - \alpha \frac{\partial}{\partial
\theta_j} J(\theta_0,\theta_1) $ \COMMENT{for \(j = 0\) and \(j = 1\)}
\UNTIL{convergence}
\end{algorithmic}
#+end_src