From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Question on latex source block Date: Sun, 09 Sep 2012 03:07:12 -0400 Message-ID: <8243.1347174432@alphaville> References: <40C7B1BFC291ED4E9D10436D07736A3347089E653C@EXMAIL7.haas.uc.berkeley.edu> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAbc9-0001dS-06 for emacs-orgmode@gnu.org; Sun, 09 Sep 2012 03:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TAbc7-0002Ph-HX for emacs-orgmode@gnu.org; Sun, 09 Sep 2012 03:07:28 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:4177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAbc7-0002PG-AQ for emacs-orgmode@gnu.org; Sun, 09 Sep 2012 03:07:27 -0400 In-Reply-To: Message from Richard Stanton of "Sat, 08 Sep 2012 22:15:10 PDT." <40C7B1BFC291ED4E9D10436D07736A3347089E653C@EXMAIL7.haas.uc.berkeley.edu> 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: Richard Stanton Cc: "emacs-orgmode@gnu.org" Richard Stanton wrote: > Using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @ c:/emacs/site-lis= > p/org-mode/lisp/), I created the following LaTeX code block: > > #+begin_src latex :file test.png > \frac{1}{2} > #+end_src > > When I press C-c C-c to compile the code block, I get the following error d= > ump: > > Debugger entered--Lisp error: (void-function org-create-formula-image) > org-create-formula-image("\\frac{1}{2}" "test.png" (:foreground default := > background default :scale 1.0 :html-foreground "Black" :html-background "Tr= > ansparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) t= > ) > org-babel-execute:latex("\\frac{1}{2}" ((:comments . "") (:shebang . "") = > (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports = > . "results") (:results . "file replace latex") (:session . "none") (:hlines= > . "no") (:padnewline . "yes") (:file . "test.png") (:result-type . value) = > (:result-params "file" "replace" "latex") (:rowname-names) (:colname-names)= > )) > org-babel-execute-src-block(nil ("latex" "\\frac{1}{2}" ((:comments . "")= > (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle .= > "no") (:exports . "results") (:results . "file replace latex") (:session .= > "none") (:hlines . "no") (:padnewline . "yes") (:file . "test.png") (:resu= > lt-type . value) (:result-params "file" "replace" "latex") (:rowname-names)= > (:colname-names)) "" nil 0)) > org-babel-execute-src-block-maybe() > org-babel-execute-maybe() > org-babel-execute-safely-maybe() > run-hook-with-args-until-success(org-babel-execute-safely-maybe) > org-ctrl-c-ctrl-c(nil) > call-interactively(org-ctrl-c-ctrl-c nil nil) > > What am I missing here? > Nothing - it's a bug introduced by commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b: ,---- | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b | Author: Feng Shu | Date: Fri Apr 20 19:21:43 2012 +0200 | | Allow to use imagemagick for previewing LaTeX fragements. | | * org.el (org-latex-create-formula-image-program): New option | to use either dvipng or imagemagick to convert and preview | LaTeX fragments. | (org-preview-latex-fragment, org-format-latex): Handle the new | option. | (org-create-formula-image-with-dvipng): Rename from | `org-create-formula-image'. | (org-create-formula-image-with-imagemagick): New defun to | handle LaTeX preview with imagemagick. | (org-latex-color, org-latex-color-format): New defuns to | handle color conversions. | | * org-latex.el (org-latex-to-pdf-process, org-export-as-pdf): | Allow to use imagemagick to convert LaTeX fragments. | | * org-html.el (org-export-html-preprocess): Ditto. | | * org-exp.el (org-export-with-LaTeX-fragments): Ditto. | | * org.texi (@LaTeX{} fragments): Document imagemagick as an | alternative to dvipng. | `---- org-create-formula-image got renamed, but the reference in ob-latex.el to the original name was not changed. The quick-and-dirty "fix" is to change the reference in ob-latex.el to org-create-formula-image-dvipng or org-create-formula-image-imagemagick, depending on which method you happen to be using. But one would resort to that only in the direst emergency in order to get something working as quickly as possible. IMO, it would be better to have split the dvipng/imagemagick decision at a lower level in the code. That way, both org-format-latex and org-babel-execute:latex would use the common function. As it is, org-format-latex is a fairly "dirty" function and with the split, it got even dirtier. But there may be difficulties that my quick glance through the code has not uncovered: it needs a deeper look. Nick