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

tbl-cap-location has no effect on non-labelled captions #9734

Closed
jolars opened this issue May 21, 2024 · 4 comments · Fixed by #9735
Closed

tbl-cap-location has no effect on non-labelled captions #9734

jolars opened this issue May 21, 2024 · 4 comments · Fixed by #9735
Assignees
Labels
bug Something isn't working crossref regression Functionality that used to work but now is broken. tables Issues with Tables including the gt integration
Milestone

Comments

@jolars
Copy link

jolars commented May 21, 2024

Bug description

Perhaps this is intended behavior, but it seems to me that the tbl-cap-location option has no effect unless the table is labelled. I couldn't find any mention of this in the documentation.

Steps to reproduce

In the following example,

---
title: Table caption location
format: html
tbl-cap-location: top
---

| Col1 | Col2 | Col3 |
|------|------|------|
| A    | B    | C    |
| E    | F    | G    |

: A non-labelled table with a caption


| Col1 | Col2 | Col3 |
|------|------|------|
| A    | B    | C    |
| E    | F    | G    |

: A labelled table with a caption {#tbl-letters}

image

Expected behavior

I would expect the caption to be placed on top in both examples.

Actual behavior

It is only placed on top for the second example, where the table is labelled.

Your environment

  • IDE: nvim 0.10.0
  • Distro: Fedora 40

Quarto check output

Quarto 1.4.554
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.554
      Path: /opt/quarto-1.4.554/bin

[✓] Checking tools....................OK
      TinyTeX: v2024.05
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/gerd-jln/.TinyTeX/bin/x86_64-linux
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.1
      Path: /home/gerd-jln/.pyenv/versions/3.12.1/bin/python3
      Jupyter: 5.7.2
      Kernels: auroc, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /usr/lib64/R
      LibPaths:
        - /home/gerd-jln/R/x86_64-redhat-linux-gnu-library/4.4
        - /usr/lib64/R/library
        - /usr/share/R/library
      knitr: 1.46
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK
@jolars jolars added the bug Something isn't working label May 21, 2024
@mcanouil mcanouil added crossref tables Issues with Tables including the gt integration triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. labels May 21, 2024
@mcanouil mcanouil added the regression Functionality that used to work but now is broken. label May 21, 2024
@mcanouil
Copy link
Collaborator

Thanks for the report.
That's a regression from 1.3.

@cscheid
Copy link
Collaborator

cscheid commented May 21, 2024

In 1.3, the only control for table caption location was through CSS (eg caption-side: bottom), and that was injected when tbl-cap-location was used. This didn't work well in other formats, like PDF:

image

In 1.4, we switched most of the treatment to FloatRefTarget. But that only comes up when labels are present, as mentioned in the report.

Unfortunately, I don't think there's a general satisfactory solution we can adopt for all formats for the case of captions without labels.

Consider the following argument. We either defer to Pandoc's writers for the Table node or we don't:

  • If we do, then we're subject to Pandoc's constraints, and I believe that means that caption location placement is in general hard-coded.
  • If we don't, then we need to use our custom rendering, but what rendering should that be? FloatRefTarget is the obvious choice, but in that case, shouldn't we simply issue a warning and ask users to add a label? Transforming the node always and without an option will mean that users who want Pandoc's original writer output will not have access to it.

@cscheid
Copy link
Collaborator

cscheid commented May 21, 2024

I'm just going to fix the HTML case; the LaTeX case is already a nightmare because of longtable.

There is a way to make the caption appear below the bottom rule for longtables, but it will break multi-page longtable rendering and it's more regex wrangling of LaTeX code. I'm deciding against it: if LaTeX users insist on bottom captions for tables, they will have to emit their own raw LaTeX.

@mcanouil mcanouil added this to the v1.5 milestone May 21, 2024
@cscheid cscheid removed the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label May 21, 2024
@jolars
Copy link
Author

jolars commented May 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossref regression Functionality that used to work but now is broken. tables Issues with Tables including the gt integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants