Tag Archives: postscript

Several common methods of inserting pictures into latex documents

zz from: http://hepg.sdu.edu.cn/Service/tips/latex/latexfig.html#top & http://liqunsun.spaces.live.com/Blog/cns!285A08B51269F219!109.entry

Generally, latex only supports inserting EPS (encapsulated postscript) format graphics files directly, so we should try to get EPS format files before inserting pictures into latex documents.

all kinds of application software under UNIX can output the results in PS format, Most software can also output EPS format. If the software can only output PS format but not EPS format results, it can be converted to EPS format by ps2epsi command. Please refer to man ps2epsi’s instructions. If the image file format is bitmap graphics file, it can be converted to PS or EPS format file by display and convert tools of image magic package. See man page and man page for details

instructions

the output of windows software becomes PS / EPS file: please refer to the

“How to convert the output of software in Windows system into PS and EPS files”

Description in the column

 

Inserting pictures into latex documents is realized by using some latex graphics processing macro commands. Many macro commands support inserting EPS format graphics files into latex documents

(1) Using the macro command of includegraphics (graphicx package)

First of all, you need to add the following in the file description of latex document:

/usepackage{graphicx}

Then, it is quoted in the place where the image needs to be inserted:
/ includegraphics [height = height] {image file name} or / includegraphics [width = width] {image file name}
where “height” and “width” refer to the height and width of the image to be printed, and the unit must be given, which can be centimeter (CM) or inch (in), The image file name in the above command refers to the file name of the image file to be inserted. The image must be in EPS format

When inserting a picture with the macro command includegraphics of the graphicx package, you can also rotate the picture by:
/ includegraphics [height = height] [angle = rotation angle] {picture file name}

The inserted graphics are usually in EPS, PDF, JPG, PNG and other formats. Suppose the name is fig, and put it in the same directory of your tex document.
1. First add a sentence / usepackage {graphicx}
in the introduction area. 2. If you want to insert an inline graphic, you can directly use
/ includegraphics [width = 5in] {fig},
without adding a suffix.
This width is my most commonly used option, which can also be changed to other options.
3. If you want to insert floating graphics, use
/ begin {figure} [htbp]
/ centering / includgraphics [width = 3.5in] {fig}
/ caption {something} / label{ fig:1 }
/ end {figure}
4. For EPS graphics, the compilation process is latex, dvips, ps2pdf.
for PDF JPG PNG graphics, the compilation process is pdflatex

Use the include graphics macro command (graphics package) to:

It is troublesome to insert pictures with graphics package

(2) Using psfig macro command

First of all, you need to add the following in the file description of latex document:

/usepackage{psfig}

Then, it is quoted in the place where the picture needs to be inserted:
/ psfig {figure = picture file name, height = height} or / psfig {figure = picture file name, width = width}
where “height” and “width” refer to the height and width of the picture you want to print, and the unit bit must be given, which can be centimeter (CM) or inch (in), The image file name in the above command refers to the file name of the image file to be inserted. The image must be in EPS format

(3) use the epsfig macro command

The usage of epsfig macro command is exactly the same as that of psfig. The specific method is as follows:
first, add the following in the file description of latex document:

/usepackage{epsfig}

Then reference where you want to insert the image:

/ epsfig {figure = picture file name, height = height} or / epsfig {figure = picture file name, width = width}

The “height” and “width” refer to the height and width of the picture you want to print. The unit must be given, which can be centimeter (CM) or inch (in). The height and width can also be in the above format

The image file name in the above command refers to the file name of the image file to be inserted, and the image must be in EPS format

        

(4) Using EpsF macro command

The usage of EpsF macro command is as follows: first, add the following in the file description of latex document:

/usepackage{epsf}

Then, you can refer to:
/ epsfxsize = width / epsffile {image file name} or / epsfysize = height / epsffile {image file name} where you want to insert the image

The “height” and “width” refer to the height and width of the image to be printed. The unit must be given, which can be centimeter (CM) or inch (in). The height and width can also be given in the above format, so that the length width ratio of the original image can be changed. The image file name in the above command refers to the file name of the image file to be inserted, and the image must be in EPS format

 

(5) Latex? Picture control command, position control

Latex controls the position of the image by adding an exclamation point to ignore the “aesthetic” standard.
/ begin {figure} [! HTB]
/ usepackage {float}
/ begin {figure} [H]
insert it into the corresponding position of your code.

1, insert the side-by-side subgraph
/ usepackage {subfigure}

/ begin {figure} [H]
/ centering
/ subfigure [subfigurecaption] {
/ label{ Fig.sub .1}
/includegraphics[width=0.4/textwidth]{ figurename.eps }}
/subfigure[SubfigureCaption]{
/label{ Fig.sub .2}
/includegraphics[width=0.4/textwidth]{ figurename.eps }}
/caption{MainfigureCaption}
/label{ Fig.lable }
/ end {figure}

2, control the image position
if you don’t like latex to automatically arrange the image position, you can use the float package, and then
use / begin {figure} [H].
/ usepackage {float}
1, insert JPG image
in the command line environment, use the command:
ebb figure.jpg
Generating bounding box file figure.bb .
Use the following command:
/ includegraphics [width = 0.8/textwidth]{ figure.jpg }
PDF texify can be directly compiled into PDF file.
2, insert BMP image
there is no way to insert BMP image directly. The current method is to use
gimp to convert BMP into JPG, and then insert it according to the above method. When converting, do not use windows built-in painter, as the image quality is lost too much. With gimp or
fastone image viewer, the JPG quality is the highest, and the image quality is better.
3, insert JPG and EPS images at the same time
the insert command remains unchanged. When compiling, it uses latex and dvi2pdf, and the
images in both formats can be displayed.
Insert EPS picture
use / includegraphics [options] {file} command to insert EPS picture. The following is the simplest example:
/ documentclass {article}
/ usepackage {graphicx}% using the graphicx package
/ begin {document}
/ includegraphics{ file.eps }% insert the picture, insert it according to the original size of the picture
/ end {document}
note:
(1) EPS file and Tex file are placed in the same folder, which can be called only by the file name, without writing the path.
(2) Pdflatex cannot be used at compile time, an error will occur. Even if there are no mistakes, you can’t see the diagram. We should use latex compilation to generate DVI, and then dvi2ps, ps2pdf can see the figure.
Use [options] to specify the image size:
/ includegraphics [width = 3in]{ file.eps }
set the image width to 3 inches, and the image height will be automatically scaled.
/includegraphics[width=/testwidth]{ file.eps }
set the image width to the text width.
/includegraphics[width=0.8/textwidth]{ file.eps }
set the image width to 0.8 times the text width
/ includegraphics [width = / testwidth-2.0in]{ file.eps }
set the image width to be 2 inches less than the text width.
Use [options] to specify the image rotation angle:
/ includegraphics [angle = 270]{ file.eps }
rotate the image 270 degrees.
The two options are used at the same time, separated by commas:
/ includegraphics [width = / testwidth, angle = 270]{ file.eps }

 

A few useful articles on graph problems in latex

Graphics and Colour with LaTeX 

Online guide to illustration and color use in latex

Figure’ing and picture’ing latex (PS format)

The method of inserting PS graph and xfig graph into latex

Using imported graphics in latex 2e (PS format)

The illustration in latex is discussed in detail, including basic concepts, file formats and their mutual conversion, related software, etc. in addition, how to replace the characters in PS format pictures with latex format characters is also discussed, so as to solve the problem that some application software can not use special characters such as Greek alphabet and complex mathematical formula expressions

Latex maths and graphics (PS format)

It is mainly about the method of inserting pictures and formulas into latex.

this paper introduces the method of inserting pictures and formulas into latex

About Visio to EPS

Many people are used to drawing with Visio (including me), but Visio can’t export EPS format, so they have to rely on third-party software. Save it as *. EMF format through Visio, and then open it with OpenOffice draw to export it to EPS format. When exporting, you need to select the open image, so that after exporting EPS, only the content of *. EMF image will be included, and there will be no large blank. But the EPS image exported by this method will be out of shape, for example, the straight line will often be intermittent, and the “computer” shape I added in Visio will also have inexplicable shadows. Or maybe I didn’t set it up.

There is another better solution, the EPS file exported is perfect. In other words, the Visio graphics are printed into PDF by acrobat printer, and then cut by gsview (gsview4.8). The specific process is as follows:

1 edit the image file and save it as PDF file

Install acrobat, print the edited picture as PDF file under Visio and word

 

2 to EPS file

Open PDF file in acobat and select Save as EPS file

 

3. Reduce EPS files

Open EPS file with gsview, select File — & gt; PS to EPS, select auto cut, and save it as another *. EPS file