Skip to content

org-mode beamer/latex export requires "#+NAME:" attribute for proper captions/centering #2643

Closed
pmagwene opened this Issue · 3 comments

2 participants

@pmagwene

Pandoc version: 1.15.2
If the #+NAME attribute isn't specified for a figure, the corresponding figure does not get properly centered in LaTeX/beamer output.

Here's a MWE:

#+CAPTION: Your caption here
#+NAME: 
[[img.png]]

Generates this:

\begin{frame}
\begin{figure}[htbp]
\centering
\includegraphics{img.png}
\caption{Your caption here}
\end{figure}

but

#+CAPTION: Your caption here
[[img.png]]

generates

\begin{frame}
\includegraphics{img.png}
\end{frame}
@tarleb

I'd classify this as a bug in the Org reader: Pandoc doesn't have a figure type, so it marks images as a figures using special attributes. Even if NAME is missing, the reader correctly recognizes that this should be a figure, but fails to set the necessary attributes to signal this fact to the writer.

If somebody wants to make a pull request for this within the next 9 hours: this should be fixable with a simple change in line 631. Otherwise I'll fix it later or tomorrow.

@tarleb tarleb added a commit to tarleb/pandoc that referenced this issue
@tarleb tarleb Prefix even empty figure names with "fig:"
The convention used by pandoc for figures is to mark them by prefixing
the name with "fig:".  The org reader failed to do this if a figure had
no name.  The test for this was broken as well.

This fixes #2643.
fabbd1a
@tarleb

Thank you for reporting this bug, @pmagwene

@pmagwene

@tarleb -- Thanks for the quick fix!

@pmagwene pmagwene closed this
@pmagwene pmagwene reopened this
@jgm jgm closed this in #2646
@c-forster c-forster pushed a commit to c-forster/pandoc that referenced this issue
@tarleb tarleb Prefix even empty figure names with "fig:"
The convention used by pandoc for figures is to mark them by prefixing
the name with "fig:".  The org reader failed to do this if a figure had
no name.  The test for this was broken as well.

This fixes #2643.
41a3137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.