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
  • Image positioning / float setting
  • Multiple images/subconfigurations in LaTeX
  • 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 latexLinks - Annotated images/figures in LaTeXThe visual environment takes care of the numbering and positioning of images in the document. To include an image, you must use the includegraphics command. It takes the image width as an option in brackets and the path to your image file. As you can see, I put the line width in brackets, which means the image will be scaled to fit the width of the document. As a result, smaller images are scaled and larger images are scaled down accordingly. As I mentioned earlier, brackets contain the path to the image. In this case, the image is stored in the same directory as my .tex file, so I just put topqa.info here to include it. For large documents, you may want to store the image files in a different folder such as we created an images folder, then we just need to write images/topqa.info to in curly braces. In the next command, we put a caption, which is the text that is displayed below the image, and a label that is not visible, but is useful if we want to refer to our figure in our document. You can use the ref command to refer to the figure (marked with a label) in your text and it will then be replaced with the correct number. LaTeX is smart enough to automatically retrieve the correct numbers for all your images. Note that you will need to include the graphicx package to use this code.

    See Also  How To Catch Big Blue Catfish In Rivers

    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:Link - Image positioning / float settingsRead more: how to dye my hair with lipstick If you look closely, you will see that I have set the width of the figure manually: %… begin {subfigure}[b]{0.4linewidth}%… and even though there are two images aligned side by side, both having their widths set to 0.4, they still fill the entire space. You should always set this to 0.1 which is less than you expect. If you want to align three images side by side, you should add three subprofiles consecutively, each with a width of 0.2line. I suggest, if you need some other arrangement, you just try with the width factor until you are satisfied with the result. A more complex example with multiple rows and columns might look like this: %… begin {figure}[h!] center start {subfigure}[b]Include {0.2linewidth}[width=linewidth]{coffee.jpg} caption {Coffee.} end {subfigure} begin {subfigure}[b]Include {0.2linewidth}[width=linewidth]{coffee.jpg} caption {Add coffee.} end {subfigure} begin {subfigure}[b]Include {0.2linewidth}[width=linewidth]{coffee.jpg} caption {Good coffee.} end {subfigure} begin {subfigure}[b]Include {0.5linewidth}[width=linewidth]{coffee.jpg} caption {Too much coffee.} end {subfigure} caption {A cup of coffee is the same. Multiple times.} Label {fig: coffee3} end {figure}%… This will print the following image in your document:Linking - Multiple images/subconfigurations in LaTeXIf you want to learn more about subconfigurations, I invite you to read this complete guide!Photos - topqa.info

    See Also  How To Make Popping Boba

    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

    Rate this post
    Back to top button