[Tex/LaTex] LaTeX tables in pandoc, captions

pandoctables

If I feed a simple LaTeX table to Pandoc, e.g.

\begin{table}[h!]
\begin{tabular}{ll}
x&y\\
\end{tabular}
\caption{A caption}
\end{table}

and convert it to HTML using

pandoc -s table.tex -o table.html

the resulting table will lack the caption (moreover, it also prints the characters '[h!]' which is just for table positioning):

<p>[h!]</p>
<table>
<tbody>
<tr class="odd">
<td align="left">x</td>
<td align="left">y</td>
</tr>
</tbody>
</table>

Do I have to run pandoc differently? I am using pandoc version 1.12.3 on a Mac OS X 10.6.8. Captions used to be rendered fine in HTML with my previous version of Pandoc (1.9, I believe).

Best Answer

This issue was resolved in a newer version of Pandoc (cf. this commit, following OP's ticket at github). Versions older than 1.12.4 should correct this problem.

For instance, with pandoc 1.12.4.2 (Compiled with texmath 0.6.6.1, highlighting-kate 0.5.8.5.), the following code

\documentclass{article}
\begin{document}
\begin{table}[h!]
\begin{tabular}{ll}
x&y\\
\end{tabular}
\caption{A caption}
\end{table}
\end{document}

produces

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<table>
<caption>A caption</caption>
<tbody>
<tr class="odd">
<td align="left">x</td>
<td align="left">y</td>
</tr>
</tbody>
</table>
</body>
</html>

which renders as

enter image description here

when compiled with pandoc -s table.tex -o table.html.