Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to specify caption position in LaTeX output #5116

Closed
stfl opened this issue Dec 1, 2018 · 11 comments · Fixed by #10161
Closed

Provide a way to specify caption position in LaTeX output #5116

stfl opened this issue Dec 1, 2018 · 11 comments · Fixed by #10161

Comments

@stfl
Copy link

stfl commented Dec 1, 2018

version 2.2.1 or 2.1.3 (< this one gets installed when installing pandoc-citeproc from cabal)

I am converting markdown > latex > pdf (pdflatex)
The caption for tables always end up above the table regardless if I put the Table: label above or below the markdown table.

the latex looks like this:

\begin{longtable}[]{@{}rl@{}}
\caption{label}\tabularnewline
\toprule
...

It also does not change when adding

\usepackage[tableposition=bottom]{caption}

to the template.

It would be very nice to have this as an option or if the markdown location reflects the location at the output.

@jgm
Copy link
Owner

jgm commented Dec 1, 2018

Although the markdown syntax allows you to put the table above or below, this location isn't represented in the Pandoc AST, and it will be ignored by all output formats. There isn't currently any good way to change this. I believe the caption package won't affect it because longtable isn't a genuine float environment.

@stfl
Copy link
Author

stfl commented Dec 1, 2018

Thank you for the clarification. I hope there will be an option at some point.

@stfl stfl closed this as completed Dec 1, 2018
@jgm
Copy link
Owner

jgm commented Dec 1, 2018 via email

@stfl
Copy link
Author

stfl commented Dec 1, 2018

Yes. That's a good point. I am reopening this one then, or should I open a new one?

@stfl stfl reopened this Dec 1, 2018
@jgm jgm changed the title latex/pdf table caption always above Provide a way to specify caption position in LaTeX output Dec 1, 2018
@stfl
Copy link
Author

stfl commented Dec 1, 2018

Thank you for updating the title. Not possible from Android.

@michael-hillmann
Copy link

Is there any known workaround to place a table caption below the table?

@michael-hillmann
Copy link

We should correct the official manual, which is currently:

Extension: table_captions
A caption may optionally be provided with all 4 kinds of tables (as illustrated in the examples below). A caption is a paragraph beginning with the string Table: (or just :), which will be stripped off. It may appear either before or after the table.

Proposal: removing the marked sentence.

@jgm
Copy link
Owner

jgm commented May 6, 2020

The sentence is okay. The caption may indeed appear either before or after in the source. It's just that this doesn't affect its position in the output.

@jgm
Copy link
Owner

jgm commented May 6, 2020

My view is that the caption position should be determined globally; so it doesn't make sense to store it in the AST. Perhaps we could make some writers sensitive to a caption-position metadata option (or variable) that would influence this. Maybe something like:

table-captions: above
figure-captions: below

@jpcirrus
Copy link
Contributor

This has become more of an issue as the APA Style Guide 7th edition, now requires figure captions to be above the figure, at it does for tables.

@jgm jgm added this to the next release milestone Jun 26, 2020
@jgm
Copy link
Owner

jgm commented Jun 26, 2020

I've added this to a "don't forget this" milestone -- not actually going to be in the next release, though.

jgm added a commit that referenced this issue Sep 8, 2024
jgm added a commit that referenced this issue Sep 8, 2024
+ 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.
jgm added a commit that referenced this issue Sep 8, 2024
+ 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.
@jgm jgm closed this as completed in #10161 Sep 8, 2024
@jgm jgm closed this as completed in a27dad6 Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants