This is a demo file for pandoc-crossref. With this filter, you can
cross-reference figures (see
figs.~\ref{fig:figure1}, \ref{fig:figure2}, \ref{fig:figure3}), display
equations (see eq.~\ref{eq:eqn1}), tables (see tbl.~\ref{tbl:table1})
and sections
(secs.~\ref{sec:sec1}, \ref{sec:sec2}, \ref{sec:caption-attr}, \ref{sec:table-capts}, \ref{sec:wrapping-div})

For immediate example, see fig.~\ref{fig:figure0}

\begin{figure}
\hypertarget{fig:figure0}{%
\centering
\includegraphics{img1.jpg}
\caption{A figure}\label{fig:figure0}
}
\end{figure}

There is also support for code blocks, for example,
lsts.~\ref{lst:captionAttr}, \ref{lst:tableCaption}, \ref{lst:wrappingDiv}

It's possible to capitalize reference prefixes, like this:
Fig.~\ref{fig:figure1}.

In case of multiple references, capitalization is determined by first
reference. Figs.~\ref{fig:figure1}, \ref{fig:figure2} is capitalized,
while figs.~\ref{fig:figure2}, \ref{fig:figure1} is not.

It is also possible to mix different references, like
fig.~\ref{fig:figure1}, tbl.~\ref{tbl:table1},
lsts.~\ref{lst:captionAttr}, \ref{lst:tableCaption},
figs.~\ref{fig:figure2}, \ref{fig:figure3}, which will be grouped in
order they are specified. You can even intermix this with regular
citations, although it's not recommended: fig.~\ref{fig:figure1},
tbl.~\ref{tbl:table1}, {[}@unprocessedCitation{]}

You can also have custom chapter reference labels, like
sec.~\ref{sec:custlabs}

Subfigures are supported, see
figs.~\ref{fig:subfigures}, \ref{fig:subfigureB}

\hypertarget{sec:sec1}{%
\section{Chapter 1. Figures}\label{sec:sec1}}

\begin{figure}
\hypertarget{fig:figure1}{%
\centering
\includegraphics{img1.jpg}
\caption{First figure}\label{fig:figure1}
}
\end{figure}

\begin{figure}
\hypertarget{fig:figure2}{%
\centering
\includegraphics{img2.jpg}
\caption{Second figure}\label{fig:figure2}
}
\end{figure}

\begin{figure}
\hypertarget{fig:figure3}{%
\centering
\includegraphics{img3.jpg}
\caption{Third figure}\label{fig:figure3}
}
\end{figure}

\begin{figure}
\centering
\includegraphics{img1.jpg}
\caption{Unlabelled image}
\end{figure}

\begin{pandoccrossrefsubfigures}

\subfloat[Subfigure a]{\includegraphics{img1.jpg}}

\subfloat[Subfigure b]{\includegraphics{img1.jpg}\label{fig:subfigureB}}

\caption[{Subfigures caption}]{Subfigures caption}

\label{fig:subfigures}

\end{pandoccrossrefsubfigures}

\hypertarget{sec:sec2}{%
\section{Chapter 2. Equations}\label{sec:sec2}}

Display equations are labelled and numbered

\begin{equation}\protect\hypertarget{eq:eqn1}{}{ P_i(x) = \sum_i a_i x^i }\label{eq:eqn1}\end{equation}

Since 0.1.6.0 those can also appear in the middle of paragraph
\begin{equation}\protect\hypertarget{eq:quadr}{}{a x^2 + b x^2 + c = 0}\label{eq:quadr}\end{equation}
like this.

\hypertarget{sec:chapter-3.-tables}{%
\section{Chapter 3. Tables}\label{sec:chapter-3.-tables}}

\hypertarget{tbl:table1}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:table1}Table example}\tabularnewline
\toprule\noalign{}
First Header & Second Header \\
\midrule\noalign{}
\endfirsthead
\toprule\noalign{}
First Header & Second Header \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
Content Cell & Content Cell \\
Content Cell & Content Cell \\
\end{longtable}

Table without caption:

\begin{longtable}[]{@{}ll@{}}
\toprule\noalign{}
First Header & Second Header \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
Content Cell & Content Cell \\
Content Cell & Content Cell \\
\end{longtable}

\hypertarget{sec:chapter-4.-code-blocks}{%
\section{Chapter 4. Code blocks}\label{sec:chapter-4.-code-blocks}}

There are a couple options for code block labels. Those work only if
code block id starts with \texttt{lst:}, e.g.~\texttt{\{\#lst:label\}}

\hypertarget{sec:caption-attr}{%
\subsection{\texorpdfstring{\texttt{caption}
attribute}{caption attribute}}\label{sec:caption-attr}}

\texttt{caption} attribute will be treated as code block caption. If
code block has both id and \texttt{caption} attributes, it will be
treated as numbered code block.

\begin{codelisting}

\caption{Listing caption}

\hypertarget{lst:captionAttr}{%
\label{lst:captionAttr}}%
\begin{Shaded}
\begin{Highlighting}[]
\OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}
\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}
\end{Highlighting}
\end{Shaded}

\end{codelisting}

\pagebreak

\hypertarget{sec:table-capts}{%
\subsection{Table-style captions}\label{sec:table-capts}}

Enabled with \texttt{codeBlockCaptions} metadata option. If code block
is immediately adjacent to paragraph, starting with \texttt{Listing:} or
\texttt{:}, said paragraph will be treated as code block caption.

\begin{codelisting}

\caption{Listing caption}

\hypertarget{lst:tableCaption}{%
\label{lst:tableCaption}}%
\begin{Shaded}
\begin{Highlighting}[]
\OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}
\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}
\end{Highlighting}
\end{Shaded}

\end{codelisting}

\hypertarget{sec:wrapping-div}{%
\subsection{Wrapping div}\label{sec:wrapping-div}}

Wrapping code block without label in a div with id \texttt{lst:...} and
class, starting with \texttt{listing}, and adding paragraph before code
block, but inside div, will treat said paragraph as code block caption.

\begin{codelisting}

\caption{Listing caption}

\hypertarget{lst:wrappingDiv}{%
\label{lst:wrappingDiv}}%
\begin{Shaded}
\begin{Highlighting}[]
\OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}
\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}
\end{Highlighting}
\end{Shaded}

\end{codelisting}

\hypertarget{sec:unnumbered-chapter.}{%
\section*{Unnumbered chapter.}\label{sec:unnumbered-chapter.}}
\addcontentsline{toc}{section}{Unnumbered chapter.}

This chapter doesn't change chapter prefix of referenced elements,
instead keeping number of previous chapter, e.g.
\begin{equation}\protect\hypertarget{eq:eqn2}{}{ S(x) = \int_{x_1}^{x_2} a x+b \  \mathrm{d}x }\label{eq:eqn2}\end{equation}

\hypertarget{sec:chapter-5.-reference-lists}{%
\section{Chapter 5. Reference
lists}\label{sec:chapter-5.-reference-lists}}

It's also possible to show lists of figures and tables, like this:

\listoffigures

\listoftables

\listoflistings

\hypertarget{sec:appendix-a.-custom-labels}{%
\section{Appendix A. Custom
labels}\label{sec:appendix-a.-custom-labels}}

\hypertarget{sec:custlabs}{%
\subsection{This section will have custom label}\label{sec:custlabs}}
