Use pandoc's markdown image link text as short caption in LaTeX
Use pandoc's markdown image link text as short caption in LaTeX
{#fig:ref}
should produce in LaTeX:
\begin{figure}[htbp]
\centering
\includegraphics{figure.jpg}
\caption[short caption]{Long caption}
\label{fig:ref}
\end{figure}
In addition, this adds the link text to html, html5, and markdown formats.
Notes
- I'm not sure why the math is coming out different in my versions of spec.html and spec.html5. That would seem to be unaffected by my changes here.
- I'm not sure how to pretty print json the same way as the original, so my spec.json has too many changes (including changes to the Unicode text that happened when I prettified it). That should be fixed.
- More important: I don't see the link text showing up in the json output when run through this filter. I'm not sure how to change that.
- Also important: if there are no figure attributes, the link text doesn't show up in the output. I'm happy with that, but it is a limitation worth noting.
R.e. math: The test references are produced by pandoc spec.md --to format --mathjax. Maybe you're missing the mathjax?
I've not come across short caption before. Does it get used in figure lists?
Re math: You're right. I was not using the '--mathjax' flag. Corrected now.
Re json: Thanks. I used jq's online tool to correct the output.
Re short caption: Yes, the short caption shows up in a list of figures. This is analogous to optional chapter/section titles: \section[short title]{long title} means that "short title" shows up in the table of contents (and running heads), but "long title" shows up in the main text.