How To Insert Images In Latex
Learn how to insert images and annotate them. Example for a single shape and multiple shapes side by side, using the subconfiguration environment.
Contents
Annotated images/figures in LaTeX
Sometimes you need to add a picture to your document. Using LaTeX, all images are automatically indexed and tagged with consecutive numbers when using the figure environment and the graphicx package. documentclass {article} usepackage {graphicx} begin {document} begin {figure} includegraphics[width=linewidth]{boat.jpg} caption {A boat.} label {fig: boat1} end {figure} Image ref {fig: boat1} shows a boat. end {document} The above code will generate the following pdf: Read: how to insert images in latex
Image positioning / float setting
At some point, you’ll notice that the shape doesn’t necessarily show up in the correct location when you put your code in the .tex file. If your document contains a lot of text, it’s possible that LaTeX will place the image on the next page or any other page it finds enough space. To prevent this behavior, you need to set the float value for the figure environment. %… Start {figure}[h!] %… Set float by adding [h!] behind the image environment hashtag will force the image to display at the location in the document. The value could be:
- h (here) – same location
- t (top of page) – top of page
- b (bottom) – bottom of page
- p (page) – on an additional page
- ! (override) – will force the specified position
Read more: how to fix power boy power lazy chair legs | Top Q&A However, I only use [h!] options so far. The float package (usepackage {float}) allows setting options to [H]even more strict [h!].
Multiple images/subconfigurations in LaTeX
Sometimes when writing a document, adding single images is not optimal, especially when the reader has to compare several results or graphs. In such situations, it may be necessary to use a different environment, called subconfiguration. The sub-configuration environment allows you to place multiple images at a certain location next to each other and is quite simple to use. document}%… end {document} Next, you need to add more sub-environments in the shape environment. %… Start {figure}[h!] center start {subfigure}[b]{0.4linewidth} includegraphics[width=linewidth]{coffee.jpg} caption {Coffee.} end {subfigure} begin {subfigure}[b]{0.4linewidth} includegraphics[width=linewidth]{coffee.jpg} caption {More coffee.} end {subfigure} caption {A cup of coffee is the same. Twice.} Label {fig: coffee} end {figure}%… This will display two images side by side in your document, like this:

Summary
- Use the graphicx package and the figure environment to embed images
- Images will be numbered automatically
- Change your image width using include[width=linewidth]{}
- Refer to the images in your documents by placing labels and using taglines
- Set the position of your image by adding a floating option such as [h!]
- If you want to display multiple metrics side by side, use the encoder package and the subconfiguration environment
Next article: 06 Table of ContentsRead more: How to make a ping pong catapult
Last, Wallx.net sent you details about the topic “How To Insert Images In Latex❤️️”.Hope with useful information that the article “How To Insert Images In Latex” It will help readers to be more interested in “How To Insert Images In Latex [ ❤️️❤️️ ]”.
Posts “How To Insert Images In Latex” posted by on 2021-10-26 14:57:08. Thank you for reading the article at wallx.net






