16 Including Figures & Pictures
16.1 Including Figures
Graphicx package and basic figures
The LaTeX package graphicx makes it possible to insert external graphics into your document. To use the package, simply include the tag \usepackage{graphicx} in the preamble of your document, as in the example below.
16.2 Including a Picture
In order to include a picture, simply use the \includegraphics markup tag surrounded by the figure environment, as seen in the screenshot below.
Note that for that to work, the picture ‘coala.jpg’ has to be in the same directory (i.e. folder) as your .tex file. To insert a picture from another folder, simply reference its directory explicitly, as shown in the example below.
For Windows:
For Mac:
16.3 Picture Dimensions
As you can see the resulting picture is rather oversized, doesn’t fit the page and takes up a lot of space. That’s because, by default, LaTeX inserts a picture in its original size – similarly as when you insert graphics in traditional text editors such as Word. To avoid that, we can specify the picture’s size using square brackets before the curly brackets with the file name, as shown in the screenshot below.
The resulting figure takes the width of the text written around the picture while maintaining its aspect ratio. We can also specify the size of the pictures manually in centimetres.
This, however, can result in distorting the original picture, as in the example. To fix that we can use the ‘keepaspectratio’ option. Which will make the picture as close as possible to the desired size, while maintaining the original aspect ratio of the file.