Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: GIF and jpeg files Up: Graphics Previous: Postscript from PCs/Macs

Scaling, rotation, clipping, wrap-around and shadows

The graphicx package includes routines that are useful even without graphics. \reflectbox{Reflect} produces and \resizebox{3cm}{0.2cm}{Stretched} produces . To scale imported graphics, use some optional arguments
   \includegraphics[width=5cm,height=10cm]{yourfile.ps}
would rescale the postscript so that it was 5cm wide and 10cm high. To make the picture 5cm wide and scale the height in proportion use
   \includegraphics[width=5cm]{yourfile.ps}

To rotate anticlockwise by the specified number of degrees, use

   \includegraphics[angle=150]{yourfile.ps}

These options can be combined - note that order matters. The following examples demonstrate how to combine these features and how to use the subfig package to have more than one graphic in a figure.


 
Figure 2: Tigers
\includegraphics[height=40mm]{/export/ghostfonts/tiger.eps} \includegraphics[angle=120, height=20mm]{/export/ghostfonts/tiger.eps}

\centering
\begin{figure}[hbtp]
  \includegraphics[height=40mm]{/export/ghostfonts/tiger.eps} 
  \includegraphics[angle=120, height=20mm]{/export/ghostfonts/tiger.eps} 
\caption{Tigers}
\end{figure}

% remember to do \usepackage{subfig} at the top of the document! 
\begin{figure}[hbtp]
\centering
\subfloat[Small]% \quad on the next line adds spacing
{\includegraphics[height=30mm]{/export/ghostfonts/crest.eps}}\quad
\subfloat[Medium]
{\includegraphics[width=40mm]{CUni3.eps}}\quad
\subfloat[Large]
{\includegraphics[height=50mm]{/export/ghostfonts/crest.eps}} 
\caption{3 crests}
\end{figure}


 
Figure 3: 3 crests
[Small] \includegraphics[height=30mm]{/export/ghostfonts/crest.eps}     [Medium] \includegraphics[width=40mm]{CUni3.eps}     [Large] \includegraphics[height=50mm]{/export/ghostfonts/crest.eps}

To clip the postscript image use the viewpoint argument. The following fragment would display only part of the image. The viewport coordinates are in the same units as the bounding box.

\begin{figure}[htbp]
\includegraphics[viewport=200 400 400 600,width=5cm,clip]%
{CUniv3.eps}
\end{figure}

% Use the floatflt package
\begin{floatingfigure}[l]{4cm}
\includegraphics[width=2cm]{/export/ghostfonts/crest.eps}  
\caption{Using floatingfigure}
\end{floatingfigure}


 
Figure 4: Using floatingfigure
4cm \includegraphics[width=2cm]{/export/ghostfonts/crest.eps}

The floatflt package lets you insert a graphic and have the text wrap around it. You can provide 2 arguments to the floatingfigure command: the first (l or r) selects whether you want the graphic to be on the left or right of the page. The 2nd argument gives the width of the graphic. Not all text will flow perfectly around (for example, verbatim text fails, as illustrated below) so check the final output carefully.

Using the fancybox package gives you access to \shadowbox, \ovalbox, \Ovalbox and \doublebox commands, which can be used with text or with graphics. For example, \shadowbox{shadow package} produces shadow package and

\ovalbox{\includegraphics[height=10mm]{CUni3.eps}}
produces \includegraphics[height=10mm]{CUni3.eps}. Unfortunately, the fancybox package as supplied suppresses the table of contents. The locally produced contentsfancybox solves this, but may introduce graphics problems.


next up previous contents
Next: GIF and jpeg files Up: Graphics Previous: Postscript from PCs/Macs
© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-27