Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home How to... Insert a figure in LaTeX
Personal tools
Document Actions

Insert a figure in LaTeX

Using graphics in LaTeX documents

If you have created a graphic with another program and want to include it in your document, try to produce an EPS file first. See the corresponding information in the chapters on Mathematica, Gnuplot, Xfig for instructions. If you are only able to create bitmap files (BMP, GIF, TIFF, etc.) you can use mogrify (see section File Formats) to convert them into PostScript.

  • When you use LaTeX 2.09 (in other words, your document starts with the line documentstyle...), insert the following line at the beginning:
       \input ../images/epsf
    
    At the point where you want to include the figure, write:
       \begin{figure}
       \epsfbox{sin.eps}
       \caption{The Sine function}
       \end{figure}
    
    Of course, you should replace the file name and the figure caption with the ones you need. You can also change the size of the figure using the commands
       \epsfxsize=5cm \epsfbox{sin.eps}
    
    This will scale the figure to have a width of 5 cm.
  • In LaTeX2e (where the first line of the document reads documentclass...) add the following line:
       \usepackage{epsfig}
    
    At the point where you want to include the figure, put:
       \begin{figure}
       \epsfig{file=sin.eps}
       \caption{The Sine function}
       \end{figure}
    
    To scale the graphic and/or to rotate it, add the arguments width, height or angle as shown below:
       \epsfig{file=sin.eps,width=5cm,angle=90}
    
  • In LaTeX2e, if you want the labels of an EPS figure to be TeXed, use the package psfrag. For more information, contact the help desk.

Powered by Plone This site conforms to the following standards: