! Error de LaTeX: no se puede determinar el tamaño del gráfico en ../images/vi.gif (sin BoundingBox)

! Error de LaTeX: no se puede determinar el tamaño del gráfico en ../images/vi.gif (sin BoundingBox)

he descargadohttps://hea-www.harvard.edu/~fine/Tech/vi.htmlarchivo usando wget -p -k https://hea-www.harvard.edu/~fine/Tech/vi.htmlluego ejecute pandoc --latex-engine=xelatex -o vi.pdf vi.htmleste producir -

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}}

Y cuando uso pdflatex(motor de látex predeterminado en Pandoc) usando pandoc -o vi.pdf vi.htmleste producto,

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}}

También uso wkhtmltopdf https://hea-www.harvard.edu/~fine/Tech/vi.htmlpara hacer pdf desde un enlace web. Pero en wkhtmltopdfla solución no tengo control sobre el color de fondo. Quiero hacer un pdf en blanco y negro.

Respuesta1

LlevarEl código de Herbert.y ponerlo en un archivo:

% 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}

Ahora puedes llamar a pandoc con las opciones:--pdf-engine-opt=-shell-escape --include-in-header=gif2png.tex

Ejemplo:

Tome este sencillo archivo html:

<!-- file: test.html -->
<p>Here is a gif:</p>
<img src="test.gif" title="A dummy picture" alt="The gif" />

Y un gif llamado test.gif:

ingrese la descripción de la imagen aquí

Y ejecuta pandoc:

pandoc test.html --pdf-engine-opt=-shell-escape --include-in-header=gif2png.tex -o test.pdf

Obtendrá este pdf como resultado:

ingrese la descripción de la imagen aquí


Advertencia:

epstopdfsolo admite pdflatexy lualatexcomo motor pdf

información relacionada