emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: puzzled about :fit for LaTeX src block
Date: Thu, 13 Jan 2022 15:41:01 +0000	[thread overview]
Message-ID: <87o84fd4oi.fsf@posteo.net> (raw)
In-Reply-To: <877db3kfie.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Thu, 13 Jan 2022 12:05:13 +0000")

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 


  reply	other threads:[~2022-01-13 15:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 13:08 puzzled about :fit for LaTeX src block Eric S Fraga
2022-01-12 17:22 ` Juan Manuel Macías
2022-01-13 10:14   ` Eric S Fraga
2022-01-13 11:17     ` Juan Manuel Macías
2022-01-13 12:05       ` Eric S Fraga
2022-01-13 15:41         ` Juan Manuel Macías [this message]
2022-01-13 16:14           ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o84fd4oi.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).