Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/pandocPublic

Correctly consume the longtable environment in LaTeX input #2411

Closed
@HalosGhost

Description

@HalosGhost

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   otherrandom  junk======= =====
\begin{longtable}[c]{@{}ll@{}}\topruleexample & table\tabularnewline\midrule\endheadstuff & other\tabularnewlinerandom & 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@{}}\topruleexample & table\tabularnewline\midrule\endheadstuff & other\tabularnewlinerandom & junk\tabularnewline\bottomrule\end{longtable}
<p>[c]<span>@ll@</span> example &amp; tablestuff &amp; otherrandom &amp; 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:

\usepackage{ifxetex,longtable}\begin{document}\ifxetex\let\tabular\longtable\let\endtabular\endlongtable\fi\begin{tabular}[h]{l|l|l}…\end{tabular}\end{document}

The main line of note in the snippet above is the use of anif 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp