Javatpoint Logo
Javatpoint Logo

Latex Images

The images are used to enhance the information in a document or in any file. In most of the scientific documents, pictures are essential. In Latex, you can enlarge, shrink, rotate, and can set the reference of the image in your document.

Latex does not insert the picture itself.

The basic requirements to insert an image are:

  • Including the graphicx package. The command will be written as \usepackage{graphicx}.
  • You need to download the particular image from the browser and save that image in the same folder where the Latex files are present. Otherwise, Latex cannot access those images. Mention the same in the code or program that you have mentioned while saving that particular image.

Let's consider a simple example to insert an image. The code is written below:

Output:

Latex Images

You can insert many pictures in your document, depending on the requirements.

The code to insert two images is given below:

Output:

Latex Images

Path Specification

Sometimes, there are a large number of images present on your computer in different folders. To insert those images directly in your Latex document, you can specify the path using the \graphicspath{{ path}} command.

Let's consider the path-images. The command will be written as \graphicspath{{ \images}}. You need to create the folder by the name 'images' so that Latex can easily insert images or pictures into the document through this path.

The example is given below:

We have first created the images folder in the location where the Latex files are present. You can save several images in that folder and can access those directly.

Output:

Latex Images

You can also specify the absolute path if the exact location of the file is specified in your system. The example of such type is given below:

Here, we have created the 'images1' folder in the C: drive and hence specified the path. Similarly, you can also specify the path even if the image is present in the subfolder.

Output:

Latex Images

Changing the size of Image

You can specify the height and width of the image according to the requirements. The example is given below:

Output:

Here, you can use any path and dimensions according to the requirements.

Latex Images

Rotation of Image

You can rotate any image by specifying the angle in the \includegraphics command. Let's consider a single picture of a butterfly.

The code for such type is given in the below example:

Output:

Latex Images

Image alignment

In the image alignment, two commands are used. The first command is \baselineskip, which is used to generate vertical line spacing. The second command is the \quad, which is used to maintain the horizontal space. It has only a width.

If you want to align the images in the matrix form, then make sure that the width mentioned of all the photos is equal.

The code to arrange the six images in matrix form is given below:

Output:

Latex Images

If you want to enclose all the images of a page in a frame, then you need to use the showframe package. The command will be written as \usepackage{showframe}.


Next TopicLatex Figure





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA