Roland's homepage

My random knot in the Web

img4latex

This script “image for LaTeX” is meant for generating LaTeX figure environments of pictures.

It handles the same picture types that pdfLaTeX can handle; pdf, jpeg and png. To be able to do this, it requires the PostScript interpreter ghostscript and the identify program from the ImageMagick suite.

This script is available on github from my scripts repository.

An example command.

img4latex pdf/overview-drawing.pdf

This produces the following output.

\begin{figure}[!htbp]
\centerline{\includegraphics[viewport=0 0 1191 842,clip,scale=0.381]%
    {pdf/overview-drawing}}
\caption{\label{fig:overview-drawing}overview-drawing}
\end{figure}

The caption should probably be replaced by something more descriptive. This code should be copied and pasted into the document you want to include the picture in.

This generated code should work with pdflatex as long as the document in which it is included uses \usepackage{graphicx}.


For comments, please send me an e-mail.


Related articles


←  Managing configuration files with ‘deploy’ SHA256 in pure Python  →