emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Minor problems with dvipng latex image preview
@ 2013-05-19 22:27 Nick Dokos
  2013-05-22 19:03 ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2013-05-19 22:27 UTC (permalink / raw)
  To: emacs-orgmode

The main problem is that the latex->dvi invocation is hard-wired in
org-create-formula-image-with-dvipng and in addition, when the latex
file is created, the value of org-latex-packages-alist is spliced in.

That in itself is fine, except in the case when (for normal latex
processing) I choose minted for code prettification. Following the
docstring of or-export-latex-listings, I set:

(setq org-export-latex-listings 'minted)
(add-to-list 'org-latex-packages-alist '("" "minted"))

in which case, I end up with a \usepackage{minted} in the preview
latex file. But minted requires that latex be invoked with
--shell-escape, which cannot be done because the latex->dvi invocation
is hardwired.

A customizable variable to hold such options could be used, but there
might be cleaner ways. For now, I've used the even dirtier approach of
hard-wiring the option into the latex->dvi call in the above function:

--8<---------------cut here---------------start------------->8---
            ...
	    (call-process "latex" nil nil nil "--shell-escape" texfile))
            ...
--8<---------------cut here---------------end--------------->8---

If a customizable variable is added, then the docstring for
org-export-latex-listings will need to be modified to mention it.

And finally, the same docstring also refers to org-latex.el and
org-latex-to-pdf-process, rather than using the 8.x names.

If you want to experiment, here is a small file:

--8<---------------cut here---------------start------------->8---
* Euler

\[
e^{i\pi} = -1
\]
--8<---------------cut here---------------end--------------->8---

Hit C-c C-x C-l for the preview, C-c C-c to go back.

Org-mode version 8.0.2 (release_8.0.2-116-gd54209)
GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2013-04-09

-- 
Nick

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-05-30 15:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-19 22:27 Minor problems with dvipng latex image preview Nick Dokos
2013-05-22 19:03 ` Nicolas Goaziou
2013-05-23  6:21   ` Nick Dokos
2013-05-23 13:21     ` Nicolas Goaziou
2013-05-23 16:06       ` Nick Dokos
2013-05-23 16:53         ` Nicolas Goaziou
2013-05-23 21:37           ` Nick Dokos
2013-05-25 20:20             ` Nicolas Goaziou
2013-05-26  6:38               ` Nick Dokos
2013-05-30 15:12                 ` Nicolas Goaziou
2013-05-30 15:25                   ` Nick Dokos

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