Summary
This lesson teaches how to put an image in a document with the graphicx package and the command \includegraphics. It explains how to set its size (width, height, scale and preservation of the aspect ratio) and why measurements relative to the line width survive a change of margins while absolute ones do not; how to rotate it, crop it and choose one page of a multipage PDF; which formats LuaLaTeX accepts, why a chart should be exported as PDF rather than captured from the screen, and what resolution a printed photograph requires; how files are named and found, which extension the engine picks when it is omitted, and how to declare a folder of figures; why an image behaves like a large letter and how to center it or set it beside another; how to read the most frequent errors and what draft mode is for; and how to state where an image by someone else comes from.
Learning objectives
- Insert an image at the right size, choosing between relative and absolute measurements, and predict its final dimensions from the options and their order.
- Rotate, crop and extract a page of a PDF with the options of
\includegraphics. - Choose the format of each image (vector or bitmap) and check that a photograph has enough resolution to be printed.
- Name and place the image files of a project, and diagnose from the log an image that cannot be found, an unknown extension or an image wider than the line.
- Center an image or set two side by side, knowing that the image is placed on the line like a character, and state the source of every image by someone else.
The graphicx package
LaTeX does not insert images by itself: the graphicx package does, loaded in the preamble with \usepackage{graphicx}, and it provides the command \includegraphics[options]{file}. The mandatory argument is the name of the file; the options, in square brackets and separated by commas, set the size, the rotation or the cropping. The image is not copied into the source: the source only names it, and the engine finds it and embeds it in the PDF at every compilation.
A chemistry report is to show the microscope with which the observations were made. In the examples of this lesson, the images of the mwe package, which every TeX distribution includes, stand in for real photographs, maps and charts.
The image takes up sixty percent of the line width and keeps its aspect ratio, because only the width was set.
Loading the content…
Completed
Sign in to save your progress