
如果我向 Pandoc 提供一個簡單的 LaTeX 表,例如
\begin{table}[h!]
\begin{tabular}{ll}
x&y\\
\end{tabular}
\caption{A caption}
\end{table}
並將其轉換為 HTML 使用
pandoc -s table.tex -o table.html
產生的表格將缺少標題(此外,它還會列印字元“[h!]”,這僅用於表格定位):
<p>[h!]</p>
<table>
<tbody>
<tr class="odd">
<td align="left">x</td>
<td align="left">y</td>
</tr>
</tbody>
</table>
我必須以不同的方式運行 pandoc 嗎?我在 Mac OS X 10.6.8 上使用 pandoc 版本 1.12.3。我以前版本的 Pandoc(我相信是 1.9)在 HTML 中可以很好地呈現字幕。
答案1
這個問題在新版本的 Pandoc 中得到了解決(參見這次提交,按照OP的票在 github 上)。早於該版本的版本1.12.4
應該可以解決此問題。
例如,使用 pandoc 1.12.4.2(使用 texmath 0.6.6.1 編譯,highlighting-kate 0.5.8.5。),以下程式碼
\documentclass{article}
\begin{document}
\begin{table}[h!]
\begin{tabular}{ll}
x&y\\
\end{tabular}
\caption{A caption}
\end{table}
\end{document}
產生
<!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>
呈現為
當用pandoc -s table.tex -o table.html
.