6

When org-mode exports figures to LaTeX, the figure shows up left justified. Is there an easy way to have all the figures centered?

I want to avoid having to type #+ATTR_LATEX: :float t above each figure.

I would simply like each \includegraphics in the exported LaTeX code to be wrapped in a \begin{center} ... \end{center} block.

1 Answer 1

12

You can add advice to org-latex--inline-image:

(advice-add 'org-latex--inline-image :around
            (lambda (orig link info)
              (concat
               "\\begin{center}"
               (funcall orig link info)
               "\\end{center}")))

Note that this puts every inline image in \begin{center} ... \end{center}, even ones that are centered already by setting :float.

1
  • This is not workin in Emacs 23. Any workaround?
    – falematte
    Jul 13, 2016 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.