Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc: Long tablerows in Markdown->PDF documents do not get linewrap

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 Resulting PDF

How do I enable line-wrapping in PDF tables?

like image 301
Karl Ivar Dahl Avatar asked Jul 30 '14 12:07

Karl Ivar Dahl


People also ask

How do I use pandoc markdown PDF?

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.

Can pandoc convert from PDF?

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.

Can pandoc convert HTML to markdown?

Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.

How do you use extensions in pandoc?

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.


1 Answers

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.

like image 147
John MacFarlane Avatar answered Sep 20 '22 16:09

John MacFarlane