From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Minor problems with dvipng latex image preview Date: Sun, 19 May 2013 18:27:06 -0400 Message-ID: <871u9238sl.fsf@pierrot.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeC4Z-0004HG-7n for emacs-orgmode@gnu.org; Sun, 19 May 2013 18:27:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeC4Y-0005Xa-8X for emacs-orgmode@gnu.org; Sun, 19 May 2013 18:27:23 -0400 Received: from plane.gmane.org ([80.91.229.3]:50429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeC4Y-0005XW-1R for emacs-orgmode@gnu.org; Sun, 19 May 2013 18:27:22 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UeC4W-0000LB-DT for emacs-orgmode@gnu.org; Mon, 20 May 2013 00:27:20 +0200 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 May 2013 00:27:20 +0200 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 May 2013 00:27:20 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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