Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure referencing broken by pandoc 1.17 TeX writer #2813

Closed
tomduck opened this issue Mar 24, 2016 · 1 comment
Closed

Figure referencing broken by pandoc 1.17 TeX writer #2813

tomduck opened this issue Mar 24, 2016 · 1 comment

Comments

@tomduck
Copy link

tomduck commented Mar 24, 2016

Pandoc 1.17's TeX writer uses image attributes to introduce figure labels. Unfortunately, the TeX being written is fundamentally incorrect, and this breaks referencing -- the reason why labels exist.

Here is a basic demo file (reftest.md):

![A big dot.](dot.png){#fig-1}

This is a reference to Figure \ref{fig-1}.

Compile it as follows (you will need to provide your own dot.png):

$ pandoc reftest.md -o reftest.pdf

View reftest.pdf and notice that the Figure number is missing in the reference. A look at the generated TeX ($ pandoc reftest.md -o reftest.tex) shows why:

\begin{figure}[htbp]
\centering
\includegraphics{dot.png}
\caption{A big dot.}
\end{figure}
\label{fig-1}

This is a reference to Figure \ref{fig-1}.

The \label should be inside the figure environment, and preferably in the \caption. It does not work at all when written outside of thefigure environment.

I believe this was the patch that introduced the bug.

jgm added a commit that referenced this issue Mar 24, 2016
Partially addresses #2813.

This isn't perfect, because now the hypertarget is in the
wrong place -- when you link to the figure, the screen
is positioned with the caption at the top, and most of
the figure off screen.

So this needs a bit more tweaking.
@jgm jgm closed this as completed in f47b369 Mar 24, 2016
@tomduck
Copy link
Author

tomduck commented Mar 25, 2016

Thank you, @jgm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant