Professional Latex: Write high-quality documents in Linux

Source: Internet
Author: User
Professional Latex: Write high-quality documents in Linux

Document options

<Tr valign = "TOP"> <TD width = "8"> </TD> <TD width = "16"> </ TD> <TD class = "small" width = "122"> <p> <SPAN class = "Ast"> the required JavaScript document options are not displayed </span> </P> </TD> </tr>


Send this page as an email


Level: elementary

Xiao wenpeng (xiaowp@263.net), Master, Department of Computer Science, Beijing University of Technology

October 01, 2003

Although OpenOffice, kword, and other word processing software in Linux are similar in functionality to Microsoft Word, there are still many shortcomings in ease of use and availability, it is not realistic to directly use them to generate high-quality documents. This article describes how to use latex, a professional typographical system, to compile and generate high-quality scientific papers in Linux.

I. Introduction

The continuous advancement of computer technology has promoted the rapid development of all walks of life and led to revolutionary changes in many industries. The traditional printing and publishing industry has gradually replaced the era of lead and fire, computer typographical systems were widely used. Currently, many typographical systems, large and small, have their own characteristics and applicability. For example, PageMaker is suitable for professional publishers, however, it is also appropriate for common users to use Word, WPS, and so on in the case of less demanding manuscripts. However, if you want to use WYSIWYG software such as Word to orchestrate academic papers or scientific documents, once you encounter complicated mathematical formulas and special characters, the results are also unsatisfactory. In this case, using Tex is a good choice. It is a convenient and low-cost Professional-level typographical system. When composing papers, reports, and books, its output quality is not inferior to that of the expensive large-scale computer specialized typographical system, and in some aspects (such as the arrangement of mathematical formulas) is still the best system of current typographical quality.

Tex is particularly suitable for the layout of scientific papers and books. It can be used to generate almost identical works with printed materials on the computer, it is widely used abroad for arranging books, archives, dissertation and private letters, as well as various complex formulas, directories, indexes and references. As the use of tex can easily complete the typographical work of high-quality scientific and technical documents, and can be expanded and modified according to the author's requirements, it has gradually attracted the attention of the press and scientific and technical workers from various countries, it is regarded as the most powerful system in terms of typographical mathematical formulas in the world, and is designated as a standard paper Arrangement Software at various international conferences.

People with a little experience will know that even if the best word processing software prints out the results, it will be different from what we see on the screen. However, the tex system outputs a DVI (device independent) file that is not related to the device. Therefore, whether it is on a Needle printer, an inkjet printer, a laser printer, or a photoprinter, the results are exactly the same, but the resolution of text or graphics varies slightly with the settings. In a sense, Tex is truly "What you see is what you get ".



Back to Top

Ii. Tex System

The inventor of the tex system is Donald E. professor knuth, a senior in the academic field of computer science, is also the author of the prestigious computer programming series, the art of computer programming, the emergence of Tex is closely related to the world-famous book on computer theory. In 1977, when the press asked Professor knuth to make a revision of his masterpiece "Art of computer programming" in 1960s, he felt that there were various inconveniences in manual modification of the original draft, as a result, he put down his work and began to design a high-quality computer typographical system. Professor knuth, who originally planned to spend only half a year improving typographical technology and continuing to write, finally spent ten years of effort and finally developed the world-famous tex system.

Unlike other computer typographical systems, when using Tex to orchestrate a document, in addition to entering the body content, you also need to add some typographical commands, these commands are not added by the editors, but by the authors themselves. The layout commands provided by the tex system are very flexible. The authors can directly use these commands, or use existing functions to define new layout commands to adapt them to the needs of specific scenarios.

Like the Linux kernel, Tex is only a core technology. In actual application, it is often necessary to continue development based on tex. The first tex system provided more than 300 basic commands, which were powerful but not easy to use. Professor knuth defined more than 600 composite commands on the basis of these basic commands to form a macro package named Plain Tex. Unfortunately, due to lack of compatibility with ordinary PCs, therefore, it is not widely spread.

Although plain Tex is more convenient than the original Tex, it focuses only on how to typeset layers and requires a large number of commands when composing complex formulas, many typographical and programming skills are required to explore its deep functions. Fortunately, the tex system provides a very powerful macro definition function. Therefore, many people begin to perform secondary development on the Tex System and generate derivative versions of the tex system, among them, the most famous ones are the AMS-Tex developed by the American Society of Mathematics (AMS) and the latex developed by American computer scientist Leslie Lamport in early 1980s. The former is suitable for the complex mathematical formula of typographical layout, the latter is suitable for typographical general articles and books. Latex provides a complete set of advanced commands required to generate complex documents, so that even if the author has no knowledge of complex typographical and programming, the powerful functions provided by the tex system can be fully utilized, you can easily complete titles, chapters, tables, directories, indexes, formulas, charts, and other la S.

With the gradual popularization of latex, it has been extended in many fields that were not originally imagined. To establish a unified standard, Leslie Lamport, Frank mittelbach, Chris Rowley, And Rainer sch? PF started its project latex3 in 1989 to create an optimal command set. The first milestone of this project was latex2e released in 1994, which is the current standard version before latex3 appeared.

For ease of installation and use, some people package the Tex basic system and add some practical tools to make various Tex Release versions available to others, among them, miktex, emtex, pctex32, fptex, and tetex are common. Most of them are free software and can be downloaded free of charge from the Internet.



Back to Top

3. Latex typographical Process

When using latex for formatting, it usually takes steps 1 to get the output result from the input text to the printer.

Figure 1 latex typographical Process

  • Edit

    Write a document (source file) in the editor and insert a typographical command. Note that the source file must be in plain text format and usually uses. Tex as its extension (such as hello. Tex ). In Linux, we recommend that you use the xemacs or Vim Editor, which can recognize latex syntax and highlight keywords in the latex command.

  • Compile

    If there is no syntax error in the generated latex source file, you can use the latex command to compile and generate the DVI file:

    [xiaowp@xpcdev latex]$ latex hello.tex

    During the processing, latex displays the page number and possible errors and warnings. If an error occurs during this process, it indicates that some typographical commands in the source file are incorrect, modify the source file again. After latex completes the processing, a hello. DVI file, which is not related to the device. It consists of formatted text and the required font information, but is irrelevant to the features of the printer to be used, this file is also called a Metafile ).

  • View
    You can display the DVI file on the computer screen to check whether the file content or typographical results meet the requirements before printing the output or plate layout, the latex source file should be modified again. In Linux, there are many software programs that can be used to view DVI files. The most commonly used is xdvi in the X-Window environment. The following command can be used to view hello. DVI: [xiaowp @ xpcdev latex] $ xdvi hello. because the DVI file is not related to the device, the result displayed on the screen using xdvi is not affected by factors such as the output device, operating system, and hardware environment.
  • Print

    The information in the DVI element file is eventually converted into a form that can be output on a specific printer. This process is completed by a print driver, which is related to a specific printer. For example, in Linux, you can use the following command to send hello. DVI to the whirlpool laser printer for printing:

    [xiaowp@xpcdev latex]$ dvihp hello.dvi

  • Output

    In many cases, the DVI files obtained by using latex do not always need to be printed, but are converted into a more readable format, such as PDF (Portable Document Format) or PS (postscript ), the latex system provides tools to convert these formats. To convert "Hello. DVI" to "hellower" and "hello. Ps", run the following commands:

    [xiaowp@xpcdev latex]$ dvipdf hello.dvi 
    [xiaowp@xpcdev latex]$ dvips hello.dvi -o



Back to Top

Iv. Latex system installation

Professor knuth selflessly contributed the source code of the tex system, making it a free Free Software. Currently, the tex system has many release versions, each of which is a collection of a set of tools, it generally includes Tex, latex, dvipdf, dvips, and vertex Tex. Texlive is a Tex release provided by the tug (Tex user group) to its members. It contains a Tex system that can run in most operating systems, as well as supporting font libraries and various macro packages, you can find the latest message of texliveon the website http: // www.tug.org/texlive.

Texlive is released in the form of a CD image (ISO), On the ctan official website (http://www.ctan.org) can download to the latest compressed package texlive7-20020604-cd1.iso.bz2and texlive7-20020604-cd2.iso.bz2, the two are applicable to different operating systems. For the Linux operating system, download the texlive7-20020604-cd1.iso.bz2 file and decompress it using the following command:

[root@xpcdev texlive]# bzip2 -d texlive7-20020604-cd1.iso.bz2

After obtaining the texlive7-20020604-cd1.iso file, you can either burn it to CD or load it as a file system using the mount command:

[root@xpcdev texlive]# $mount -t iso9660 -o ro,loop texlive7-20020604-cd1.iso /mnt/texlive

Texlive is easy to install. First, copy the bin and texmf subdirectories in the root directory of the disc to the hard disk:

[root@xpcdev texlive]# mkdir /usr/local/texlive
[root@xpcdev texlive]# cp /mnt/texlive/bin/ /usr/local/texlive/ -R
[root@xpcdev texlive]# cp /mnt/texlive/texmf/ /usr/local/texlive/ -R

Then, add the directory where the tex system executable program is located to the environment variable path of the current user to complete the installation:

[xiaowp@xpcdev latex]$ export PATH=/usr/local/texlive/bin/i386-linux/:$PATH

After texlive is installed, enter the Tex command in the command line mode. If the following prompt is displayed, the tex system is working properly:

[xiaowp@xpcdev latex]$ tex
This is TeX, Version 3.14159 (Web2C 7.3.7x)
**

Enter/relax/Bye to exit Tex, and then you can use latex in Linux to orchestrate high-quality documents.



Back to Top

V. Latex Document Processing

The latex document (the source file used for typographical editing) contains two parts: the body, the content that requires typographical output, and the typographical control command, it is used to control layout styles, font fonts, and other formats. They are strings guided by the Backslash.

The basic format of latex is as follows:

/Documentclass [Option] {class}

Global commands and definitions

/Begin {document}

Local Command and body

/End {document}

Each latex document contains two parts: the introduction (preamble) and the body (body. An introduction is a set of commands that specify global parameters for the entire document, such as the page format, text size, page number, header, and footer. The introduction must contain the/documetclass command to specify the Document Layout type. Latex provides four basic layout types: Book and article) report and letter can select an appropriate type based on your needs.

The introduction part of latex documents must contain the/documentclass command, which is usually the first command in the introduction. If there are no other commands in the introduction, latex selects a standard value for the row width, margin, section interval, page height, and width. The introduction ends with/begin {document}. All the content of this command is interpreted as the body, which consists of text and typographical commands mixed in it. Compared with the introduction, commands in the body can only play a partial role, that is, they only act on some texts, such as indentation, formulas, fonts, and font sizes. The text in the latex document ends with the/end {shortnet} command, which is usually the end of the entire article.

Latex is a free-format file. When you input the source file, you do not have to consider the length of each line or the number of blank words. Latex is automatically organized according to the typographical command. The following is a simple latex document:

/documentclass[12 pt]{article}
/begin{document}
Hello, world! {/LaTeX} can typeset equations like
/begin{equation}
/int^{2/pi}_0/sin^2/theta d/theta = /frac{1}{2}
/end{equation}
/begin{equation}
/left[
{/bf X} + {/rm a} / /geq/
/underline{/hat a} /sum_i^N /lim_{x /rightarrow k} /delta C
/right]
/end{equation}
very cool!
/end{document}

After saving the preceding document as hello. Tex, use the latex command to process it:

[Xiaowp @ xpcdev latex] $ latex hello. Tex
You can use xdvi to view the typographical result in Linux. The result is as follows:
[Xiaowp @ xpcdev latex] $ xdvi hello. DVI

Figure 2 Latex typographical Effect



Back to Top

Vi. Summary

Latex is a well-known professional typographical software in academia. It is especially suitable for the arrangement of scientific papers and books. It enables the author to focus on the content of writing, instead of sticking to the details of how each word should be displayed, there is no software that matches latex in the complex formatting of mathematical formulas. Latex is a free software like Linux. with latex, a professional typographical system, you can generate higher quality documents than word processing software in Linux.

References

  • Texlive is a Tex release provided by tug that provides information about Tex and texlive on its official website http://www.tug.org.

  • Http://www.latex-project.org is the official website of latex, which contains a large number of articles related to latex, and can learn about the latest latex3 project progress.
  • Tobias oetiker's article the not so short introduction to latex gives a comprehensive introduction to the latex system. You can find this article on the website http://www.ctan.org/?archive/info/l.
  • Edited by Chen Zhijie, latex entry and improvement, Beijing: Higher Education Press, 2002

About the author

 

Xiao wenpeng is a master's degree in computer science at Beijing University of Technology. He is mainly engaged in the research of operating systems and distributed computing environments and loves Linux and python. You can get in touch with him through xiaowp@263.net.

 

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.