Graphics in LaTeX. Part II
At the end of last year, I published an article on graphics in LaTeX. Today I’m finally going to write a sequel. Due to the volume of material, it was necessary to break the article into several parts.
In this article, you will learn how to import raster and vector graphics.
You can import ready-made images (both raster and vector) into our document. But for this we first need to connect the driver ( dvips , pdftex or others). To connect the driver, we use the following construction in the document preamble:
To insert an image, use the command . The command syntax is as follows:
where
Original article: alex.kotomanov.com/2009/02/03/graph_in_latex_2
PS In the next part I will talk about color in LaTeX.
In this article, you will learn how to import raster and vector graphics.
Imported Graphics
You can import ready-made images (both raster and vector) into our document. But for this we first need to connect the driver ( dvips , pdftex or others). To connect the driver, we use the following construction in the document preamble:
\ifx\pdfoutput\undefined
\usepackage{graphicx}
\else
\usepackage[pdftex]{graphicx}
\fi
To insert an image, use the command . The command syntax is as follows:
\includegraphics
\includegraphics[keyval-list]{file}
,
where
file
is the name of the file, and keyval-list
is the list of keys that are specified in the form separated by commas.
You can omit the file extension with a picture in the command , since the driver itself knows what types of files it can process and which ones not. For the dvips driver, these are files with the extension eps , ps , eps.gz , ps.gz , eps.Z , and for the pdftex driver, these are png , pdf , jpg , mps , tifkey=value
\includegraphics
. When the file extension is not specified in the command, the driver sequentially adds all the extensions known to it to the file name until it finds the first suitable file. Example:
Possible keys:\includegraphics{01}
width=length
- sets in any TeX units of length the width of the area allocated for the drawing. Example:\includegraphics[width=1in]{01}
height=length
- sets the height of the picture. Example:\includegraphics[width=1in,height=10mm]{01}
totalheight=length
- full height. I did not understand why it is needed)))keepaspectratio
- maintains the proportion of the picture when changing the width and / or height. Example:\includegraphics[width=1in,%
height=1cm,keepaspectratio]{01}scale=scale
- scaling the picture inscale
times. Example:\includegraphics[scale=0.5]{01}
viewport=llx lly urx ury
trim=dl db dr du
- these keys define the so-called visible area of the picture. Herellx lly urx ury
are the x- and y-coordinates of the lower left and upper right corners of the visible region of the figure relative to the reference point, anddl db dr du
are the distances between the left, lower, right and upper borders of the visible region of the figure and the figure itself. Example:\includegraphics[viewport=-5 -5 50 50]{01}
clip=boolean
- if the value is equaltrue
, then this key cuts off the part of the picture that goes beyond the boundaries of the visible region. Example:\includegraphics[viewport=-5 -5 50 50,clip]{01}
angle=angle
- this key rotates the patternangle
counterclockwise degrees. The axis of rotation passes through the reference point of the box. Example:\includegraphics[scale=0.3,angle=30]{01}
draft
- at the stage of preparation of the document, you can use this key. He indicates that instead of drawing, draw a frame and print the file name inside it. Example:\includegraphics[scale=0.5,draft]{01}
Useful links:
- http://www.intuit.ru/department/publish/latex/
- http://mirror.macomnet.net/pub/CTAN/systems/win32/miktex/tm/packages/
- http://forum.ru-board.com/topic.cgi?forum=5&topic=4633#1
Original article: alex.kotomanov.com/2009/02/03/graph_in_latex_2
PS In the next part I will talk about color in LaTeX.