mirror of
https://github.com/jgm/pandoc.git
synced 2026-07-13 04:47:10 +00:00
a27dad6f68
+ Add command line options `--table-caption-position` and `--figure-caption-position`. These allow the user to specify whether to put captions above or below tables and figures, respectively. The following output formats are supported: HTML (and related such as EPUB), LaTeX (and Beamer), Docx, ODT/OpenDocument, Typst. + Text.Pandoc.Options: add `CaptionPosition` and new `WriterOptions` fields `writerFigureCaptionPosition` and `writerTableCaptionPosition` [API change]. + Text.Pandoc.Opt: add `Opt` fields `optFigureCaptionPosition` and `optTableCaptionPosition` [API change]. + Docx writer: make table/figure rendering sensitive to caption position settings. + OpenDocument writer: make table/figure rendering sensitive to caption position settings. + Typst writer/template: implement figure caption positions by triggering a show rule in the default template, which determines caption positions for figures and tables globally. + LaTeX writer: make table/figure rendering sensitive to caption position settings. Closes #5116. + HTML writer/template: make `<figcaption>` placement sensitive to caption position settings. For tables, `<caption>` must be the first element, and positioning is determined by CSS, for here we set a variable which the default template is sensitive to.
2.4 KiB
2.4 KiB
% pandoc -t latex

Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
: Demonstration of simple table syntax.
^D
\begin{figure}
\centering
\pandocbounded{\includegraphics[keepaspectratio]{img.jpg}}
\caption{This is a figure.}
\end{figure}
\begin{longtable}[]{@{}rlcl@{}}
\caption{Demonstration of simple table syntax.}\tabularnewline
\toprule\noalign{}
Right & Left & Center & Default \\
\midrule\noalign{}
\endfirsthead
\toprule\noalign{}
Right & Left & Center & Default \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
12 & 12 & 12 & 12 \\
123 & 123 & 123 & 123 \\
1 & 1 & 1 & 1 \\
\end{longtable}
% pandoc -t latex --figure-caption-position=above --table-caption-position=above

Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
: Demonstration of simple table syntax.
^D
\begin{figure}
\centering
\caption{This is a figure.}
\pandocbounded{\includegraphics[keepaspectratio]{img.jpg}}
\end{figure}
\begin{longtable}[]{@{}rlcl@{}}
\caption{Demonstration of simple table syntax.}\tabularnewline
\toprule\noalign{}
Right & Left & Center & Default \\
\midrule\noalign{}
\endfirsthead
\toprule\noalign{}
Right & Left & Center & Default \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
12 & 12 & 12 & 12 \\
123 & 123 & 123 & 123 \\
1 & 1 & 1 & 1 \\
\end{longtable}
% pandoc -t latex --figure-caption-position=below --table-caption-position=below

Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
: Demonstration of simple table syntax.
^D
\begin{figure}
\centering
\pandocbounded{\includegraphics[keepaspectratio]{img.jpg}}
\caption{This is a figure.}
\end{figure}
\begin{longtable}[]{@{}rlcl@{}}
\toprule\noalign{}
Right & Left & Center & Default \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\tabularnewline
\caption{Demonstration of simple table syntax.}
\endlastfoot
12 & 12 & 12 & 12 \\
123 & 123 & 123 & 123 \\
1 & 1 & 1 & 1 \\
\end{longtable}