Skip to content

tables not being placed in margin in latex/pdf #11081

Open
@mikabr

Description

@mikabr

Bug description

Tables placed in fenced divs with .column-margin should appear in the margin, as should tables with chunk option column: margin.

Markdown (pipe) tables seem to only be placed in the margin if they have no label (table 1), otherwise they're placed in the main body, whether the label is in the fenced div (table 2) or in the table caption (table 3).

Chunk output tables seem to be placed in the margin if they're in a fenced div (table 4) but not if they have the margin chunk option (table 5).

The latex for all of these tables seems to be basically the same (using the longtable environment), with the difference being just whether they're wrapped in a marginnote environment.

Steps to reproduce

---
format:
  pdf:
    keep-tex: true
execute: 
  echo: false
---

Table 1 appears in the margin but isn't labelled/referenceable

::: {.column-margin}

| Col1 | Col2 |
|------|------|
| a    | b    |
| c    | d    |

: pipe table without label

:::


@tbl-label-fenced fails to appear in the margin

::: {.column-margin #tbl-label-fenced}

| Col1 | Col2 |
|------|------|
| a    | b    |
| c    | d    |

: pipe table with label in fenced div

:::


@tbl-label-caption fails to appear in the margin

::: {.column-margin}

| Col1 | Col2 |
|------|------|
| a    | b    |
| c    | d    |

: pipe table with label in caption {#tbl-label-caption}

:::


@tbl-chunk-fenced appears in the margin!

::: {.column-margin}
```{r}
#| label: tbl-chunk-fenced
#| tbl-cap: "chunk output table in fenced div"

knitr::kable(head(mtcars[,1:2], 2))
```
:::


@tbl-chunk-opt fails to appear in the margin

```{r}
#| column: margin
#| label: tbl-chunk-opt
#| tbl-cap: "chunk output table with chunk option"

knitr::kable(head(mtcars[,1:2], 2))
```

Expected behavior

All these tables are placed in the margin.

Actual behavior

Pipe tables with labels are placed in the main body, chunk output tables with margin chunk option are placed in the main body.

Your environment

No response

Quarto check output

Quarto 1.5.56
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.56
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2023.10
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/mikabr/Library/TinyTeX/bin/universal-darwin
      Version: 2023

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /opt/homebrew/opt/[email protected]/bin/python3.12
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/mikabr/Dropbox (Personal)/projects/_langcog/_experimentology/experimentology/renv/library/R-4.3/aarch64-apple-darwin20
        - /Users/mikabr/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.3/aarch64-apple-darwin20/ac5c2659
      knitr: 1.45
      rmarkdown: 2.25

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

Metadata

Metadata

Assignees

Labels

article-layoutbugSomething isn't workinglayouttablesIssues with Tables including the gt integration

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions