In working with pandoc, I have stumbled on an annoying asymmetry. Using pandoc to convert rst to latex, pandoc uses the longtable environment. E.g.:
======= =====
example table
======= =====
stuff other
random junk
======= =====
\begin{longtable}[c]{@{}ll@{}}
\toprule
example & table\tabularnewline\midrule\endhead
stuff & other\tabularnewline
random & junk\tabularnewline\bottomrule\end{longtable}
However, if you attempt to feed pandoc a longtable in latex input and convert it to something else, it will be garbage:
\begin{longtable}[c]{@{}ll@{}}
\toprule
example & table\tabularnewline\midrule\endhead
stuff & other\tabularnewline
random & junk\tabularnewline\bottomrule\end{longtable}
<p>[c]<span>@ll@</span> example & tablestuff & otherrandom & junk</p>
(Note that the above example actually fed the LaTeX output from pandoc directly back into itself, but that any use of the longtable environment fails to be parsed).
In fact, it seems that pandoc only supports the tabular environment for tables (for latex input). However, the tabular environment does not span pages in PDF output. Resultingly, the only way to have a latex source file for pandoc that will also be used for PDF output that uses tables is to do something like the following:
The main line of note in the snippet above is the use of an if command (which is specific to the output engine) that conditionally redefines tabular to be longtable. If Pandoc were to, instead of needing this shockingly ugly workaround, simply consume the longtable environment (which does not seem too far out-of-scope since pandoc itself generates longtable environments), this whole situation could be made much simpler.
In working with pandoc, I have stumbled on an annoying asymmetry. Using pandoc to convert rst to latex, pandoc uses the longtable environment. E.g.:
However, if you attempt to feed pandoc a longtable in latex input and convert it to something else, it will be garbage:
(Note that the above example actually fed the LaTeX output from pandoc directly back into itself, but that any use of the longtable environment fails to be parsed).
In fact, it seems that pandoc only supports the tabular environment for tables (for latex input). However, the tabular environment does not span pages in PDF output. Resultingly, the only way to have a latex source file for pandoc that will also be used for PDF output that uses tables is to do something like the following:
The main line of note in the snippet above is the use of an
if
command (which is specific to the output engine) that conditionally redefines tabular to be longtable. If Pandoc were to, instead of needing this shockingly ugly workaround, simply consume the longtable environment (which does not seem too far out-of-scope since pandoc itself generates longtable environments), this whole situation could be made much simpler.