summaryrefslogtreecommitdiff
path: root/paper/lua-filters/short-captions/expected-2.tex
blob: 95444b3141376732e7061ab3a24cbc9605feb11e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\hypertarget{short-captions-in-output}{%
\section{\texorpdfstring{Short captions in
\LaTeX~output}{Short captions in ~output}}\label{short-captions-in-output}}

For latex output, this filter uses the attribute \texttt{short-caption}
for figures so that the attribute value appears in the List of Figures,
if one is desired.

\hypertarget{usage}{%
\section{Usage}\label{usage}}

Where you would have a figure in, say, markdown as

\begin{verbatim}
![The caption](foo.png ) 
\end{verbatim}

You can now specify the figure as

\begin{verbatim}
![The long caption](foo.png){short-caption="a short caption"} 
\end{verbatim}

If the document metadata includes \texttt{lof:true}, then the List of
Figures will use the short caption. This is particularly useful for
students writing dissertations, who often have to include a List of
Figures in the front matter, but where figure captions themselves can be
quite lengthy.

\begin{verbatim}
pandoc --lua-filter=short-captions.lua article.md -o article.tex

pandoc --lua-filter=short-captions.lua article.md -o article.pdf
\end{verbatim}

\hypertarget{example}{%
\section{Example}\label{example}}

Fig.~\ref{fig:shortcap} is an interesting figure with a long caption,
but a short caption in the List of Figures.

\hypertarget{fig:shortcap}{%
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth,height=\textheight]{fig.pdf}
\caption[{A short caption with math \(x^n + y^n = z^n\)}]{This is an
\emph{extremely} interesting figure that has a lot of detail I will need
to describe in a few sentences. This figure has a short caption that
will appear in the list of figures. Other attributes are preserved}
\label{fig:shortcap}
\end{figure}
}

\hypertarget{limitations}{%
\section{Limitations}\label{limitations}}

\begin{itemize}
\tightlist
\item
  The filter will process the \texttt{short-caption} attribute value as
  pandoc markdown, regardless of the input format.
\item
  It does not work for tables and listings yet.
\item
  But it works with pandoc-crossref, regardless of the order of
  application.
\end{itemize}