emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Haochen Xie <haochen@xie.name>
To: emacs-orgmode@gnu.org
Subject: Block level specification for tex code html export method
Date: Mon, 10 Aug 2015 17:11:02 +0900	[thread overview]
Message-ID: <CAD3Qf6tuP_4hnqoCF52pWnEF=xRYo92OPw17ybBWL-poOoacFw@mail.gmail.com> (raw)

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

Hi,

I'm trying to include a diagram drawn with tikz in a document, but
couldn't find an elegant way to conditionally export it as png when
generating HTML output and raw TeX code when generating PDF. It is
possible to use

#+OPTIONS: tex:imagemagick

to have tex blocks in the document exported as PNG in HTML, but since
I have other formulas which will render much better with MathJAX other
than embedded PNGs, i really don't want to do it. What I'm currently
doing is to use something like

#+BEGIN_SRC latex :file diagram.png :results value raw
\begin{tikzpicture}
  \draw (0,0) grid (7,5);
  \draw (0,0) node[below left] {$A$};
  \draw (7,5) node[above right] {$B$};
  \fill (0,0) circle (2pt);
  \fill (7,5) circle (2pt);
\end{tikzpicture}
#+END_SRC

#+RESULTS[da59bc402ce2d1055b5ff471ea7e398c4e0488f5]:
[[file:diagram.png]]

so that the diagram will be include in the HTML file as a png image,
and the pdf file will also include it as a raster image.

But this method is rather a workaround. I'd like to see a vector
diagram in the pdf file, which could be achieved if there is a way to
specify how a block of TeX source code should be handled when exported
to HTML regardless to the global settings. So I propose an extension
to #+BEGIN_LaTeX block so that a new header :html will control how the
specific block will be handled when exporting to HTML. The possible
values might be none, t, dvipng, or imagemagick. "none" will ignore
the whole block when exporting to HTML, just like the current
behavior; "t" will try to call MathJAX to interpret this block of TeX
code; and "dvipng" and "imagemagick" will call "dvipng" or
"imagemagick" to render a png file to be embedded in the HTML page.

If that extension is supported, we could then left the global option
tex:t while inline a tex powered figure with great convenience. For
example, in my use case, I could then just used the following code to
achieve what I want:

#+BEGIN_LaTeX :html imagemagick
\begin{tikzpicture}
  \draw (0,0) grid (7,5);
  \draw (0,0) node[below left] {$A$};
  \draw (7,5) node[above right] {$B$};
  \fill (0,0) circle (2pt);
  \fill (7,5) circle (2pt);
\end{tikzpicture}
#+END_LaTeX

As I'm new to org-mode, I may missed something that I could use
instead (although I searched the internet very hard). Please feel free
to disagree on me and point alternative ways to achieve my goal.

Thanks in advance.

Best regards,

Haochen

--

Mail from Haochen Xie

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

             reply	other threads:[~2015-08-10  8:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  8:11 Haochen Xie [this message]
2015-08-10 22:56 ` Block level specification for tex code html export method Andreas Leha
2015-08-11  8:47   ` Haochen Xie
2015-08-11  8:53     ` Fabrice Popineau
2015-08-11 16:24       ` Haochen Xie
2015-08-12  8:50         ` Andreas Leha
2015-08-12 12:51           ` Haochen Xie
2015-08-12 13:40             ` Andreas Leha
2015-09-03 11:42           ` Alan Schmitt
2015-09-03 12:30             ` Andreas Leha
2015-09-03 13:03               ` Haochen Xie
2015-09-03 20:39                 ` Andreas Leha
2015-09-03 20:33               ` Eric S Fraga
2015-09-03 21:11                 ` Andreas Leha
2015-09-03 21:38                   ` Nicolas Goaziou
2015-09-04  6:15                     ` Eric S Fraga
2015-09-04  6:23                       ` Haochen Xie
2015-09-04  7:07                         ` Eric S Fraga
2015-09-04  7:10                         ` Alan Schmitt
2015-09-04 12:08                     ` Andreas Leha
2015-09-04 12:48                       ` Nicolas Goaziou
2015-09-04 13:42                         ` Andreas Leha
2015-09-05  8:58                           ` Nicolas Goaziou

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='CAD3Qf6tuP_4hnqoCF52pWnEF=xRYo92OPw17ybBWL-poOoacFw@mail.gmail.com' \
    --to=haochen@xie.name \
    --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).