2

As of now, org-mode always adds a \centering into the Latex export for figures. This makes my figures appear centered. But I want them to be alligned to the left. For tables, some suggested using :center nil. But there is no such thing for figures. Someone else suggested modifying an elisp variable but I looked and there is no such variable. If I add :float nil then \centering is removed but this ignores captions as well. So how can I make Latex export not add \centering before \includegraphics by default? I want to retain captions.

If I manually edit resulting tex file and remove \centering, I get my images as intended. But this time caption stays centered, only the image moves.

4

In org-mode 8.3 or later, this is controlled by the variable org-latex-images-centered:

When non-nil, images are centered.

The default is t; you want to set it to nil. This can be done either by setting it globally in your Emacs config: (setq org-latex-images-centered nil) or by using a BIND option in each org file where you want this setting:

#+BIND: org-latex-images-centered nil

In the latter case you have to set org-export-allow-bind-keywords to t in your Emacs config to allow the BIND keyword to do anything.

To set this per figure (or table) you can set latex attributes. Adding

#+ATTR_LATEX: :center nil

will suppress the centering for that float only.

For tables there is a corresponding variable org-latex-tables-centered that behaves the same way.

Personally I recommend the BIND version as it makes the document more portable and reproducible, especially if you have co-authors.

  • 1
    I set it to nil but the outcome didn't change. Produced tex file still has \centering embedded. – meguli Dec 30 '16 at 23:49
  • It works for me in Emacs 26.0.50.2, Org mode 9.0.3. Do you have different version? I'm editing in another method you can try. – erikstokes Dec 31 '16 at 0:19
  • I am still using emacs25 and my org-mode is 8.2. I will consider upgrading. – meguli Dec 31 '16 at 0:23
  • 25 is the current stable version; it's best to stick with that unless you like betas. Probably updating org-mode is enough. – erikstokes Dec 31 '16 at 0:28
  • @meguli A little searching seems to show this variable first appeared in org 8.3. – erikstokes Dec 31 '16 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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