emacs-orgmode
[Top][All Lists]

[O] Centering side-by-side images in latex/pdf export

 From: knubee Subject: [O] Centering side-by-side images in latex/pdf export Date: Thu, 12 Jan 2017 18:24:25 +0800

I recently opened some .org files from a year ago and tried to generate new PDFs from them. There have been significant updates to emacs, org-mode, and the relevant LaTeX packages I use, so some parts of the source had to be changed. Mostly, everything is working now except for generating PDFs with centered, side by side images.

Here is what used to work:

#+BEGIN_center
#+ATTR_LaTeX: :height 0.2\textwidth
[[image1.png]]
#+ATTR_LaTeX: :height 0.2\textwidth
[[image2.png]]
#+END_center

I am currently using emacs 26.0.50, orgmode 9.0.3, with TeX Live 2016 on Debian and the example above results in images that are stacked on top of each other. When I examine the TeX source, this is the result:

\begin{center}
\begin{center}
\includegraphics[height=0.2\textwidth]{image1.png}
\end{center}
\begin{center}
\includegraphics[height=0.2\textwidth]{image2.png}
\end{center}
\end{center}

I assume this is related to recent change in org-mode where images are centered by default. However, the following change to the org source does not solve the problem.

#+ATTR_LaTeX: :height 0.2\textwidth
[[image1.png]]
#+ATTR_LaTeX: :height 0.2\textwidth
[[image2.png]]

The images are still stacked on top of each other (although the outer "\center" calls are no longer present in resulting tex source):

\begin{center}
\includegraphics[height=0.2\textwidth]{image1.png}
\end{center}
\begin{center}
\includegraphics[height=0.2\textwidth]{image2.png}
\end{center}

I am able to get the images side by side if I disable org-mode's automatic centering:

#+ATTR_LaTeX: :height 0.2\textwidth :center
[[image1.png]]
#+ATTR_LaTeX: :height 0.2\textwidth :center
[[image2.png]]

But how can I get side by side images centered? Perhaps the answer is very  simple and obvious, but I have tried many other changes and been unable to accomplish this.