Open davidpomerenke opened 1 year ago
I don't believe this to be a bug, but a known limitation, see https://quarto.org/docs/authoring/article-layout.html#pdflatex-layout.
I let @dragonstyle confirm this before removing "bug" label.
column: page
should be treated as column: page-right
in PDFs, which I find reasonable, but it is not currently the case. Therefore I would argue that this should be treated as a bug.
How it works for figures:
---
title: Example
format:
pdf:
papersize: a4
fontsize: 9pt
geometry:
- showframe
html:
fontsize: 9pt
---
```{python}
# | label: tbl-official-overview
# | tbl-cap: Official overview.
# | column: page
# | echo: false
from IPython.display import Markdown
import pandas as pd
md = (
pd.read_csv("tables/official-overview.csv", sep=";")
.iloc[:7]
.to_markdown(index=False)
)
Markdown(md)
# | label: fig-test
# | fig-cap: Test overview.
# | column: page
# | echo: false
import matplotlib.pyplot as plt
categories = ["A", "B", "C", "D"]
values = [10, 20, 15, 25]
plt.figure(figsize=(16, 4))
plt.barh(categories, values)
plt.show()
<img width="808" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/46022183/bf149b1f-f17a-449d-8b57-63d3d2704ff4">
Thanks for the follow up it makes things much clearer with the figure working as expected.
Workaround: Using LaTeX to create the table. It is not a Quarto table then (no label and caption) but displays the wide table properly. (The snippet will not be executable, should just give the idea.)
---
include-in-header:
text: |
\usepackage[l3]{csvsimple}
\usepackage{booktabs}
---
```{python}
# | echo: False
# # | label: queries
# # | tbl-cap: Queries for the media.
# # | column: page
df = climate_query_table()
Markdown(df.to_markdown(index=False))
df.to_csv(tables / "queries.csv", index=False)
:::{.column-page} \begingroup \small\selectfont \csvautobooktabular[separator=comma,respect all]{/Users/david/Repositories/protest-impact/report/tables/queries.csv} \endgroup :::
Adding a note - at least one issue is that the computed long table is using columnwidth
when computing sizes.
Bug description
Wide tables do not stretch beyond the body column in PDFs.
(For HTML, it is working:)
Steps to reproduce
Markdown that is produced as intermediate step:
The rendered table (just to show that the Markdown is correct):
Expected behavior
The table should fill both the body column and the margin.
Actual behavior
In the PDF, the table only fills the body column. The table caption is too far at the left.
In the HTML, things work.
https://quarto.org/docs/authoring/article-layout.html#pdflatex-layout states that PDF does not support all layout options in PDF, but to my understanding this one should work.
Your environment
Quarto check output
[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.55.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.361 Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK Version: 3.10.10 Path: /Users/david/Repositories/protest-impact/.venv/bin/python Jupyter: 5.3.0 Kernels: ir, python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK Version: 4.2.1 Path: /Library/Frameworks/R.framework/Resources LibPaths:
[✓] Checking Knitr engine render......OK