LoginSignup
1
1

More than 5 years have passed since last update.

[pandoc] html -> pdfでテーブルキャプションに画像を置くと怒られる

Posted at

次のHTMLをpandoc a.html -p a.pdfでpdfに変換すると怒られる。

<html>
<body>
<table>
<caption><img src="a.png"></caption>
<tr><td>a</td></tr>
</table>
</body>
! Use of \LT@array doesn't match its definition.
\new@ifnextchar ...served@d = #1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.64 \caption{\includegraphics{a.png}}

pandoc: Error producing PDF

ところが、間にlatexファイルを明示的に挟むと怒られない。
pandoc a.html -s -t latex | pandoc -f latex -o a.pdf
pdfファイルを開く事も出来るが、キャプションのあたりに画像と共に@l@となにやらゴミが表示される。
中間のlatexファイルを確認すると次の様になっている。

\begin{longtable}[]{@{}l@{}}
\caption{\includegraphics{a.png}}\tabularnewline
\toprule
A\tabularnewline
\bottomrule
\end{longtable}

longtableの周りに原因と思しき{@{}l@{}}がある。
恐らく、表示を整えるための何かをここに展開する予定だったのだろうが、なぜかゴミが残っている。
とりあえず@{}を全て消し去ればとりあえず正しいlatexファイルが得られる。

これが直接pdfに変換する時のエラーと関係あるのかは不明。
何やらありそうな気はするが。

環境は以下の通り。

pandoc 1.17.1
Compiled with texmath 0.8.6.4, highlighting-kate 0.6.2.1.

pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Arch Linux)
kpathsea version 6.2.1

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1