top of page
Search

Images (LaTeX Series Part IV)

Updated: Oct 28, 2023

This article is based on the video LaTeX Tutorial pt 4 - Images in LaTeX, as it explains how to input graphics into a document, which must be done along with a package. As a first step, this is coded with the “\usepackage{graphicx}” statement, which should written before the title command.

  1. After this statement is written, import the graphic by uploading the file, which should then appear in the project section. The command to insert an image is “\includegraphics{}”, and the curly brackets should include the title of the file, for example “lion” if the file is named “lion.png”. To change the size of the image, you can type “[]” before curly brackets of the command (\includegraphics[]{}), and input the scale of the picture. For example, by inputting [scale=2], this will double the size of the picture. If specific measurements of the picture need to be changed, then [height=xcm] or [width =xcm] must be written inside the square brackets. To edit both the scale as well as the height/width, add a comma and a space to the first command, then input the second command. This should look like: \includegraphics[scale = 2, height = 4cm]{lion}.

  2. The graphics can also be rotated, by including the degrees the picture should be rotated by within the square brackets, which will rotate the picture counterclockwise.

  3. A different way to add graphics is to use the figure environment, which starts with a \begin{figure} and ends with an \end{figure} command. The image will be shifted onto a separate blank page, and the code written after the \begin{figure} command will specify the image’s placement, and is written in square brackets. The specifiers are h, meaning here - this places the image where the code is, and t, which places the image at the top of the page, and a b, which places the image at the bottom, and p, which places the image on a separate page. A “!” specifier personalizes the placement of the image, meaning it overrides where LaTeX places the figure, and an “H” places the image at an exact spot.

  4. The \centering command centers the figure, and a caption can be added with the command \caption{}. Where the caption appears is relative to where the code for the caption is placed.

  5. An item can be labelled with the command “\label”, and a reference to this figure can be written further in the document with the command “\ref{}”, with the label of the figure written within the curly brackets.

  6. A page reference can also be used to locate the figure, and this is written as “\pageref{}”.


3 views0 comments

Recent Posts

See All

Comments


bottom of page