[Tex/LaTex] pandoc support for LaTeX ctable

htmlmarkdownpandoc

I use ctable to make my LaTeX tables. My ultimate goal is to produce a presentation of HTML5 slides. The tables that I need to present are all created in LaTeX with ctable.

For example, I have my LaTeX ctable saved in table.tex. Then I try

pandoc -s table.tex -o table.md

to create a markdown version of the table, so that I can then use

pandoc -s --mathjax -S -i -t slidy table.md -o table.html

to produce the HTML5 slides. However, the first step

pandoc -s table.tex -o table.md

just produces a completely empty file table.md.

How can create an HTML5 slideshow with tables created in LaTeX ctable?

Here is an example ctable, so this code would be the contents of table.tex referenced above.

\ctable[botcap,caption={Basic descriptive statistics for GSS data},label=tab:gss1,pos=!tbp,]{lrrr}{}{\FL
\multicolumn{1}{l}{}&\multicolumn{1}{c}{N}&\multicolumn{1}{c}{mean}&\multicolumn{1}{c}{std. dev.}\ML
age&$1969$&$   48.19$&$   17.69$\NN
children&$1971$&$    1.89$&$    1.67$\NN
income&$1142$&$27580.59$&$57601.05$\LL
}

Best Answer

Pandoc doesn't seem to support ctable. When it generates LaTeX tables from Markdown, for example, it uses longtable. See the PDF requirements.

Having said that, I haven't been able to get it to parse tables from LaTeX at all, regardless of the table implementation.

I see two options:

  • Change your input file format to something that Pandoc can fully ingest, like its enhanced Markdown format. It supports tables and TeX-style math.

    I get the impression that you have made a significant investment in your existing source files, so this is unlikely to be a good solution for you.

  • Change your presentation format to PDF and use something like Beamer to generate your presentation directly from LaTeX.

    Incidentally, Pandoc supports Beamer output and handles it very well from Markdown source:

    pandoc -s --mathjax -S -i -t beamer -R test.md -o test.pdf

    You may also be able to tweak your .tex file and use the -R raw option to Pandoc to pass unrecognized LaTeX from your source file directly through to Beamer, though I haven't gotten this to work. I'm not enough of a LaTeX expert to troubleshoot this.

If HTML output and LaTeX input are both non-negotiable, you may be stuck tweaking tables manually as you do your conversion.

Related Question