jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.54k stars 3.38k forks source link

Disable the generation of smaller tables when using LaTeX/PDF? #3929

Open Wandmalfarbe opened 7 years ago

Wandmalfarbe commented 7 years ago

When I convert a table from markdown to PDF/LaTeX, the generated LaTeX code contains @-expressions to make the table a bit smaller on the left and right side.

Markdown

| One | Two | Three |
|-----|-----|-------|
| 1,1 | 1,7 | 2,2   |
| 5,4 | 3,8 | 2,1   |
| 2,7 | 1,6 | 9,4   |

LaTeX This @{} makes the table smaller.

\begin{longtable}[]{@{}lll@{}}
\toprule
One & Two & Three\tabularnewline
\midrule
\endhead
1,1 & 1,7 & 2,2\tabularnewline
5,4 & 3,8 & 2,1\tabularnewline
2,7 & 1,6 & 9,4\tabularnewline
\bottomrule
\end{longtable}

PDF

screenshot 2017-09-18 14 02 00

Unfortunately it looks a bit strange when the rows of the table are colored because the width of the rows exceed the width of the table. Is it possible to stop the generation of these small tables via a flag or some LaTeX code that can be put in the preamble of a custom template?


pandoc 1.19.2.1
Compiled with pandoc-types 1.17.0.4, texmath 0.9, skylighting 0.1.1.4
jgm commented 7 years ago

How are you coloring the rows?

Wandmalfarbe commented 7 years ago

I use \rowcolors from xcolor. You can see it here https://github.com/Wandmalfarbe/pandoc-latex-template/blob/dbd166f601b3aa855d7765fc58653890929d5294/eisvogel.tex#L565.

jgm commented 6 years ago

Arguably this is a bug in the package you're using for coloring the rows. Shouldn't it be sensitive to the @{}?

Wandmalfarbe commented 6 years ago

It may be a bug in xcolor, but it is currently the only way to color table rows without inserting some LaTeX in the table itself. There aren't many options either. You can use xcolor or colortbl which I think gets used by xcolor.

Faldrian commented 4 years ago

I would want the table to be exactly as wide as the page content area (to match listing boxes for example). If there would be such an option, it would also workaround this issue.

Is there such an option to have my table full width in pandoc... (I am using eisvogel template as well)?

darylz commented 1 year ago

any update with this issue?

jdelker commented 1 month ago

I bumped into this as well. Any news on this?

jgm commented 1 month ago

See also discussion in #10255.