Re: puzzled about :fit for LaTeX src block
On Thursday, 13 Jan 2022 at 15:41, Juan Manuel Macías wrote: > Well, it seems that if you use ":imagemagick yes", the image is created > with the `org-babel-latex-convert-pdf' function. Indeed. I went to the code. Thank you. Everything is working like I want it! -- : Eric S Fraga, with org release_9.5.2-298-g1f48d2 in Emacs 29.0.50
Re: puzzled about :fit for LaTeX src block
Eric S Fraga writes: > This did it! Thank you. I am curious now to find out what tool was > used instead... something for later today! Well, it seems that if you use ":imagemagick yes", the image is created with the `org-babel-latex-convert-pdf' function. I almost always use this to create images from latex blocks, for example: #+begin_src latex: imagemagick yes :iminoptions -density 600 \bfseries Hello world! #+end_src ":fit" crop the image, but you can also put in your "org-format-latex-header" "\\documentclass[varwidth]{standalone}" On the contrary, without :imagemagick, but with results to *.png file, `org-create-formula-image' is used, which depends on "org-preview-latex-process-alist" and "org-preview-latex-default-process". Since I only use LuaTeX for everything, I have this in my init, in order to preview LaTeX fragments: (setq luamagick '(luamagick :programs ("lualatex" "convert") :description "pdf > png" :message "you need to install lualatex and imagemagick." :use-xcolor t :image-input-type "pdf" :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f") :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O"))) (add-to-list 'org-preview-latex-process-alist luamagick) (setq org-preview-latex-default-process 'luamagick) Note that the -trim option for the "convert" program (last line) allows you to crop the image from the pdf page. Best regards, Juan Manuel
Re: puzzled about :fit for LaTeX src block
On Thursday, 13 Jan 2022 at 11:17, Juan Manuel Macías wrote: > Another possibility: please try adding the header arg. :imagemagick yes This did it! Thank you. I am curious now to find out what tool was used instead... something for later today! Thanks again, eric -- Professor Eric S Fraga, UCL; GnuPG: 0xc89193d8fffcf67d
Re: puzzled about :fit for LaTeX src block
Hi Eric, Eric S Fraga writes: > Both the same and the default value from org. I'm not sure, but maybe the problem comes from the \documentclass{article} in org-format-latex-header. Can you try replacing that with "\\documentclass[varwidth]{standalone}"? Another possibility: please try adding the header arg. :imagemagick yes Best regards, Juan Manuel
Re: puzzled about :fit for LaTeX src block
Hi Juan, On Wednesday, 12 Jan 2022 at 17:22, Juan Manuel Macías wrote: > Testing two possibilities: > > What (latex) code produces that image in the output *tex file of your book? They both use the same LaTeX src block (as was in the attachment) which creates an org link to the generated PDF or PNG file. It's the generation of the image file that is the problem, not how the file is used in the end unfortunately. > C-h v RET org-format-latex-header RET: what value? Both the same and the default value from org. thank you, eric -- : Eric S Fraga, with org release_9.5.2-298-g1f48d2 in Emacs 29.0.50
Re: puzzled about :fit for LaTeX src block
Hi Eric, Eric S Fraga writes: > I have a LaTeX src block which creates an image using tikz. In a book > I'm writing, the image, when created as a png, does not get shrunk but > is instead a full page (with the actual diagram in the top left corner). > If I create a PDF, instead, it works fine. Testing two possibilities: What (latex) code produces that image in the output *tex file of your book? and C-h v RET org-format-latex-header RET: what value? Best regards, Juan Manuel
puzzled about :fit for LaTeX src block
I hope somebody here on this list can help me solve a puzzling situation. I have a LaTeX src block which creates an image using tikz. In a book I'm writing, the image, when created as a png, does not get shrunk but is instead a full page (with the actual diagram in the top left corner). If I create a PDF, instead, it works fine. I have extracted this src block into a minimal file (attached). For that file, the image creation works fine whether I create a png or a PDF. I have gone through the settings in the book file but cannot find anything that would affect this behaviour. I am hoping somebody can suggest what it might be that makes the png image not be shrunk! Both emacs and org from git as of this morning. Thank you, eric -- : Eric S Fraga, with org release_9.5.2-298-g1f48d2 in Emacs 29.0.50 t.org Description: Lotus Organizer