rnuske / komaletter

R package for comfortable writing of beautiful PDF letters in Markdown.
https://rnuske.github.io/komaletter
86 stars 21 forks source link

Wide tables don't render #20

Closed fkohrt closed 1 year ago

fkohrt commented 1 year ago

If I put the following table inside a document that outputs to komaletter::komaletter I get an error.


| One Column                                        | Another column with a very long but useless title |
| ------------------------------------------------- | ------------------------------------------------- |
| Another column with a very long but useless title | Another column with a very long but useless title |

The error message is

! Undefined control sequence.
<argument> @{} >{\raggedright \arraybackslash 
                                              }p{(\columnwidth - 2\tabcolsep...
l.99 ...nwidth - 2\tabcolsep) * \real{0.5000}}@{}}

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted

I can resolve the error by adding the tabularx package as dependency to the YAML header:

output:
  komaletter::komaletter:
    extra_dependencies: ["tabularx"]

But now I get the following error:

! Missing number, treated as zero.
<to be read again> 
                   (
l.102 \begin
            {minipage}[b]{\linewidth}\raggedright 

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted
Minimal reproducible example ```Rmd --- author: Max Mustermann return-address: - Musterstr. 12 - 34567 Musterstadt address: - Robert Nuske - Hauptstr. 31 - 30167 Hannover - Germany subject: Some nonsensical Subject opening: Dear Robert, closing: Best regards, signature: Max Mustermann output: komaletter::komaletter: extra_dependencies: ["tabularx"] --- | One Column | Another column with a very long but useless title | | ------------------------------------------------- | ------------------------------------------------- | | Another column with a very long but useless title | Another column with a very long but useless title | ```
rnuske commented 1 year ago

Hi fkohrt, thanks for the reproducible example! Will definitely look at it. Might take some time, since I am traveling without capable laptop at the moment. I have to ask a nive question because i never embeded a table in my komaletters so far: Does the problem also show with "normal sized" tables? cheers robert

fkohrt commented 1 year ago

Hi Robert, thank you for the quick reply! No, for non-wide tables I experienced no problems. But this was the first time that I used your nice package and I haven't had the chance yet to test the full variability of possible tables (e.g. tables spanning multiple pages, tables with cells that include linebreaks etc.). No worries, enjoy the time without laptop! Best, Florian

rnuske commented 1 year ago

If I understood correctly, this is due to newer pandoc versions. Pandoc "now" needs packages array and calc for longtables. Pandoc's default.latex template changed in the "table area" around version 2.11. I copied that part into my template. Your reproducible example works for me now. Please test, @fkohrt

fkohrt commented 1 year ago

Yes, it works for me as well. Thank you!