jgm / pandoc

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

Weird interaction between definition lists and tables #3133

Open wilx opened 8 years ago

wilx commented 8 years ago

I have been generating some reports with Rstudio from Rmd documents which uses Pandoc to do parts of the conversion. In one of my documents the generated report contains this bit:

YGCT
  ~ Young generation garbage collection time.

               GCT       FGCT     YGCT
-------  ---------  ---------  -------
legacy    6,985.04   6,743.57   241.47
new       7,306.51   7,034.27   272.23

There is a definition list followed by a table. The above is converted to LaTeX with the "Y" in the last column being moved into the header of the middle column:

\begin{description}
\item[YGCT]
Young generation garbage collection time.

\begin{longtable}[]{@{}lcrl@{}}
\toprule
& GCT & FGCT Y & GCT\tabularnewline
\midrule
\endhead
legacy & 6,985.04 & 6,743.57 & 241.47\tabularnewline
new & 7,306.51 & 7,034.27 & 272.23\tabularnewline
\bottomrule
\end{longtable}
\end{description}

I get the above by simply invoking pandoc --to latex --from markdown -o test.tex test.md,

Attachment: test.txt

jgm commented 8 years ago

Confirmed. The problem is that the table is being considered part of the definition, because it starts with four spaces indent. This isn't good of course.

jgm commented 8 years ago

Workaround: just insert an empty HTML comment on the left margin between your definition list and your table (with a blank line above and below).