Files
pandoc/test/command/5116.md
T
John MacFarlane a27dad6f68 Add options to change table/figure caption positions.
+ 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.
2024-09-08 08:29:09 -07:00

108 lines
2.4 KiB
Markdown

```
% pandoc -t latex
![This is a figure.](img.jpg)
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
![This is a figure.](img.jpg)
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
![This is a figure.](img.jpg)
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}
```