LaTeX a few common ways to insert a picture in a document _latex

Source: Internet
Author: User
Latex typically only support graphics files inserted in EPS (encapsulated PostScript) format, you should try to get the EPS format file of the picture before inserting the latex document.

Various applications under UNIX can output the results to PS format, and most software can also output EPS format. If the software can only output PS format and can not output the results of EPS format, you can use the PS2EPSI command to convert it to EPS format, reference to the man ps2epsi description. If the format of the picture file is a bitmap graphic file, you can convert the display and convert tools of the image magick package to a PS or EPS format file. See the man page and instructions for use

The output of Windows software becomes ps/eps file: see the instructions in the "How to convert the output of software in a Windows system to a file in PS and EPS format" in this website, "The use of Windows systems in the High energy physics lab."

Inserting a picture in a latex document is accomplished by using some latex graphics processing macro commands, and there are many macro commands that support inserting an EPS-formatted graphics file in a latex document, mainly: (1) using Includegraphics Macro command (GRAPHICX package)
First you need to add the file Description section of the Latex document:
/USEPACKAGE{GRAPHICX}
Then refer to the place where you want to insert the picture:
/includegraphics[height= height]{picture file name} or:/includegraphics[width= width]{picture file name}
The height and width are the height and width that you want the picture to print, and you must give the unit, available in cm (cm) or inches (in). Height and width can also be given in the same format, which changes the length of the original image. The image file name in the above command refers to the file name of the picture file you want to insert, and the picture must be in EPS format.
You can also rotate a picture when you insert a picture with the Includegraphics Macro command of the GRAPHICX package by:
/includegraphics[height= height][angle= rotation angle]{picture file name}
The inserted graphics are usually in the form of EPs, PDF, JPG, PNG, and so on, assuming the name is fig, put it in the same directory as your Tex document.
1, the pilot Word area add a sentence/usepackage{graphicx}
2, if you want to insert inline graphics, direct use
/includegraphics[width=5in]{fig},
The suffix name is not added.
This width is my most commonly used option, and can be changed to other.
3, if you want to insert floating graphics, use
/BEGIN{FIGURE}[HTBP]
/centering/includegraphics[width=3.5in]{fig}
/caption{something}/label{fig:1}
/end{figure}
4, if it is EPS graphics, the compilation process is Latex, dvips, ps2pdf.
If it is a pdf jpg png graphic, the compilation process is Pdflatex. Using the Includegraphics Macro command (graphics package):

Inserting a picture using the graphics package is more cumbersome.
(2) Using PSFIG Macro command

First you need to add the file Description section of the Latex document:/usepackage{psfig}
Then refer to the place where you want to insert the picture:
/psfig{figure= picture filename, height= height} or:/psfig{figure= picture filename, width= width}
The height and width are the height and width that you want the picture to print, and you must give the unit, available in cm (cm) or inches (in). Height and width can also be given in the same format, which changes the length of the original image. The picture filename in the above command refers to the file name of the picture file you want to insert, and the picture must be in EPS format.

(3) Using EPSFIG Macro command
EPSFIG macro commands are used in exactly the same way as Psfig, as follows:
First you need to add the file Description section of the Latex document:
/usepackage{epsfig}
Then refer to the place where you want to insert the picture:
/epsfig{figure= picture filename, height= height} or:/epsfig{figure= picture filename, width= width}
The height and width are the height and width that you want the picture to print, and you must give the unit, available in cm (cm) or inches (in). Height and width can also be given in the above format, which changes the length of the original image. The picture filename in the above command refers to the file name of the picture file you want to insert, and the picture must be in EPS format.


(4) Using EPSF Macro command

Use the EPSF Macro command by: First you need to add the file Description section of the Latex document:/USEPACKAGE{EPSF}
Then refer to the place where you want to insert the picture:
/epsfxsize= width/epsffile{picture file name} or:/epsfysize= height/epsffile{picture file name}

The height and width are the height and width that you want the picture to print, and you must give the unit, available in cm (cm) or inches (in). Height and width can also be given in the above format, which changes the length of the original image. The image file name in the above command refers to the file name of the picture file you want to insert, and the picture must be in EPS format.

(5) LaTeX Picture Control command, position control

LaTeX control the position of the picture, is to add exclamation point to ignore the "aesthetic" standard.
/BEGIN{FIGURE}[!HTB]
/usepackage{float}
/BEGIN{FIGURE}[H]
Insert your code in the appropriate position.

1, insert a parallel child graph
/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 picture position
If you don't like the latex to automatically arrange the picture position, you can use the float package, and then
With/begin{figure}[h].
/usepackage{float}
1, insert jpg picture
In the command line environment, use the command:
Ebb Figure.jpg
Generate bounding box file FIGURE.BB.
Use the following command:
/includegraphics[width=0.8/textwidth]{figure.jpg}
You can use PDF texify to compile directly into a PDF file.
2, insert BMP picture
You have not found a way to insert a BMP picture directly. Now the method is to use
GIMP converts BMP to JPG and inserts it in the above method. When converting, do not
With Windows Painter, the picture quality is lost too much. With GIMP or
Fastone image Viewer, select JPG Quality as the highest, after conversion
The picture is of good quality.
3, insert jpg and EPS pictures at the same time
The inserted command does not change. Compile-time using Latex, dvi2pdf, two-form
Pictures can be displayed.
Insert an EPS picture
Use the/includegraphics[option]{file} command to insert an EPS picture. Here is one of the simplest examples:
/documentclass{article}
/USEPACKAGE{GRAPHICX}% use Graphicx package
/begin{document}
/includegraphics{file.eps}% Insert Picture, insert by picture original size
/end{document}
Attention:
(1) The EPS file and the Tex file are placed in the same folder, can be called only by file name, not write path.
(2) You cannot use Pdflatex at compile time, there will be an error. Even if there is no error, the diagram is not visible. You should use Latex compilation to generate DVI, and then dvi2ps,ps2pdf can see the diagram.
Use options to specify picture size:
/includegraphics[width=3in]{file.eps}
Sets the picture width to 3 inches, the picture height will automatically scale.
/includegraphics[width=/testwidth]{file.eps}
Sets the width of the picture to the width of the text.
/includegraphics[width=0.8/textwidth]{file.eps}
Sets the width of the picture to 0.8 times times the width of the text
/includegraphics[width=/testwidth-2.0in]{file.eps}
Set picture width 2 inches less than text width.
Use options to specify the rotation angle of the picture:
/includegraphics[angle=270]{file.eps}
Rotate the picture 270 degrees.
Two options are used at the same time, separated by commas in the middle:
/includegraphics[width=/testwidth, Angle=270]{file.eps}

Several useful articles about chart issues in Latex
Graphics and colour with LaTeX online instructions for illustration and use of colors in LaTeX.
Figure ' ing and picture ' ing LaTeX (PS format) inserts PS and xfig diagrams in LaTeX.
Using imported Graphics in latex2e (PS format) a detailed discussion of illustrations in Latex, including basic concepts, file formats and their mutual conversion, software, and so on. And how to replace the characters in the PS format picture with the latex format characters to solve the problem that some applications cannot use special characters such as the Greek alphabet and expressions of complex mathematical formulas.
The LaTeX Maths and graphics (PS format) is primarily about inserting pictures and formulas into the LaTeX.

About Visio turning EPS

Many people are used to drawing in Visio (including me), but Visio cannot export the EPS format, so it has to be aided by Third-party software. Save with Visio as a *.emf format and then open with OpenOffice Draw, which can be exported to EPS format. When you export, you need to select an open picture, so that after you export the EPS, you will only include the contents of the *.emf picture. However, an EPS image exported in this way will get out of shape, such as a line that is often choppy, and the "Computer" shapes I have added to Visio will have a baffling shadow. Or maybe I didn't set it up well.

There is another better solution, and the exported EPS file is perfect. That is, the Visio graphic is printed as a PDF through the Acrobat printer, and then cut by GSview (gsview4.8 ). The specific process is as follows: 1 edit picture file, save as PDF file installation Acrobat, under Visio and WOD to print the edited picture as PDF file can   2 convert to EPS file under Acobat open PDF file, select Save as EPS file   3 on EPS file reduction with GSview open EPS file, select File-->ps to EPS, select Automatic Cut, save as another *.eps file can

from:   http:// Hepg.sdu.edu.cn/service/tips/latex/latexfig.html#top
Http://liqunsun.spaces.live.com/blog/cns! 285a08b51269f219!109.entry
http://blog.csdn.net/shenlan211314/article/details/6251776

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.