LATEX Graphics Inclusion Techniques
The Idea of the Bounding Box is the key to understanding graphical displays in LATEX, or any derivative (i.e. pdfTEX). The box will set the size displayed and control what the viewport (cropped image) will access.
Graphics – Pictures, Images and graphs JPEG – PNG – PDF – METAPOST EPS (encapsulated PS) Import Library: \usepackage{graphicx} Import Directive: \includegraphics[options]{filename} Example: \includegraphics[width=3in]{file.png} The result of this call sets the width of the graphic to 3inches
Available Options: height – sets height of graphic( height=2cm ) totalheight – total height of graphic (height + depth) width – sets width of graphic angle – sets rotation in degrees about the origin, clockwise=neg origin – [origin=c], indicates center graphic for rotation. bb – bounding box. [bb = ], sets 2 points, (10,20) represents lower-left corner of graphic, (100,200) is the upper right. Cropping: viewport – respect to the bb, [viewport = ,clip = true], sets view area of graphic and clips it. trim – [trim , clip=true] removes
\documentclass[a4paper,12pt]{article} \usepackage{graphicx} \begin{document} \begin{figure} \begin{center} \includegraphics[bb = ]{tim.jpg} \caption{this is a cat on a guy} \label{fig:graph} \end{center} \end{figure} \begin{figure} \includegraphics[bb= , viewport= , clip=true]{tim.jpg} \end{figure} \end{document}
\usepackage{graphicx} \begin{document} \begin{figure} \begin{center} \includegraphics[bb = ]{tim.jpg} \caption{this is a cat on a guy} \label{fig:graph} \end{center} \end{figure} \begin{figure} \includegraphics[bb= , viewport= , clip=true]{tim.jpg} \caption{this is a cat -- sans guy} \end{figure} \end{document}
If you substitute Tim.jpg with any picture, in the above example, you will see an initial full image, and a secondary (2 nd page probably) of the cropped image of the top portion of the image. The use of “\begin{figure}” will allow the technical writer (you) to indirectly refer to a previously defined figure by number; every time a \begin{figure} is encountered LATEX automatically increments the index of the figure. Additionally, the figure reference allows for arbitrary page referencing by employing the \label{reference info} to tag the graphic. This allows reference by:“illustrated by the graphic” \ref{reference info} -- name refered. on page \pageref{reference info} reference info – {fig:graph} usual form
Floating placement of Graphics LATEX’s automated placement of figures will place according to accepted default behavior: topnumber The max# of float figures at the top of page (default = 2). bottomnumber The max# of float figures at the bottom page (default = 1). totalnumber The max# of float figures on any page (default = 3).
Wide Figures 1 sided documents: The following code uses this narrow environment to make the figure extend 1 inch into the left margin \begin{figure} \begin{ narrow }{-1in}{0in} \includegraphics[width=\linewidth]{wide} \caption{This is a wide figure} \end{narrow} \end{figure} A Very, Very Wide Graphic
Notes – Links – Software Providers Graphics info Source: