emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Xiaolong Zhang (HKUCS)" <xlzhang@cs.hku.hk>
To: emacs-orgmode@gnu.org
Subject: How to specify the output format for each LaTeX fragment when exporting to HTML?
Date: Fri, 23 Jan 2015 16:55:48 +0800	[thread overview]
Message-ID: <54C20C94.10004@cs.hku.hk> (raw)

[-- 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





                 reply	other threads:[~2015-01-23  8:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=54C20C94.10004@cs.hku.hk \
    --to=xlzhang@cs.hku.hk \
    --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).