emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to specify the output format for each LaTeX fragment when exporting to HTML?
@ 2015-01-23  8:55 Xiaolong Zhang (HKUCS)
  0 siblings, 0 replies; only message in thread
From: Xiaolong Zhang (HKUCS) @ 2015-01-23  8:55 UTC (permalink / raw)
  To: emacs-orgmode

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

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

[-- Attachment #2: test.org --]
[-- Type: text/plain, Size: 608 bytes --]

#+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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-23  8:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23  8:55 How to specify the output format for each LaTeX fragment when exporting to HTML? Xiaolong Zhang (HKUCS)

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).