Re: [O] Mathjax vs. problems with imagemagick
Nick Dokos wrote: My org-latex-pdf-process setting is (setq org-latex-pdf-process '(texi2dvi --shell-escape --pdf %f)) and I'm experimenting with (setq org-latex-pdf-process '(latexmk --shell-escape -pdf -xelatex %f)) FWIW, I do have: (setq org-latex-pdf-process (if (executable-find latexmk) '(latexmk -CF -pdf %f latexmk -c) ; must clean .fdb_latexmk, .fls, .ilg, ; .ind, etc. '(pdflatex -interaction=nonstopmode -output-directory=%o %f pdflatex -interaction=nonstopmode -output-directory=%o %f pdflatex -interaction=nonstopmode -output-directory=%o %f))) Best regards, Seb -- Sebastien Vauban
Re: [O] Mathjax vs. problems with imagemagick
Le ven. 11 juil. 2014 à 02:59:23 , Nick Dokos ndo...@gmail.com a envoyé ce message: Can you please post an example org file and the tex file that's produced that gives you such bad images? Dear Nick, I sent an email three days ago to tell you that I've got the solution. I said: I have put again in my init.el the code from the page [[http://orgmode.org/worg/org-tutorials/org-latex-preview.html]] , i.e. (setq org-latex-listings 'minted) (require 'ox-latex) (add-to-list 'org-latex-packages-alist '( minted)) and I have added : ;; Let the exporter use the -shell-escape option to let latex ;; execute external programs. ;; This obviously and can be dangerous to activate! (setq org-latex-pdf-process '(xelatex -shell-escape -interaction nonstopmode -output-directory %o %f)) Now it works. But I do not know really why. End of quotation . I would have been happy to show you an example. But now I meet again, as often, the tiring same problem: Creating LaTeX Image... Failed to create dvi file from /tmp/orgtex15065yFA.tex Creating LaTeX Image... Failed to create dvi file from /tmp/orgtex15065MaM.tex Ispell process killed Starting new Ispell process [aspell::en] ... Mark set Sending... Mark set [2 times] mm-insert-file-contents: Opening input file: aucun fichier ou dossier de ce type, /tmp/ltxpng/latex15065_PG_37f10648c57a40194a74eaabbaa5c1678a5d2046.png Mark set Nevertheless, the png file is in /tmp/ltxpng and it is a nice png image. I remind that the error in creating the dvi file was created by minted. I deleted every reference to minted and it worked, but now I realize that without minted the use of bussproofs.sty cannot work for html conversion. :S I guess that I have to put in my .bashrc a command to say that I always want to use latex with -shell-escape option , but I am not sure that it is the best solution. Every help is welcome. Best regards, Jo.
Re: [O] Mathjax vs. problems with imagemagick
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: Le ven. 11 juil. 2014 à 02:59:23 , Nick Dokos ndo...@gmail.com a envoyé ce message: Can you please post an example org file and the tex file that's produced that gives you such bad images? Dear Nick, I sent an email three days ago to tell you that I've got the solution. I said: Yes, I remember this, but what with the mail delays and time reordering of the replies, I got confused. mm-insert-file-contents: Opening input file: aucun fichier ou dossier de ce type, /tmp/ltxpng/latex15065_PG_37f10648c57a40194a74eaabbaa5c1678a5d2046.png Mark set Nevertheless, the png file is in /tmp/ltxpng and it is a nice png image. And you are sure that it is named latex15065_PG_37f10648c57a40194a74eaabbaa5c1678a5d2046.png ? The existing file might be a remnant from a previous run with a slightly different name (uuid readability is not the best :-) ) I remind that the error in creating the dvi file was created by minted. I deleted every reference to minted and it worked, but now I realize that without minted the use of bussproofs.sty cannot work for html conversion. :S I guess that I have to put in my .bashrc a command to say that I always want to use latex with -shell-escape option , but I am not sure that it is the best solution. -shell-escape is a security risk, allowing arbitrary programs to execute, but if you are careful about what you allow and don't get careless, I think it's reasonable to set it once and for all. I do that because I use minted all the time (it's also needed by some svg package that I occasionally use). But I do try to be careful about what new latex packages I install. Nick
Re: [O] Mathjax vs. problems with imagemagick
2014-07-11 17:59 GMT+02:00 Nick Dokos ndo...@gmail.com: And you are sure that it is named latex15065_PG_37f10648c57a40194a74eaabbaa5c1678a5d2046.png ? The existing file might be a remnant from a previous run with a slightly different name (uuid readability is not the best :-) ) :) I am pretty sure, yes ! :) I remind that the error in creating the dvi file was created by minted. I deleted every reference to minted and it worked, but now I realize that without minted the use of bussproofs.sty cannot work for html conversion. :S I guess that I have to put in my .bashrc a command to say that I always want to use latex with -shell-escape option , but I am not sure that it is the best solution. -shell-escape is a security risk, allowing arbitrary programs to execute, but if you are careful about what you allow and don't get careless, I think it's reasonable to set it once and for all. I do that because I use minted all the time (it's also needed by some svg package that I occasionally use). But I do try to be careful about what new latex packages I install. I have just to find how to write this setup in my .bashrc file. If you know the command line for a Linux user, do not hesitate to tell me. It will be more quick for me ! Best wishes and thanks again ! Jo.
Re: [O] Mathjax vs. problems with imagemagick
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: I guess that I have to put in my .bashrc a command to say that I always want to use latex with -shell-escape option , but I am not sure that it is the best solution. -shell-escape is a security risk, allowing arbitrary programs to execute, but if you are careful about what you allow and don't get careless, I think it's reasonable to set it once and for all. I do that because I use minted all the time (it's also needed by some svg package that I occasionally use). But I do try to be careful about what new latex packages I install. I have just to find how to write this setup in my .bashrc file. If you know the command line for a Linux user, do not hesitate to tell me. It will be more quick for me ! Sorry, I misspoke: I only set it in org. Most of my latex usage is org-latex-pdf nowadays, so I don't bother to do it from the shell. On the rare occasions when I do it from the command line, I type the option explicitly if needed. My org-latex-pdf-process setting is (setq org-latex-pdf-process '(texi2dvi --shell-escape --pdf %f)) and I'm experimenting with (setq org-latex-pdf-process '(latexmk --shell-escape -pdf -xelatex %f)) HTH, Nick
Re: [O] Mathjax vs. problems with imagemagick
2014-07-11 20:05 GMT+02:00 Nick Dokos ndo...@gmail.com: My org-latex-pdf-process setting is (setq org-latex-pdf-process '(texi2dvi --shell-escape --pdf %f)) and I'm experimenting with (setq org-latex-pdf-process '(latexmk --shell-escape -pdf -xelatex %f)) I am going to test this code, and I will be back to tell you how it works for me. Many many thanks. Best wishes Jo.
Re: [O] Mathjax vs. problems with imagemagick
#+OPTIONS: latex:t #+LATEX_HEADER: \usepackage{bussproofs} Hello Nick, hello everybody Before using your suggestion of debugging, I have made another test to convert formulas made with different latex packages into png images for a html file. At the beginning of my org file: #+LATEX_HEADER: \usepackage{fitch} #+LATEX_HEADER: \usepackage{bussproofs} #+OPTIONS: tex:imagemagick All formulas used with the equation environment have a nice png image, and the Fitch proofs also. But that is not the case with proofs in Gentzen tree style created via bussproofs.sty : the png images are corrupted. That's strange because it works well with LaTeX export and even with latex-preview-image and org-htmlize.This image of implication elimination rule in my gnus-message should be nice: \begin{prooftree} \AxiomC{$A \to B$} \AxiomC{$A$} \RightLabel{\scriptsize{$\to E$}} \BinaryInfC{$B$} \end{prooftree} I am afraid to be not competent enough to use correctly the debugger that you suggest, but it is probably again a problem my setup or something missing in my headers and not a bug somewhere. Best wishes, Jo. Le dim. 06 juil. 2014 à 11:25:30 , Nick Dokos ndo...@gmail.com a envoyé ce message: The process by which images are produced (for imagemagick: dvipng follows a slightly different path) is to wrap the latex fragment into a complete latex file, run pdflatex (or whatever your org-latex-pdf-process says) to produce a pdf file and then run the imagemagick `convert' program to produce the png. I'd suggest that you duplicate this process by hand and see where it goes wrong. I usually do that by adding a (debug) call into org-create-formula-image-with-imagemagick like this: (let ((latex-header (org-create-formula--latex-header))) (with-temp-file texfile (insert latex-header) (insert \n\\begin{document}\n \\definecolor{fg}{rgb}{ fg }\n \\definecolor{bg}{rgb}{ bg }\n \n\\pagecolor{bg}\n \n{\\color{fg}\n string \n}\n \n\\end{document}\n))) (org-latex-compile texfile t) (debug) ADDED THIS (if (not (file-exists-p pdffile)) (progn (message Failed to create pdf file from %s texfile) nil) (ignore-errors (if (featurep 'xemacs) (call-process convert nil nil nil -density 96 -trim -antialias pdffile -quality 100 ;; -sharpen 0x1.0 pngfile) (call-process convert nil nil nil -density dpi -trim -antialias pdffile -quality 100 ;; -sharpen 0x1.0 pngfile))) I then reload the file (M-x load-file RET /path/to/org.el RET) to pick up the modified function and proceed normally to export the file. When the (debug) is executed, I get a debug buffer and I can examine things like `texfile' and `dpi', using the debugger's `e' command. I then copy the latex file named by `texfile' to some private directory and run pdflatex on it and then (using the dpi value the debugger showed me - in my case, it was 120.0), I convert to png using the same command as the function does: cp /tmp/orgtex3771B9p.tex foo.tex pdflatex foo.tex convert -density 120.0 -trim -antialias foo.pdf -quality 100 foo.png The whole thing is a bit fiddly but not really difficult: it takes more time to explain than to do. BTW, if you go this way, don't forget to delete the (debug) afterwards. HTH.
Re: [O] Mathjax vs. problems with imagemagick
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: Hello Nick, hello everybody Before using your suggestion of debugging, I have made another test to convert formulas made with different latex packages into png images for a html file. At the beginning of my org file: All formulas used with the equation environment have a nice png image, and the Fitch proofs also. But that is not the case with proofs in Gentzen tree style created via bussproofs.sty : the png images are corrupted. That's strange because it works well with LaTeX export and even with latex-preview-image and org-htmlize. This image of implication elimination rule in my gnus-message should be nice: It was far from nice in my case: almost completely unreadable. Can you please post an example org file and the tex file that's produced that gives you such bad images? I am afraid to be not competent enough to use correctly the debugger that you suggest, but it is probably again a problem my setup or something missing in my headers and not a bug somewhere. That was just to get the details of what org does with it, just in case the parameters had something to do with it. But it seems that the problem is with bussproofs.sty (maybe?) Nick
Re: [O] Mathjax vs. problems with imagemagick
Hello Nick, hello everybody, I have finally got the solution. I have put again in my init.el the code from the page http://orgmode.org/worg/org-tutorials/org-latex-preview.html , i.e. (setq org-latex-listings 'minted) (require 'ox-latex) (add-to-list 'org-latex-packages-alist '( minted)) and I have added this one foiunded on the web (I do not remind where exactly): ;; Let the exporter use the -shell-escape option to let latex ;; execute external programs. ;; This obviously and can be dangerous to activate! (setq org-latex-pdf-process '(xelatex -shell-escape -interaction nonstopmode -output-directory %o %f)) Now it works. But I do not know really why. Best wishes, Jo. 2014-07-08 15:04 GMT+02:00 Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com: 2014-07-08 15:01 GMT+02:00 Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com: That's strange because it works well with LaTeX export and even with latex-preview-image and org-htmlize. This image of implication elimination rule in my gnus-message should be nice: [image: \begin{prooftree} \AxiomC{$A \to B$} \AxiomC{$A$} \RightLabel{\scriptsize{$\to E$}} \BinaryInfC{$B$} \end{prooftree}] No. I see now the image in my browser, it is not nice at all... I do not understand why. :( Jo.
Re: [O] Mathjax vs. problems with imagemagick
2014-07-08 15:01 GMT+02:00 Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com: That's strange because it works well with LaTeX export and even with latex-preview-image and org-htmlize. This image of implication elimination rule in my gnus-message should be nice: [image: \begin{prooftree} \AxiomC{$A \to B$} \AxiomC{$A$} \RightLabel{\scriptsize{$\to E$}} \BinaryInfC{$B$} \end{prooftree}] No. I see now the image in my browser, it is not nice at all... I do not understand why. :( Jo.
[O] Mathjax vs. problems with imagemagick
Hello everybody, To convert equations from *.org into *.html, Mathjax is certainly the best solution but unfortunately, this solution does not work as soons as one need to use some texlive package convenient to produce easily proofs in specific format (for example if one uses bussproofs.sty of fitch.sty ). That is why imagemagick is useful. Unfortunately, the produced png images in my ltxpng/ have a very bad quality and if the browser load them, the result is terrible. I met already this problem and I do not remind what was the solution... I you have suggestions... Best wishes, Jo. PS: in attachment, an example of this terrible png images.
Re: [O] Mathjax vs. problems with imagemagick
* PNG is lossless format--if you can, make it the first file you create rather than last. ** If you create a JPG a lossy format then you could lose some of the beauty (like your example). * ImageMagick has many switches you can throw--suggest you look deeper into it in the freely available manual--though its very thick. * Often there are blah2blah programs (and many methods in ImageMagick for example) available which may help that you may be able to string together. General example: dvips -o blah.dvi ps2pdf blah.ps pdf2png blah.pdf ** Maybe you can convert your file to an intermediary format and then convert it to .png *** But again, if possible, create a PNG (.png) type file firstly since it is a lossless file type. On Sun, Jul 6, 2014 at 4:03 AM, Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com wrote: Hello everybody, To convert equations from *.org into *.html, Mathjax is certainly the best solution but unfortunately, this solution does not work as soons as one need to use some texlive package convenient to produce easily proofs in specific format (for example if one uses bussproofs.sty of fitch.sty ). That is why imagemagick is useful. Unfortunately, the produced png images in my ltxpng/ have a very bad quality and if the browser load them, the result is terrible. I met already this problem and I do not remind what was the solution... I you have suggestions... Best wishes, Jo. PS: in attachment, an example of this terrible png images.
Re: [O] Mathjax vs. problems with imagemagick
Thanks for your reply. Do you mean that #+OPTIONS: tex:imagemagick must be mentioned first? In my opinion something is wrong in my setup and it is difficult for me to see what's wrong. Even a minima-init.el file is not helpful... Best wishes, Jo. 2014-07-06 10:39 GMT+02:00 briangpowell . briangpowel...@gmail.com: * PNG is lossless format--if you can, make it the first file you create rather than last. ** If you create a JPG a lossy format then you could lose some of the beauty (like your example). * ImageMagick has many switches you can throw--suggest you look deeper into it in the freely available manual--though its very thick. * Often there are blah2blah programs (and many methods in ImageMagick for example) available which may help that you may be able to string together. General example: dvips -o blah.dvi ps2pdf blah.ps pdf2png blah.pdf ** Maybe you can convert your file to an intermediary format and then convert it to .png *** But again, if possible, create a PNG (.png) type file firstly since it is a lossless file type. On Sun, Jul 6, 2014 at 4:03 AM, Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com wrote: Hello everybody, To convert equations from *.org into *.html, Mathjax is certainly the best solution but unfortunately, this solution does not work as soons as one need to use some texlive package convenient to produce easily proofs in specific format (for example if one uses bussproofs.sty of fitch.sty ). That is why imagemagick is useful. Unfortunately, the produced png images in my ltxpng/ have a very bad quality and if the browser load them, the result is terrible. I met already this problem and I do not remind what was the solution... I you have suggestions... Best wishes, Jo. PS: in attachment, an example of this terrible png images.
Re: [O] Mathjax vs. problems with imagemagick
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: To convert equations from *.org into *.html, Mathjax is certainly the best solution but unfortunately, this solution does not work as soons as one need to use some texlive package convenient to produce easily proofs in specific format (for example if one uses bussproofs.sty of fitch.sty ). That is why imagemagick is useful. Unfortunately, the produced png images in my ltxpng/ have a very bad quality and if the browser load them, the result is terrible. I met already this problem and I do not remind what was the solution... I you have suggestions... The process by which images are produced (for imagemagick: dvipng follows a slightly different path) is to wrap the latex fragment into a complete latex file, run pdflatex (or whatever your org-latex-pdf-process says) to produce a pdf file and then run the imagemagick `convert' program to produce the png. I'd suggest that you duplicate this process by hand and see where it goes wrong. I usually do that by adding a (debug) call into org-create-formula-image-with-imagemagick like this: --8---cut here---start-8--- (let ((latex-header (org-create-formula--latex-header))) (with-temp-file texfile (insert latex-header) (insert \n\\begin{document}\n \\definecolor{fg}{rgb}{ fg }\n \\definecolor{bg}{rgb}{ bg }\n \n\\pagecolor{bg}\n \n{\\color{fg}\n string \n}\n \n\\end{document}\n))) (org-latex-compile texfile t) (debug) ADDED THIS (if (not (file-exists-p pdffile)) (progn (message Failed to create pdf file from %s texfile) nil) (ignore-errors (if (featurep 'xemacs) (call-process convert nil nil nil -density 96 -trim -antialias pdffile -quality 100 ;; -sharpen 0x1.0 pngfile) (call-process convert nil nil nil -density dpi -trim -antialias pdffile -quality 100 ;; -sharpen 0x1.0 pngfile))) --8---cut here---end---8--- I then reload the file (M-x load-file RET /path/to/org.el RET) to pick up the modified function and proceed normally to export the file. When the (debug) is executed, I get a debug buffer and I can examine things like `texfile' and `dpi', using the debugger's `e' command. I then copy the latex file named by `texfile' to some private directory and run pdflatex on it and then (using the dpi value the debugger showed me - in my case, it was 120.0), I convert to png using the same command as the function does: cp /tmp/orgtex3771B9p.tex foo.tex pdflatex foo.tex convert -density 120.0 -trim -antialias foo.pdf -quality 100 foo.png The whole thing is a bit fiddly but not really difficult: it takes more time to explain than to do. BTW, if you go this way, don't forget to delete the (debug) afterwards. HTH. -- Nick