tables not being placed in margin in latex/pdf

Open
#11,081 1 comment 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Oct 17, 2024.

Assessment

This issue has not been assessed yet.

Description

article-layout bug layout tables
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/python@3.12/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
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/quarto-cli

All issues in quarto-dev/quarto-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.