* Re: Question on latex source block [not found] <mailman.113.1347292828.2054.emacs-orgmode@gnu.org> @ 2012-09-10 16:49 ` Richard Stanton 2012-09-10 19:07 ` Nick Dokos 0 siblings, 1 reply; 21+ messages in thread From: Richard Stanton @ 2012-09-10 16:49 UTC (permalink / raw) To: emacs-orgmode@gnu.org; +Cc: nicholas.dokos@hp.com, eric.schulte@gmx.com >Date: Sun, 09 Sep 2012 13:39:32 -0600 >From: Eric Schulte <eric.schulte@gmx.com> >To: nicholas.dokos@hp.com >Cc: Richard Stanton <stanton@haas.berkeley.edu>, > "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org> >Subject: Re: [O] Question on latex source block >Message-ID: <87ligj6l57.fsf@gmx.com> >Content-Type: text/plain > >Nick Dokos <nicholas.dokos@hp.com> writes: > >> Eric Schulte <eric.schulte@gmx.com> wrote: >> >>> > >>> > Nothing - it's a bug introduced by commit >>>a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b: >>> > >>> > ,---- >>> > | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b >>> > | Author: Feng Shu <tumashu@gmail.com> >>> > | 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. >>> > >>> >>> So, what would you recommend as a full fix in ob-latex.el? The >>>attached >>> commit selects an alternate function based on the value of the >>> `org-latex-create-formula-image-program' variable. Does this seem like >>> an appropriate fix to the problem? >>> >> >> For the time being, yes: I think this fix is entirely appropriate (nb: >> haven't tested it yet though). >> >> In the longer run, I would like to see a single function >> (org-create-formula-image redux) be called from the two call sites >> (org-format-latex and org-babel-execute:latex) and have the >> dvipng/imagemagick/etc split be entirely within that function. It's >> bound to happen that more methods of creating images (the etc part >> above) will need to be added in the future and it behooves one to >> arrange it so that only one place in the code is affected. >> >> Thanks, >> Nick >> > >Alright, > >I've just committed a patch which gets part-way to your suggest >solution. While the two backend-specific functions are still separate >(I agree they should be combined), I have brought back the >`org-create-formula-image' function, which now dispatches to the backend >specific functions. > >Additionally there are some problems in the `org-format-latex' function. >It lists mandatory arguments as optional, and appears to create >variables which are not required or properly set. > >These function should probably be cleaned at some point up by whoever is >maintaining Org-mode's LaTeX interfaces. > >Cheers, > >-- >Eric Schulte >http://cs.unm.edu/~eschulte Thanks. Things now get a lot further, but I'm still not quite getting what I was hoping for. In particular, this source: #+begin_src latex :file test.png \frac{1}{2} #+end_src results in this output: #+Results: #+BEGIN_LaTeX [[file:test.png]] #+END_LaTeX There are two problems here. 1) I'd like the graphic file to be displayed inline in the org file buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX lines 2) There is no file test.png in the current working directory. It may well be that I'm missing something, but I can't quite see what... Thanks. Richard Stanton ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-10 16:49 ` Question on latex source block Richard Stanton @ 2012-09-10 19:07 ` Nick Dokos 2012-09-10 20:43 ` Richard Stanton 0 siblings, 1 reply; 21+ messages in thread From: Nick Dokos @ 2012-09-10 19:07 UTC (permalink / raw) To: Richard Stanton; +Cc: emacs-orgmode@gnu.org, eric.schulte@gmx.com Richard Stanton <stanton@haas.berkeley.edu> wrote: > Thanks. Things now get a lot further, but I'm still not quite getting what > I was hoping for. In particular, this source: > > #+begin_src latex :file test.png > \frac{1}{2} > #+end_src > > results in this output: > > #+Results: > #+BEGIN_LaTeX > [[file:test.png]] > #+END_LaTeX > > There are two problems here. > > > 1) I'd like the graphic file to be displayed inline in the org file > buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX lines > If you add org-redisplay-inline-images to org-babel-after-execute-hook, that should happen whether or not the #+{BEGIN,END}_LaTeX lines are there (you can get rid of them by using :results raw). This works for me (after I C-c C-c on the second source block): --8<---------------cut here---------------start------------->8--- * foo #+begin_src latex :file frac.png :results raw \( \frac{1}{2} \) #+end_src * bar #+BEGIN_SRC elisp (add-hook 'org-babel-after-execute-hook (function org-redisplay-inline-images)) #+END_SRC --8<---------------cut here---------------end--------------->8--- > 2) There is no file test.png in the current working directory. > That however may be saying that there is a problem with your setup. Is there anything in *Messages* that indicates a problem? Assuming that debug-on-error is not set currently, you might also want to M-x toggle-debug-on-error RET and rerun the code block to see if there is some error that is triggered (sometimes errors are caught using condition-case and are hard to see). Just to be clear, the frac.png (I renamed it to avoid clobbering an unrelated test.png file in my setup) *is* produced in my case. Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-10 19:07 ` Nick Dokos @ 2012-09-10 20:43 ` Richard Stanton 2012-09-10 20:53 ` Nick Dokos 0 siblings, 1 reply; 21+ messages in thread From: Richard Stanton @ 2012-09-10 20:43 UTC (permalink / raw) To: nicholas.dokos@hp.com; +Cc: emacs-orgmode@gnu.org, eric.schulte@gmx.com On 9/10/12 12:07 PM, "Nick Dokos" <nicholas.dokos@hp.com> wrote: >Richard Stanton <stanton@haas.berkeley.edu> wrote: > > >> Thanks. Things now get a lot further, but I'm still not quite getting >>what >> I was hoping for. In particular, this source: >> >> #+begin_src latex :file test.png >> \frac{1}{2} >> #+end_src >> >> results in this output: >> >> #+Results: >> #+BEGIN_LaTeX >> [[file:test.png]] >> #+END_LaTeX >> >> There are two problems here. >> >> >> 1) I'd like the graphic file to be displayed inline in the org file >> buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX >>lines >> > >If you add org-redisplay-inline-images to org-babel-after-execute-hook, >that should happen whether or not the #+{BEGIN,END}_LaTeX lines are >there (you can get rid of them by using :results raw). > >This works for me (after I C-c C-c on the second source block): > >--8<---------------cut here---------------start------------->8--- > >* foo > >#+begin_src latex :file frac.png :results raw >\( >\frac{1}{2} >\) >#+end_src > > >* bar > >#+BEGIN_SRC elisp >(add-hook 'org-babel-after-execute-hook (function >org-redisplay-inline-images)) >#+END_SRC >--8<---------------cut here---------------end--------------->8--- > >> 2) There is no file test.png in the current working directory. >> > >That however may be saying that there is a problem with your setup. Is >there anything in *Messages* that indicates a problem? Assuming that >debug-on-error is not set currently, you might also want to > >M-x toggle-debug-on-error RET > >and rerun the code block to see if there is some error that is triggered >(sometimes errors are caught using condition-case and are hard to see). > >Just to be clear, the frac.png (I renamed it to avoid clobbering an >unrelated >test.png file in my setup) *is* produced in my case. > >Nick The *Messages* buffer did indeed show something: "Failed to create dvi file from /var/folders/zf/bgjm4tvs3wv_6q7_6z3b2nx00000gn/T/orgtex64181Q3t.tex" Checking the log file in that directory, I saw squawking about missing "$" signs around the mathematical expression. Adding these, so the block now reads #+begin_src latex :file test.png :results raw $\frac{1}{2}$ #+end_src it now compiles and displays perfectly. Thanks! ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-10 20:43 ` Richard Stanton @ 2012-09-10 20:53 ` Nick Dokos 2012-09-11 6:52 ` Giovanni Ridolfi 0 siblings, 1 reply; 21+ messages in thread From: Nick Dokos @ 2012-09-10 20:53 UTC (permalink / raw) To: Richard Stanton; +Cc: emacs-orgmode@gnu.org, eric.schulte@gmx.com Richard Stanton <stanton@haas.berkeley.edu> wrote: > The *Messages* buffer did indeed show something: > > "Failed to create dvi file from > /var/folders/zf/bgjm4tvs3wv_6q7_6z3b2nx00000gn/T/orgtex64181Q3t.tex" > > > Checking the log file in that directory, I saw squawking about missing "$" > signs around the mathematical expression. Adding these, so the block now > reads > > #+begin_src latex :file test.png :results raw > $\frac{1}{2}$ > #+end_src > > it now compiles and displays perfectly. > > Ah, right - I had to add inline math delimiters too but forgot to mention it. (I prefer using \(...\) over $...$ but that's just me). Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-10 20:53 ` Nick Dokos @ 2012-09-11 6:52 ` Giovanni Ridolfi 0 siblings, 0 replies; 21+ messages in thread From: Giovanni Ridolfi @ 2012-09-11 6:52 UTC (permalink / raw) To: nicholas.dokos@hp.com, Richard Stanton Cc: emacs-orgmode@gnu.org, eric.schulte@gmx.com Da: Nick Dokos <nicholas.dokos@hp.com> Inviato: Lunedì 10 Settembre 2012 22:53 Hi, Nick, > (I prefer using \(...\) over $...$ but that's just me). it is not just you, it is also (!) the Org Manual: To avoid conflicts with currency specifications, single `$' characters are only recognized as math delimiters if the enclosed text contains at most two line breaks, is directly attached to the `$' characters with no whitespace in between, and if the closing `$' is followed by whitespace, punctuation or a dash. For the other delimiters, there is no such restriction, so when in doubt, use `\(...\)' asinline math delimiters. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [[info:org#fragments]] cheers, Giovanni ^ permalink raw reply [flat|nested] 21+ messages in thread
* Question on latex source block @ 2012-09-09 5:15 Richard Stanton 2012-09-09 7:07 ` Nick Dokos 0 siblings, 1 reply; 21+ messages in thread From: Richard Stanton @ 2012-09-09 5:15 UTC (permalink / raw) To: emacs-orgmode@gnu.org Using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @ c:/emacs/site-lisp/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 dump: 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 "Transparent" :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") (:result-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? Thanks. Richard Stanton ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 5:15 Richard Stanton @ 2012-09-09 7:07 ` Nick Dokos 2012-09-09 7:17 ` Nick Dokos 2012-09-09 16:49 ` Eric Schulte 0 siblings, 2 replies; 21+ messages in thread From: Nick Dokos @ 2012-09-09 7:07 UTC (permalink / raw) To: Richard Stanton; +Cc: emacs-orgmode@gnu.org Richard Stanton <stanton@haas.berkeley.edu> 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 <tumashu@gmail.com> | 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 7:07 ` Nick Dokos @ 2012-09-09 7:17 ` Nick Dokos 2012-09-09 16:49 ` Eric Schulte 1 sibling, 0 replies; 21+ messages in thread From: Nick Dokos @ 2012-09-09 7:17 UTC (permalink / raw) To: Richard Stanton, emacs-orgmode@gnu.org Nick Dokos <nicholas.dokos@hp.com> wrote: > 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, Left out the "with" in the names. That should be org-create-formula-image-with-dvipng or org-create-formula-image-with-imagemagick Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 7:07 ` Nick Dokos 2012-09-09 7:17 ` Nick Dokos @ 2012-09-09 16:49 ` Eric Schulte 2012-09-09 17:44 ` Nick Dokos 1 sibling, 1 reply; 21+ messages in thread From: Eric Schulte @ 2012-09-09 16:49 UTC (permalink / raw) To: nicholas.dokos; +Cc: Richard Stanton, emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 2382 bytes --] > > Nothing - it's a bug introduced by commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b: > > ,---- > | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b > | Author: Feng Shu <tumashu@gmail.com> > | 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. > So, what would you recommend as a full fix in ob-latex.el? The attached commit selects an alternate function based on the value of the `org-latex-create-formula-image-program' variable. Does this seem like an appropriate fix to the problem? Thanks, [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-replace-org-create-formula-image-w-new-functions.patch --] [-- Type: text/x-patch, Size: 1369 bytes --] From 4ad24215f86f24d44439e013c16a4d78e1df68b6 Mon Sep 17 00:00:00 2001 From: Eric Schulte <eric.schulte@gmx.com> Date: Sun, 9 Sep 2012 10:48:02 -0600 Subject: [PATCH] replace org-create-formula-image w/new functions A previous commit deleted the definition of `org-create-formula-image' without removing all calls to the function. This commit fixes the resultant bug in ob-latex by replacing the deleted function with a conditional call to one of the two replacement functions. --- lisp/ob-latex.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index 43f673e..339584e 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -86,7 +86,12 @@ This function is called by `org-babel-execute-src-block'." org-export-latex-packages-alist))) (cond ((and (string-match "\\.png$" out-file) (not imagemagick)) - (org-create-formula-image + (funcall + (case org-latex-create-formula-image-program + ('dvipng #'org-create-formula-image-with-dvipng) + ('imagemagick #'org-create-formula-image-with-imagemagick) + (t (error + "invalid value of `org-latex-create-formula-image-program'"))) body out-file org-format-latex-options in-buffer)) ((or (string-match "\\.pdf$" out-file) imagemagick) (require 'org-latex) -- 1.7.12 [-- Attachment #3: Type: text/plain, Size: 46 bytes --] -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 16:49 ` Eric Schulte @ 2012-09-09 17:44 ` Nick Dokos 2012-09-09 19:39 ` Eric Schulte 0 siblings, 1 reply; 21+ messages in thread From: Nick Dokos @ 2012-09-09 17:44 UTC (permalink / raw) To: Eric Schulte; +Cc: Richard Stanton, emacs-orgmode@gnu.org Eric Schulte <eric.schulte@gmx.com> wrote: > > > > Nothing - it's a bug introduced by commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b: > > > > ,---- > > | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b > > | Author: Feng Shu <tumashu@gmail.com> > > | 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. > > > > So, what would you recommend as a full fix in ob-latex.el? The attached > commit selects an alternate function based on the value of the > `org-latex-create-formula-image-program' variable. Does this seem like > an appropriate fix to the problem? > For the time being, yes: I think this fix is entirely appropriate (nb: haven't tested it yet though). In the longer run, I would like to see a single function (org-create-formula-image redux) be called from the two call sites (org-format-latex and org-babel-execute:latex) and have the dvipng/imagemagick/etc split be entirely within that function. It's bound to happen that more methods of creating images (the etc part above) will need to be added in the future and it behooves one to arrange it so that only one place in the code is affected. Thanks, Nick > Thanks, > > From 4ad24215f86f24d44439e013c16a4d78e1df68b6 Mon Sep 17 00:00:00 2001 > From: Eric Schulte <eric.schulte@gmx.com> > Date: Sun, 9 Sep 2012 10:48:02 -0600 > Subject: [PATCH] replace org-create-formula-image w/new functions > > A previous commit deleted the definition of `org-create-formula-image' > without removing all calls to the function. This commit fixes the > resultant bug in ob-latex by replacing the deleted function with a > conditional call to one of the two replacement functions. > --- > lisp/ob-latex.el | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el > index 43f673e..339584e 100644 > --- a/lisp/ob-latex.el > +++ b/lisp/ob-latex.el > @@ -86,7 +86,12 @@ This function is called by `org-babel-execute-src-block'." > org-export-latex-packages-alist))) > (cond > ((and (string-match "\\.png$" out-file) (not imagemagick)) > - (org-create-formula-image > + (funcall > + (case org-latex-create-formula-image-program > + ('dvipng #'org-create-formula-image-with-dvipng) > + ('imagemagick #'org-create-formula-image-with-imagemagick) > + (t (error > + "invalid value of `org-latex-create-formula-image-program'"))) > body out-file org-format-latex-options in-buffer)) > ((or (string-match "\\.pdf$" out-file) imagemagick) > (require 'org-latex) > -- > 1.7.12 > > > -- > Eric Schulte > http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 17:44 ` Nick Dokos @ 2012-09-09 19:39 ` Eric Schulte 2012-09-09 20:31 ` Nick Dokos 2012-09-13 6:00 ` Jambunathan K 0 siblings, 2 replies; 21+ messages in thread From: Eric Schulte @ 2012-09-09 19:39 UTC (permalink / raw) To: nicholas.dokos; +Cc: Richard Stanton, emacs-orgmode@gnu.org Nick Dokos <nicholas.dokos@hp.com> writes: > Eric Schulte <eric.schulte@gmx.com> wrote: > >> > >> > Nothing - it's a bug introduced by commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b: >> > >> > ,---- >> > | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b >> > | Author: Feng Shu <tumashu@gmail.com> >> > | 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. >> > >> >> So, what would you recommend as a full fix in ob-latex.el? The attached >> commit selects an alternate function based on the value of the >> `org-latex-create-formula-image-program' variable. Does this seem like >> an appropriate fix to the problem? >> > > For the time being, yes: I think this fix is entirely appropriate (nb: > haven't tested it yet though). > > In the longer run, I would like to see a single function > (org-create-formula-image redux) be called from the two call sites > (org-format-latex and org-babel-execute:latex) and have the > dvipng/imagemagick/etc split be entirely within that function. It's > bound to happen that more methods of creating images (the etc part > above) will need to be added in the future and it behooves one to > arrange it so that only one place in the code is affected. > > Thanks, > Nick > Alright, I've just committed a patch which gets part-way to your suggest solution. While the two backend-specific functions are still separate (I agree they should be combined), I have brought back the `org-create-formula-image' function, which now dispatches to the backend specific functions. Additionally there are some problems in the `org-format-latex' function. It lists mandatory arguments as optional, and appears to create variables which are not required or properly set. These function should probably be cleaned at some point up by whoever is maintaining Org-mode's LaTeX interfaces. Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 19:39 ` Eric Schulte @ 2012-09-09 20:31 ` Nick Dokos 2012-09-13 6:00 ` Jambunathan K 1 sibling, 0 replies; 21+ messages in thread From: Nick Dokos @ 2012-09-09 20:31 UTC (permalink / raw) To: Eric Schulte; +Cc: Richard Stanton, emacs-orgmode@gnu.org Eric Schulte <eric.schulte@gmx.com> wrote: > Alright, > > I've just committed a patch which gets part-way to your suggest > solution. While the two backend-specific functions are still separate > (I agree they should be combined), I have brought back the > `org-create-formula-image' function, which now dispatches to the backend > specific functions. > Combining them will require a bit more digging however, so pushing the decision down the stack is a useful step: thanks for doing it! > Additionally there are some problems in the `org-format-latex' function. > It lists mandatory arguments as optional, and appears to create > variables which are not required or properly set. > I agree that the function is quite "dirty". There are also known bugs there: see http://thread.gmane.org/gmane.emacs.orgmode/50584. AFAIK, they have not been fixed. Thanks, Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-09 19:39 ` Eric Schulte 2012-09-09 20:31 ` Nick Dokos @ 2012-09-13 6:00 ` Jambunathan K 2012-09-13 7:28 ` Nick Dokos 2012-09-13 15:07 ` Eric Schulte 1 sibling, 2 replies; 21+ messages in thread From: Jambunathan K @ 2012-09-13 6:00 UTC (permalink / raw) To: Eric Schulte; +Cc: Richard Stanton, nicholas.dokos, emacs-orgmode@gnu.org Eric Schulte <eric.schulte@gmx.com> writes: > Alright, > > I've just committed a patch which gets part-way to your suggest > solution. While the two backend-specific functions are still separate > (I agree they should be combined), I have brought back the > `org-create-formula-image' function, which now dispatches to the backend > specific functions. > > Additionally there are some problems in the `org-format-latex' function. > It lists mandatory arguments as optional, and appears to create > variables which are not required or properly set. > > These function should probably be cleaned at some point up by whoever is > maintaining Org-mode's LaTeX interfaces. This (or one of the recent commits) is creating the following regression. I have not dived in to the details. Export the below snippert with C-c C-e o. You will see this. Export works fine with tree at commit 8e445333. Debugger entered--Lisp error: (error "Not enough arguments for format string") format("rgb %s %s %s") apply(format "rgb %s %s %s" nil) org-dvipng-color-format("Transparent") org-create-formula-image-with-dvipng(#("\\begin{equation*}\n x=\\sqrt{b}\n \\end{equation*}" 0 18 (fontified t) 18 54 (fontified t)) "/home/kjambunathan/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.png" (:foreground default :background default :scale 1.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) nil) org-create-formula-image(#("\\begin{equation*}\n x=\\sqrt{b}\n \\end{equation*}" 0 18 (fontified t) 18 54 (fontified t)) "/home/kjambunathan/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.png" (:foreground default :background default :scale 1.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) nil dvipng) org-format-latex("ltxpng/regression" "." nil "Creating LaTeX image %s" nil nil dvipng) org-export-odt-do-preprocess-latex-fragments() org-export-odt-preprocess-latex-fragments() run-hooks(org-export-preprocess-after-blockquote-hook) org-export-preprocess-string(#("#+TITLE: regression.org\n#+AUTHOR: Jambunathan K\n#+EMAIL: kjambunathan@gmail.com\n#+DATE: 2012-09-13 Thu\n#+DESCRIPTION:\n#+KEYWORDS:\n#+LANGUAGE: en\n#+OPTIONS: H:3 num:t toc:t \\n:nil @:t ::t |:t ^:t -:t f:t *:t <:t\n#+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:t todo:t pri:nil tags:t\n#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js\n#+EXPORT_SELECT_TAGS: export\n#+EXPORT_EXCLUDE_TAGS: noexport\n#+LINK_UP: \n#+LINK_HOME: \n#+XSLT:\n\n\n#+name: Equation:2\n \\begin{equation*}\n x=\\sqrt{b}\n \\end{equation*}\n" 0 8 (fontified t font-lock-fontified t face org-document-info-keyword) 8 13 (fontified t) 13 27 (fontified t font-lock-fontified t face org-document-title) 27 28 (fontified t) 28 37 (fontified t font-lock-fontified t face org-document-info-keyword) 37 41 (fontified t) 41 54 (fontified t font-lock-fontified t face org-document-info) 54 55 (fontified t) 55 63 (fontified t font-lock-fontified t face org-document-info-keyword) 63 68 (fontified t) 68 90 (fontified t font-lock-fontified t face org-document-info) 90 91 (fontified t) 91 98 (fontified t font-lock-fontified t face org-document-info-keyword) 98 104 (fontified t) 104 118 (fontified t font-lock-fontified t face org-document-info) 118 119 (fontified t) 119 133 (fontified t font-lock-fontified t face org-meta-line) 133 134 (fontified t) 134 145 (fontified t font-lock-fontified t face org-meta-line) 145 146 (fontified t) 146 161 (fontified t font-lock-fontified t face org-meta-line) 161 162 (fontified t) 162 229 (fontified t font-lock-fontified t face org-meta-line) 229 230 (fontified t) 230 296 (fontified t font-lock-fontified t face org-meta-line) 296 297 (fontified t) 297 366 (fontified t font-lock-fontified t face org-meta-line) 366 395 (fontified t font-lock-fontified t org-no-flyspell t mouse-face highlight face org-meta-line keymap #1=(keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 395 396 (fontified t rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo org-linked-text) font-lock-fontified t org-no-flyspell t mouse-face highlight face org-meta-line keymap #1#) 396 397 (fontified t) 397 425 (fontified t font-lock-fontified t face org-meta-line) 425 426 (fontified t) 426 457 (fontified t font-lock-fontified t face org-meta-line) 457 458 (fontified t) 458 471 (fontified t font-lock-fontified t face org-meta-line) 471 472 (fontified t) 472 485 (fontified t font-lock-fontified t face org-meta-line) 485 486 (fontified t) 486 493 (fontified t font-lock-fontified t face org-meta-line) 493 494 (fontified t) 494 495 (fontified t) 495 496 (fontified t) 496 514 (fontified t font-lock-fontified t face org-meta-line) 514 515 (fontified t) 515 538 (fontified t) 538 575 (fontified t)) :emph-multiline t :for-backend odt :skip-before-1st-heading nil :drawers t :todo-keywords t :tasks t :tags t :priority nil :footnotes t :timestamps t :archived-trees headline :select-tags ("export") :exclude-tags ("noexport") :add-text nil :LaTeX-fragments dvipng) org-do-lparse(nil hidden nil nil nil nil) org-lparse("odt" "odt" nil hidden) org-lparse-and-open("odt" "odt" nil) #[nil "\303\b\206\0\304\304 #\n \210\207" [org-export-odt-preferred-output-format arg --cleanup-xml-buffers org-lparse-and-open "odt"] 4]() org-export-as-odt-and-open(nil) call-interactively(org-export-as-odt-and-open) org-export(nil) --8<---------------cut here---------------start------------->8--- #+TITLE: regression.org #+AUTHOR: Jambunathan K #+EMAIL: kjambunathan@gmail.com #+DATE: 2012-09-13 Thu #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:t todo:t pri:nil tags:t #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LINK_UP: #+LINK_HOME: #+XSLT: #+name: Equation:2 \begin{equation*} x=\sqrt{b} \end{equation*} --8<---------------cut here---------------end--------------->8--- -- ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 6:00 ` Jambunathan K @ 2012-09-13 7:28 ` Nick Dokos 2012-09-13 7:58 ` Nick Dokos 2012-09-13 15:07 ` Eric Schulte 1 sibling, 1 reply; 21+ messages in thread From: Nick Dokos @ 2012-09-13 7:28 UTC (permalink / raw) To: Jambunathan K; +Cc: Richard Stanton, emacs-orgmode@gnu.org, Eric Schulte Jambunathan K <kjambunathan@gmail.com> wrote: > Eric Schulte <eric.schulte@gmx.com> writes: > > > Alright, > > > > I've just committed a patch which gets part-way to your suggest > > solution. While the two backend-specific functions are still separate > > (I agree they should be combined), I have brought back the > > `org-create-formula-image' function, which now dispatches to the backend > > specific functions. > > > > Additionally there are some problems in the `org-format-latex' function. > > It lists mandatory arguments as optional, and appears to create > > variables which are not required or properly set. > > > > These function should probably be cleaned at some point up by whoever is > > maintaining Org-mode's LaTeX interfaces. > > This (or one of the recent commits) is creating the following > regression. I have not dived in to the details. > > Export the below snippert with C-c C-e o. You will see this. > Seems to be caused by 149cc04782651e74764eb3188f6a6f178fe25f64, which is unfortunate since that fixes (at least I *think* it fixes) some problems when no default fore/background is defined (e.g. when emacs is run in batch mode). It would be nice if this could be fixed without reverting that commit completely. Nick > Export works fine with tree at commit 8e445333.=20=20 > > Debugger entered--Lisp error: (error "Not enough arguments for format strin= > g") > format("rgb %s %s %s") > apply(format "rgb %s %s %s" nil) > org-dvipng-color-format("Transparent") > org-create-formula-image-with-dvipng(#("\\begin{equation*}\n x=3D\\sq= > rt{b}\n \\end{equation*}" 0 18 (fontified t) 18 54 (fontified t)) "/hom= > e/kjambunathan/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.p= > ng" (:foreground default :background default :scale 1.0 :html-foreground "B= > lack" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1= > " "$" "$$" "\\(" "\\[")) nil) > org-create-formula-image(#("\\begin{equation*}\n x=3D\\sqrt{b}\n = > \\end{equation*}" 0 18 (fontified t) 18 54 (fontified t)) "/home/kjambunath= > an/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.png" (:foregr= > ound default :background default :scale 1.0 :html-foreground "Black" :html-= > background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "= > \\(" "\\[")) nil dvipng) > org-format-latex("ltxpng/regression" "." nil "Creating LaTeX image %s" ni= > l nil dvipng) > org-export-odt-do-preprocess-latex-fragments() > org-export-odt-preprocess-latex-fragments() > run-hooks(org-export-preprocess-after-blockquote-hook) > org-export-preprocess-string(#("#+TITLE: regression.org\n#+AUTHOR: = > Jambunathan K\n#+EMAIL: kjambunathan@gmail.com\n#+DATE: 2012-09-1= > 3 Thu\n#+DESCRIPTION:\n#+KEYWORDS:\n#+LANGUAGE: en\n#+OPTIONS: H:3 num:t= > toc:t \\n:nil @:t ::t |:t ^:t -:t f:t *:t <:t\n#+OPTIONS: TeX:t LaTeX:dv= > ipng skip:nil d:t todo:t pri:nil tags:t\n#+INFOJS_OPT: view:nil toc:nil lto= > c:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js\n#+EXPORT= > _SELECT_TAGS: export\n#+EXPORT_EXCLUDE_TAGS: noexport\n#+LINK_UP: \n#+LIN= > K_HOME: \n#+XSLT:\n\n\n#+name: Equation:2\n \\begin{equation*}\n x= > =3D\\sqrt{b}\n \\end{equation*}\n" 0 8 (fontified t font-lock-fontified= > t face org-document-info-keyword) 8 13 (fontified t) 13 27 (fontified t fo= > nt-lock-fontified t face org-document-title) 27 28 (fontified t) 28 37 (fon= > tified t font-lock-fontified t face org-document-info-keyword) 37 41 (fonti= > fied t) 41 54 (fontified t font-lock-fontified t face org-document-info) 54= > 55 (fontified t) 55 63 (fontified t font-lock-fontified t face org-documen= > t-info-keyword) 63 68 (fontified t) 68 90 (fontified t font-lock-fontified = > t face org-document-info) 90 91 (fontified t) 91 98 (fontified t font-lock-= > fontified t face org-document-info-keyword) 98 104 (fontified t) 104 118 (f= > ontified t font-lock-fontified t face org-document-info) 118 119 (fontified= > t) 119 133 (fontified t font-lock-fontified t face org-meta-line) 133 134 = > (fontified t) 134 145 (fontified t font-lock-fontified t face org-meta-line= > ) 145 146 (fontified t) 146 161 (fontified t font-lock-fontified t face org= > -meta-line) 161 162 (fontified t) 162 229 (fontified t font-lock-fontified = > t face org-meta-line) 229 230 (fontified t) 230 296 (fontified t font-lock-= > fontified t face org-meta-line) 296 297 (fontified t) 297 366 (fontified t = > font-lock-fontified t face org-meta-line) 366 395 (fontified t font-lock-fo= > ntified t org-no-flyspell t mouse-face highlight face org-meta-line keymap = > #1=3D(keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) = > (mouse-2 . org-open-at-mouse))) 395 396 (fontified t rear-nonsticky (mouse-= > face highlight keymap invisible intangible help-echo org-linked-text) font-= > lock-fontified t org-no-flyspell t mouse-face highlight face org-meta-line = > keymap #1#) 396 397 (fontified t) 397 425 (fontified t font-lock-fontified = > t face org-meta-line) 425 426 (fontified t) 426 457 (fontified t font-lock-= > fontified t face org-meta-line) 457 458 (fontified t) 458 471 (fontified t = > font-lock-fontified t face org-meta-line) 471 472 (fontified t) 472 485 (fo= > ntified t font-lock-fontified t face org-meta-line) 485 486 (fontified t) 4= > 86 493 (fontified t font-lock-fontified t face org-meta-line) 493 494 (font= > ified t) 494 495 (fontified t) 495 496 (fontified t) 496 514 (fontified t f= > ont-lock-fontified t face org-meta-line) 514 515 (fontified t) 515 538 (fon= > tified t) 538 575 (fontified t)) :emph-multiline t :for-backend odt :skip-b= > efore-1st-heading nil :drawers t :todo-keywords t :tasks t :tags t :priorit= > y nil :footnotes t :timestamps t :archived-trees headline :select-tags ("ex= > port") :exclude-tags ("noexport") :add-text nil :LaTeX-fragments dvipng) > org-do-lparse(nil hidden nil nil nil nil) > org-lparse("odt" "odt" nil hidden) > org-lparse-and-open("odt" "odt" nil) > #[nil "\303\b\206=00\304\304 #\n \210\207" [org-export-odt-preferred-outpu= > t-format arg --cleanup-xml-buffers org-lparse-and-open "odt"] 4]() > org-export-as-odt-and-open(nil) > call-interactively(org-export-as-odt-and-open) > org-export(nil) > > > #+TITLE: regression.org > #+AUTHOR: Jambunathan K > #+EMAIL: kjambunathan@gmail.com > #+DATE: 2012-09-13 Thu > #+DESCRIPTION: > #+KEYWORDS: > #+LANGUAGE: en > #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t > #+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:t todo:t pri:nil tags:t > #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http:/= > /orgmode.org/org-info.js > #+EXPORT_SELECT_TAGS: export > #+EXPORT_EXCLUDE_TAGS: noexport > #+LINK_UP:=20=20=20 > #+LINK_HOME:=20 > #+XSLT: > > > #+name: Equation:2 > \begin{equation*} > x=3D\sqrt{b} > \end{equation*} > > > --=20 > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 7:28 ` Nick Dokos @ 2012-09-13 7:58 ` Nick Dokos 0 siblings, 0 replies; 21+ messages in thread From: Nick Dokos @ 2012-09-13 7:58 UTC (permalink / raw) To: Jambunathan K, Richard Stanton, emacs-orgmode@gnu.org, Eric Schulte Nick Dokos <nicholas.dokos@hp.com> wrote: > > Seems to be caused by 149cc04782651e74764eb3188f6a6f178fe25f64, which is > unfortunate since that fixes (at least I *think* it fixes) some problems > when no default fore/background is defined (e.g. when emacs is run in > batch mode). It would be nice if this could be fixed without reverting > that commit completely. > I should have added that the problem is in org-create-formula-image-with-dvipng, in the code that tries to set the background around line 17616: ,---- | ... | (if (eq bg 'default) (setq bg (org-dvipng-color :background)) | (setq bg (org-dvipng-color-format bg))) | ... `---- bg is "Transparent" and org-dvipng-color-format barfs on that, since it cannot find it in the color "database". Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 6:00 ` Jambunathan K 2012-09-13 7:28 ` Nick Dokos @ 2012-09-13 15:07 ` Eric Schulte 2012-09-13 16:04 ` Nick Dokos 1 sibling, 1 reply; 21+ messages in thread From: Eric Schulte @ 2012-09-13 15:07 UTC (permalink / raw) To: Jambunathan K; +Cc: Richard Stanton, nicholas.dokos, emacs-orgmode@gnu.org Jambunathan K <kjambunathan@gmail.com> writes: > Eric Schulte <eric.schulte@gmx.com> writes: > >> Alright, >> >> I've just committed a patch which gets part-way to your suggest >> solution. While the two backend-specific functions are still separate >> (I agree they should be combined), I have brought back the >> `org-create-formula-image' function, which now dispatches to the backend >> specific functions. >> >> Additionally there are some problems in the `org-format-latex' function. >> It lists mandatory arguments as optional, and appears to create >> variables which are not required or properly set. >> >> These function should probably be cleaned at some point up by whoever is >> maintaining Org-mode's LaTeX interfaces. > > This (or one of the recent commits) is creating the following > regression. I have not dived in to the details. > Perhaps you could use git-bisect to find the ID of the offending commit? Also a reproduction recipe would be useful. Does this bug only occur if `org-export-as-odt-and-open' is called, or can it be reproduced by simply calling `org-preview-latex-fragment' or `org-create-formula-image'. Note: my patch (referenced above) did not touch the `org-create-formula-image-with-dvipng' function which appears in your backtrace (below), so I doubt my commit is the culprit. Best, > > Export the below snippert with C-c C-e o. You will see this. > > Export works fine with tree at commit 8e445333. > > Debugger entered--Lisp error: (error "Not enough arguments for format string") > format("rgb %s %s %s") > apply(format "rgb %s %s %s" nil) > org-dvipng-color-format("Transparent") > org-create-formula-image-with-dvipng(#("\\begin{equation*}\n > x=\\sqrt{b}\n \\end{equation*}" 0 18 (fontified t) 18 54 (fontified > t)) > "/home/kjambunathan/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.png" > (:foreground default :background default :scale 1.0 :html-foreground > "Black" :html-background "Transparent" :html-scale 1.0 :matchers > ("begin" "$1" "$" "$$" "\\(" "\\[")) nil) > org-create-formula-image(#("\\begin{equation*}\n x=\\sqrt{b}\n > \\end{equation*}" 0 18 (fontified t) 18 54 (fontified t)) > "/home/kjambunathan/ltxpng/regression_8ae36f2f639503b0a2290277a2d42b284db15c21.png" > (:foreground default :background default :scale 1.0 :html-foreground > "Black" :html-background "Transparent" :html-scale 1.0 :matchers > ("begin" "$1" "$" "$$" "\\(" "\\[")) nil dvipng) > org-format-latex("ltxpng/regression" "." nil "Creating LaTeX image %s" nil nil dvipng) > org-export-odt-do-preprocess-latex-fragments() > org-export-odt-preprocess-latex-fragments() > run-hooks(org-export-preprocess-after-blockquote-hook) > org-export-preprocess-string(#("#+TITLE: regression.org\n#+AUTHOR: > Jambunathan K\n#+EMAIL: kjambunathan@gmail.com\n#+DATE: 2012-09-13 > Thu\n#+DESCRIPTION:\n#+KEYWORDS:\n#+LANGUAGE: en\n#+OPTIONS: H:3 num:t > toc:t \\n:nil @:t ::t |:t ^:t -:t f:t *:t <:t\n#+OPTIONS: TeX:t > LaTeX:dvipng skip:nil d:t todo:t pri:nil tags:t\n#+INFOJS_OPT: > view:nil toc:nil ltoc:t mouse:underline buttons:0 > path:http://orgmode.org/org-info.js\n#+EXPORT_SELECT_TAGS: > export\n#+EXPORT_EXCLUDE_TAGS: noexport\n#+LINK_UP: \n#+LINK_HOME: > \n#+XSLT:\n\n\n#+name: Equation:2\n \\begin{equation*}\n x=\\sqrt{b}\n > \\end{equation*}\n" 0 8 (fontified t font-lock-fontified t face > org-document-info-keyword) 8 13 (fontified t) 13 27 (fontified t > font-lock-fontified t face org-document-title) 27 28 (fontified t) 28 > 37 (fontified t font-lock-fontified t face org-document-info-keyword) > 37 41 (fontified t) 41 54 (fontified t font-lock-fontified t face > org-document-info) 54 55 (fontified t) 55 63 (fontified t > font-lock-fontified t face org-document-info-keyword) 63 68 (fontified > t) 68 90 (fontified t font-lock-fontified t face org-document-info) 90 > 91 (fontified t) 91 98 (fontified t font-lock-fontified t face > org-document-info-keyword) 98 104 (fontified t) 104 118 (fontified t > font-lock-fontified t face org-document-info) 118 119 (fontified t) > 119 133 (fontified t font-lock-fontified t face org-meta-line) 133 134 > (fontified t) 134 145 (fontified t font-lock-fontified t face > org-meta-line) 145 146 (fontified t) 146 161 (fontified t > font-lock-fontified t face org-meta-line) 161 162 (fontified t) 162 > 229 (fontified t font-lock-fontified t face org-meta-line) 229 230 > (fontified t) 230 296 (fontified t font-lock-fontified t face > org-meta-line) 296 297 (fontified t) 297 366 (fontified t > font-lock-fontified t face org-meta-line) 366 395 (fontified t > font-lock-fontified t org-no-flyspell t mouse-face highlight face > org-meta-line keymap #1=(keymap (follow-link . mouse-face) (mouse-3 > . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 395 396 > (fontified t rear-nonsticky (mouse-face highlight keymap invisible > intangible help-echo org-linked-text) font-lock-fontified t > org-no-flyspell t mouse-face highlight face org-meta-line keymap #1#) > 396 397 (fontified t) 397 425 (fontified t font-lock-fontified t face > org-meta-line) 425 426 (fontified t) 426 457 (fontified t > font-lock-fontified t face org-meta-line) 457 458 (fontified t) 458 > 471 (fontified t font-lock-fontified t face org-meta-line) 471 472 > (fontified t) 472 485 (fontified t font-lock-fontified t face > org-meta-line) 485 486 (fontified t) 486 493 (fontified t > font-lock-fontified t face org-meta-line) 493 494 (fontified t) 494 > 495 (fontified t) 495 496 (fontified t) 496 514 (fontified t > font-lock-fontified t face org-meta-line) 514 515 (fontified t) 515 > 538 (fontified t) 538 575 (fontified t)) :emph-multiline t > :for-backend odt :skip-before-1st-heading nil :drawers t > :todo-keywords t :tasks t :tags t :priority nil :footnotes t > :timestamps t :archived-trees headline :select-tags ("export") > :exclude-tags ("noexport") :add-text nil :LaTeX-fragments dvipng) > org-do-lparse(nil hidden nil nil nil nil) > org-lparse("odt" "odt" nil hidden) > org-lparse-and-open("odt" "odt" nil) > #[nil "\303\b\206\304\304 #\n \210\207" [org-export-odt-preferred-output-format arg --cleanup-xml-buffers org-lparse-and-open "odt"] 4]() > org-export-as-odt-and-open(nil) > call-interactively(org-export-as-odt-and-open) > org-export(nil) > > > --8<---------------cut here---------------start------------->8--- > #+TITLE: regression.org > #+AUTHOR: Jambunathan K > #+EMAIL: kjambunathan@gmail.com > #+DATE: 2012-09-13 Thu > #+DESCRIPTION: > #+KEYWORDS: > #+LANGUAGE: en > #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t > #+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:t todo:t pri:nil tags:t > #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js > #+EXPORT_SELECT_TAGS: export > #+EXPORT_EXCLUDE_TAGS: noexport > #+LINK_UP: > #+LINK_HOME: > #+XSLT: > > > #+name: Equation:2 > \begin{equation*} > x=\sqrt{b} > \end{equation*} > --8<---------------cut here---------------end--------------->8--- -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 15:07 ` Eric Schulte @ 2012-09-13 16:04 ` Nick Dokos 2012-09-13 17:09 ` Eric Schulte 0 siblings, 1 reply; 21+ messages in thread From: Nick Dokos @ 2012-09-13 16:04 UTC (permalink / raw) To: Eric Schulte; +Cc: Richard Stanton, emacs-orgmode@gnu.org, Jambunathan K Eric Schulte <eric.schulte@gmx.com> wrote: > Jambunathan K <kjambunathan@gmail.com> writes: > > > Eric Schulte <eric.schulte@gmx.com> writes: > > > >> Alright, > >> > >> I've just committed a patch which gets part-way to your suggest > >> solution. While the two backend-specific functions are still separate > >> (I agree they should be combined), I have brought back the > >> `org-create-formula-image' function, which now dispatches to the backend > >> specific functions. > >> > >> Additionally there are some problems in the `org-format-latex' function. > >> It lists mandatory arguments as optional, and appears to create > >> variables which are not required or properly set. > >> > >> These function should probably be cleaned at some point up by whoever is > >> maintaining Org-mode's LaTeX interfaces. > > > > This (or one of the recent commits) is creating the following > > regression. I have not dived in to the details. > > > > Perhaps you could use git-bisect to find the ID of the offending commit? > I did and I replied both to the list and cc: to you and Jambunathan (and I added a clarification later). You probably haven't reached that point in your email backlog yet, but if you don't see them let me know and I'll forward them to you. Nick ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 16:04 ` Nick Dokos @ 2012-09-13 17:09 ` Eric Schulte 2012-09-13 19:12 ` Abdó Roig-Maranges 0 siblings, 1 reply; 21+ messages in thread From: Eric Schulte @ 2012-09-13 17:09 UTC (permalink / raw) To: nicholas.dokos; +Cc: Abdó Roig-Maranges, Org-mode, Jambunathan K >> >> Perhaps you could use git-bisect to find the ID of the offending commit? >> > > I did and I replied both to the list and cc: to you and Jambunathan (and > I added a clarification later). You probably haven't reached that point in > your email backlog yet, but if you don't see them let me know and I'll > forward them to you. > Oh, your' correct Nick, I do see this in my folder. Thanks for taking the time to do this Bisect. > Seems to be caused by 149cc04782651e74764eb3188f6a6f178fe25f64, which is > unfortunate since that fixes (at least I *think* it fixes) some problems > when no default fore/background is defined (e.g. when emacs is run in > batch mode). It would be nice if this could be fixed without reverting > that commit completely. I'm CC'ing Abdó (the author of that commit). Hopefully he can take a shot at solving this. -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 17:09 ` Eric Schulte @ 2012-09-13 19:12 ` Abdó Roig-Maranges 2012-09-13 19:42 ` Jambunathan K 0 siblings, 1 reply; 21+ messages in thread From: Abdó Roig-Maranges @ 2012-09-13 19:12 UTC (permalink / raw) To: Eric Schulte, nicholas.dokos; +Cc: Org-mode, Jambunathan K [-- Attachment #1: Type: text/plain, Size: 597 bytes --] Hi, Here is a patch. Sorry for the bug! Abdó. Eric Schulte <eric.schulte@gmx.com> writes: >> Seems to be caused by 149cc04782651e74764eb3188f6a6f178fe25f64, which is >> unfortunate since that fixes (at least I *think* it fixes) some problems >> when no default fore/background is defined (e.g. when emacs is run in >> batch mode). It would be nice if this could be fixed without reverting >> that commit completely. > > I'm CC'ing Abdó (the author of that commit). Hopefully he can take a > shot at solving this. > > -- > Eric Schulte > http://cs.unm.edu/~eschulte [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: the patch --] [-- Type: text/x-patch, Size: 1310 bytes --] From a48efe084848aa1de8ad4abc5780d49b424a3980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3=20Roig-Maranges?= <abdo.roig@gmail.com> Date: Thu, 13 Sep 2012 20:13:37 +0200 Subject: [PATCH] fix dvipng latex export with Transparent background * org.el (org-create-formula-image-with-dvipng): Fixes a bug introduced in 149cc04782651e74764eb3188f6a6f178fe25f64 that made it fail with no :foreground and :background attributes set, due to bad handling of "Transparent" color. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 881dbd5..1c18d70 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17612,9 +17612,9 @@ share a good deal of logic." (bg (or (plist-get options (if buffer :background :html-background)) "Transparent"))) (if (eq fg 'default) (setq fg (org-dvipng-color :foreground)) - (setq fg (org-dvipng-color-format fg))) + (unless (string= fg "Transparent") (setq fg (org-dvipng-color-format fg)))) (if (eq bg 'default) (setq bg (org-dvipng-color :background)) - (setq bg (org-dvipng-color-format bg))) + (unless (string= bg "Transparent") (setq bg (org-dvipng-color-format bg)))) (with-temp-file texfile (insert (org-splice-latex-header org-format-latex-header -- 1.7.12 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 19:12 ` Abdó Roig-Maranges @ 2012-09-13 19:42 ` Jambunathan K 2012-09-14 7:27 ` Bastien 0 siblings, 1 reply; 21+ messages in thread From: Jambunathan K @ 2012-09-13 19:42 UTC (permalink / raw) To: Abdó Roig-Maranges; +Cc: nicholas.dokos, Org-mode Abdó Roig-Maranges <abdo.roig@gmail.com> writes: > Hi, > > Here is a patch. Sorry for the bug! Thanks. I did a quick test and pushed the patch to repo. > Abdó. > > Eric Schulte <eric.schulte@gmx.com> writes: > >>> Seems to be caused by 149cc04782651e74764eb3188f6a6f178fe25f64, which is >>> unfortunate since that fixes (at least I *think* it fixes) some problems >>> when no default fore/background is defined (e.g. when emacs is run in >>> batch mode). It would be nice if this could be fixed without reverting >>> that commit completely. >> >> I'm CC'ing Abdó (the author of that commit). Hopefully he can take a >> shot at solving this. >> >> -- >> Eric Schulte >> http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Question on latex source block 2012-09-13 19:42 ` Jambunathan K @ 2012-09-14 7:27 ` Bastien 0 siblings, 0 replies; 21+ messages in thread From: Bastien @ 2012-09-14 7:27 UTC (permalink / raw) To: Jambunathan K; +Cc: Abdó Roig-Maranges, nicholas.dokos, Org-mode Jambunathan K <kjambunathan@gmail.com> writes: > Abdó Roig-Maranges <abdo.roig@gmail.com> writes: > >> Hi, >> >> Here is a patch. Sorry for the bug! > > Thanks. I did a quick test and pushed the patch to repo. Abdo, thanks for the patch! And thanks to Jambunathan for applying it. -- Bastien ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2012-09-14 7:27 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.113.1347292828.2054.emacs-orgmode@gnu.org> 2012-09-10 16:49 ` Question on latex source block Richard Stanton 2012-09-10 19:07 ` Nick Dokos 2012-09-10 20:43 ` Richard Stanton 2012-09-10 20:53 ` Nick Dokos 2012-09-11 6:52 ` Giovanni Ridolfi 2012-09-09 5:15 Richard Stanton 2012-09-09 7:07 ` Nick Dokos 2012-09-09 7:17 ` Nick Dokos 2012-09-09 16:49 ` Eric Schulte 2012-09-09 17:44 ` Nick Dokos 2012-09-09 19:39 ` Eric Schulte 2012-09-09 20:31 ` Nick Dokos 2012-09-13 6:00 ` Jambunathan K 2012-09-13 7:28 ` Nick Dokos 2012-09-13 7:58 ` Nick Dokos 2012-09-13 15:07 ` Eric Schulte 2012-09-13 16:04 ` Nick Dokos 2012-09-13 17:09 ` Eric Schulte 2012-09-13 19:12 ` Abdó Roig-Maranges 2012-09-13 19:42 ` Jambunathan K 2012-09-14 7:27 ` Bastien
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).