I am using Pandoc to generate markdown->DOCX documents with a lot of tables but would like better control over the layout.
I am now trying to output markdown->PDF as well, but have run into problems with table output.
In DOCX, long rows with text are simply broken up into multiple lines. In the PDF document this does not happen; a row is always a single line that do not wrap at the right margin but continue outside of the page. Normal paragraph text flows according to the right margin, so the problem is probably not the page size.
Example Markdown:
This is text that flows according to the page limits. This is text that flows according to the page limits. This is text that flows according to the page limits.
This is text that flows according to the page limits. This is text that flows according to the page limits.
| Version | Date | Comment |
|--------:|-------|---------|
| 1.0.0 | 07.04.2014 | This is a table row that does not flow with the page limits. This is a table row that does not flow with the page limits. |
| 2.0.0 | 07.04.2014 | This is a table row that does not flow with the page limits. This is a table row that does not flow with the page limits. |
This is text that flows according to the page limits. This is text that flows according to the page limits. This is text that flows according to the page limits.
This is text that flows according to the page limits. This is text that flows according to the page limits.
Resulting PDF
How do I enable line-wrapping in PDF tables?
Generating PDF from Markdown with Pandoc There are actually two steps involved in converting a Markdown file to a PDF file: The Markdown source file is converted to a LaTeX source file. Pandoc invokes the pdflatex or xelatex or other TeX command and converts the . tex source file to a PDF file.
You can't. You can try opening the PDF in Word or Google Docs and saving in a format from which pandoc can convert directly.
Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.
An extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION . For example, --from markdown_strict+footnotes is strict Markdown with footnotes enabled, while --from markdown-footnotes-pipe_tables is pandoc's Markdown without footnotes or pipe tables.
Pipe tables don't wrap in LaTeX/PDF output. Use multiline or grid tables, as described in the pandoc User's Guide. This will also give you control over relative widths of columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With