![! LaTeX エラー: ../images/vi.gif 内のグラフィックのサイズを判別できません (BoundingBox がありません)](https://rvso.com/image/370291/!%20LaTeX%20%E3%82%A8%E3%83%A9%E3%83%BC%3A%20..%2Fimages%2Fvi.gif%20%E5%86%85%E3%81%AE%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%81%AE%E3%82%B5%E3%82%A4%E3%82%BA%E3%82%92%E5%88%A4%E5%88%A5%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%9B%E3%82%93%20(BoundingBox%20%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93).png)
ダウンロードしましたhttps://hea-www.harvard.edu/~fine/Tech/vi.htmlファイルを使用しwget -p -k https://hea-www.harvard.edu/~fine/Tech/vi.html
てこれを実行し、pandoc --latex-engine=xelatex -o vi.pdf vi.html
生成します -
pandoc: Error producing PDF from TeX source.
! LaTeX Error: Cannot determine size of graphic in ../images/vi.gif (no Boundin
gBox).
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.884 ...html}{\includegraphics{../images/vi.gif}}
そして、これをpdflatex
使用することで(PandocのデフォルトのLaTeXエンジン)を使用すると、pandoc -o vi.pdf vi.html
pandoc: Error producing PDF from TeX source.
! LaTeX Error: Unknown graphics extension: .gif.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.884 ...html}{\includegraphics{../images/vi.gif}}
私もwkhtmltopdf https://hea-www.harvard.edu/~fine/Tech/vi.html
ウェブリンクから PDF を作成しています。しかし、wkhtmltopdf
ソリューションでは背景色を制御できません。白黒の PDF を作成したいです。
答え1
取るハーバートのコードそれをファイルに保存します:
% file: gif2png.tex
% Herbert's code:
% https://tex.stackexchange.com/questions/7602/how-to-add-a-gif-file-to-my-latex-file/7608#7608
\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.gif}{png}{.png}{convert gif:#1 png:\OutputFile}
\AppendGraphicsExtensions{.gif}
これで、次のオプションを指定して pandoc を呼び出すことができます。--pdf-engine-opt=-shell-escape --include-in-header=gif2png.tex
例:
次の単純な HTML ファイルを見てください。
<!-- file: test.html -->
<p>Here is a gif:</p>
<img src="test.gif" title="A dummy picture" alt="The gif" />
そして、次のGIFがありますtest.gif
:
そしてpandocを実行します:
pandoc test.html --pdf-engine-opt=-shell-escape --include-in-header=gif2png.tex -o test.pdf
結果として、次の PDF が得られます。
警告:
epstopdf
pdflatex
およびlualatex
pdfエンジンのみをサポートします