How to insert images into LaTex document?

created at 01-12-2022 views: 8

graphicx package

LaTex itself does not have the function of processing pictures, you need to use the graphicx package:

\usepackage{graphicx}

Image import statement:

\includegraphics{image.png}

It should be noted that the pictures here must be in the same folder as the latex document .tex.

Manage image path

The clutter of pictures in the same directory as the document is obviously too cluttered. It is best to put the pictures in the same folder.

To use an image with a specified path, you first need to specify the path:

\usepackage{graphicx}
\graphicspath{ {./images/} } % specify the path

Where {./images/} is the path where images are stored, and . is a relative path, which means that the images/ directory is in the same directory as the LaTex document .tex.

Can also be an absolute path:

  • C:/Users/admin/Pictures/: Note the slash here, not the Windows backslash \.

After specifying the path, you can refer to the image under the path by name as before.

Image size problem

When actually inserting the picture, you may find that the actual situation is like this:

latex image too large

At this time, we need to add size adjustment parameters to the image import statement, such as:

\includegraphics[scale=0.5]{pika.JPG}
  • [scale=0.5]: The zoom ratio of the image, here it is reduced by half.
created at:01-12-2022
edited at: 01-12-2022: