Getting Started With LATEX Martin Erickson October 28, 2009

The purpose of this section is to help you begin using LATEX (the most popular version of TEX), a mathematical typesetting system in which you can create, edit, typeset, and view documents containing mathematics. The manual contains simple examples for you to try. LATEX is easy to learn and use and has the nice feature that you can quickly start producing output and then learn more as you need to.

Contents 1. What is TEX ? 2. What is LATEX ? 3. How to create and typeset a simple document 4. How to add basic information to your document 5. How to do elementary mathematical typesetting 6. How to do advanced mathematical typesetting 7. How to learn more References

1

What is TEX ?

TEX is a typesetting system that was invented by Donald Knuth “for the creation of beautiful books—and especially for books that contain a lot of mathematics.” [7] TEX is especially useful for typesetting mathematical documents and other documents containing complicated symbols and formatting. TEX is a markup language. In a markup language, the user specifies how the document is to look via commands. The typesetting software interprets the commands in order to produce the pages.

1

2

What is LATEX ?

LATEX is an easy-to-use version of TEX that was designed by Leslie Lamport. “Think of LATEX as a house built with the lumber and nails provided by TEX.” [10] In this guide, all examples are written in LATEX. LATEX is now extremely popular in the scientific and academic communities, and it is used extensively in industry. It has become a lingua franca of the scientific world; scientists send their papers electronically to colleagues around the world in the form of LATEX input. [10]

3

How to create and typeset a simple document

In this section you will learn how to use LATEX to create and typeset a basic LATEX document. The smallest LATEX document file consists of a \documentclass command, a \begin{document} command, an \end{document} command, and perhaps a line of text. Note. In TEX, commands are preceded by the \ (backslash) symbol. Commands are casesensitive. Example 3.1. Here is a minimal LATEX file. \documentclass{article} \begin{document} This is some \end{document}

sample text.

Note. The article document class is appropriate for many writing projects. Note. TEX ignores extra spaces in a file. To create the file, go to the MENU BAR, click on FILE, and drag the cursor to NEW. Now type the above lines. To save the file, go to the MENU BAR, click on FILE, and drag to SAVE. You will have the option of giving your file a name; let’s say you name it myfile.tex. To typeset the file, go to the TOOLBAR and click on TYPESET. (The entry in the window to the left of TYPESET should first be set to LATEX.) The typesetter will produce a file called myfile.dvi (dvi stands for ‘device independent’). The dvi file is displayed by the viewer. The displayed document should look like this: This is some sample text. Congratulations! You have created and typeset your first document.

2

4

How to add basic information to your document

In this section you will learn how to add title, author, and date information to your documents. You will also learn how to create a numbered list (for use, say, in a homework paper consisting of a list of problem solutions), and you will learn how to emphasize text.

Title, author, and date commands You can add a title, author, and date to your document with \title, \author, \date, and \maketitle commands. Try the following example! Example 4.1. This file adds a title, author, and date to the file in Example 4.1. \documentclass{article} \title{My Document} \author{A. Student} \date{December 3, 2001} \begin{document} \maketitle This is some \end{document}

sample text.

Note. The part of the file preceding the \begin{document} command is called the preamble. After saving the file and typesetting it, the output should look like this:

My Document A. Student December 3, 2001 This is some sample text.

The enumerate environment If your document is a homework assignment, you may want it to contain a list of problem solutions. This can be accomplished with the enumerate environment. The enumerate environment is opened with a \begin{enumerate} command and closed with an \end{enumerate} command. Within the environment, each item to be enumerated is preceded by an \item command.

Highlighted text Boldfaced text is produced with a \textbf or \mathbf command. Emphasized text, such as appears in a mathematical definition or a reference to a book title, is produced with an \emph command.

3

Example 4.2. This file creates a document containing a list of problem solutions. \documentclass{article} \title{My Document} \author{A. Student} \date{December 3, 2001} \begin{document} \maketitle \begin{enumerate} \item I believe that \textbf{all} real numbers are interesting. \item I have found an \emph{imaginary} number that isn’t interesting at all. \end{enumerate} \end{document} After saving the file and typesetting it, the output should look like this:

My Document A. Student December 3, 2001

1. I believe that all real numbers are interesting. 2. I have found an imaginary number that isn’t interesting at all. You now know enough about LATEX to produce beautiful non-mathematical homework papers.

5

How to do elementary mathematical typesetting

In this section you will learn how to include simple mathematical expressions in your documents.

Math mode There are several ways to put mathematical expressions into a document. The most common method is to insert a math expression between a pair of $ signs. Thus, the input $x=3$ will produce the output x = 3 (observe that the font for a math x is different from the font for a normal x). 4

∅ ∈ ∈ / ⊂ ⊆ ⊃ ⊇ ∪ ∩

\emptyset \in \notin \subset \subseteq \supset \supseteq \cup \cap

S T \ ≈ . = 6 = ≥ ≤ ∼

\bigcup \bigcap \setminus \approx \doteq \neq \geq \leq \sim

← → ⇐ ⇒ ↔ ⇔ ∼ = ∞ ∂

\leftarrow \rightarrow \Leftarrow \Rightarrow \leftrightarrow \Leftrightarrow \cong \infty \partial

÷ × ± · ◦ ∗ ··· ... 0

\div \times \pm \cdot \circ \ast \cdots \ldots \prime

Table 1: Mathematical symbols. The symbols \( and \) may be used instead of a pair of $ signs. Displayed mathematical expressions are generated with \[ and \] symbols. Thus, the input \[y=5\] produces the output y=5 (this is displayed). Note. In math mode, spaces don’t matter at all; they are ignored.

Math alphabets Greek letters are invoked by commands such as \alpha, \beta, \gamma, etc., for lower-case letters, and \Alpha, \Delta, \Theta, etc., for upper-case letters.

Math symbols The following symbols are ordinary keyboard symbols, and do not require special commands when used in math mode: + − / ( ) [ ] < > = . The symbols { and } are produced with the commands \{ and \}. Table 1 shows some frequently used mathematical symbols and the LATEX commands that generate them. Note. Certain often-encountered sets are usually indicated with boldface. For example, the set of real numbers is denoted R (produced by the command $\mathbf{R}$).

Math functions Many often-needed mathematical expressions are invoked by simple LATEX commands. For example, use \sin for sin, \log for log, \ln for ln, \lim for lim, etc.

5

Structure subscript superscript fraction square root nth root sum product integral

Command _{} ^{} \frac{}{} \sqrt{} \sqrt[n]{} \sum_{}^{} \prod_{}^{} \int_{}^{}

Example input x_{10} 3^{20} \frac{a+b}{x+y} \sqrt{x+y} \sqrt[3]{x+y} \sum_{i=1}^{10}i^2 \prod_{i=1}^{10}i^2 \int_{0}^{\infty}x~dx

Example output x10 320 a+b x+y √ x+y √ 3 x+y P10 2 i=1 i Q10 2 i=1 i R∞ x dx 0

Table 2: Mathematical structures.

Math structures Some useful mathematical structures are listed in Table 2. For example, to produce limx→∞ , use the command $\lim_{x \rightarrow \infty}$. Example 5.1. Here is a file containing some simple mathematical expressions. \documentclass{article} \title{My Document} \author{A. Student} \date{December 3, 2001} \begin{document} \maketitle \begin{enumerate} \item Let $x=3$.

Then $x^2=9$.

\item If $\sin \theta = 0$ and $0 \leq \theta < 2 \pi$, then $\theta=0$ or $\theta=\pi$. \item It is not always true that \[\frac{a+b}{c+d}=\frac{a}{c}+\frac{b}{d}.\] \end{enumerate} \end{document} After saving the file and typesetting it, the output should look like this:

6

delimiter ( [ { |

command \left( \left[ \left\{ \left| or \right|

delimiter ) ] } k

command \right) \right] \right\} \left\| or \right\|

Table 3: Delimiters.

My Document A. Student December 3, 2001 1. Let x = 3. Then x2 = 9. 2. If sin θ = 0 and 0 ≤ θ < 2π, then θ = 0 or θ = π. 3. It is not always true that a b a+b = + . c+d c d

6

How to do advanced mathematical typesetting

In this section you will learn how to include some complex mathematical expressions in your documents.

Delimiters Sometimes, you need parentheses that are larger than normal, such as those in the expression 

a+b+c x+y+z

1/3 .

Large delimiters (i.e., parentheses, braces, brackets, etc.) are produced with \left and \right commands. For example, to produce the above expression, use the command \[\left(\frac{a+b+c}{x+y+z}\right)^{1/3}\]. Table 3 lists the available delimiters and the commands that produce them. Note. Delimiters must occur in left–right pairs, but the two delimiters in a pair may be different. If you want only one delimiter, say, a left brace \left\{, in a piece-wise defined function, then pair it with a period delimiter, \right., which won’t show up in the display.

7

Arrays Arrays (used in constructing matrices, for example) are created in the array environment. The array environment is opened with a \begin{array} command and closed with an \end{array} command. Attached to the \begin{array} command is a string indicating the number of columns in the array and the type of alignment in each column. For example, the string {llrr} declares that the array contains four columns, the first and second aligned on the left and the third and fourth aligned on the right. For example, to produce the matrix   a b c d use the following commands. \[ \left[ \begin{array}{cc} a & b \\ c & d \end{array} \right] \]

Multi-line expressions Multi-line expressions (such as occur in a chain of equalities) are created in the \eqnarray* environment. The environment is opened with a \begin{eqnarray*} command and closed with an \end{eqnarray*} command. Within the environment, each line may consist of three terms: two expressions and a relational symbol (e.g., = or ≤). The terms are separated by & signs. Each line (except the last) ends with a \\ command. For example, to produce the lines ex

=

x0 x1 x2 x3 + + + + ··· 0! 1! 2! 3!

e−1

=

(−1) (−1) (−1) (−1) + + + + ··· 0! 1! 2! 3!

=

1 1 1 1 − + − + ··· 0! 1! 2! 3!

0

1

2

3

use the following commands. \begin{eqnarray*} e^x & = & \frac{x^0}{0!}+\frac{x^1}{1!}+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots\\ e^{-1} & = & \frac{{(-1)}^0}{0!}+\frac{{(-1)}^1}{1!} +\frac{{(-1)}^2}{2!}+\frac{{(-1)}^3}{3!}+\cdots\\ 8

& = & \frac{1}{0!}-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots \end{eqnarray*} Note. The * in the eqnarray* environment causes the equations that are produced to be unnumbered. If you want numbered equations, use eqnarray instead of eqnarray*. Example 6.1. Here is a file containing several complex mathematical expressions. Note. When typesetting long, complicated documents, it is a good idea to input the file in small blocks, typesetting at each stage. This way, if an error occurs, you will be able to find and correct it easily. \documentclass{article} \title{My Document} \author{A. Student} \date{December 3, 2001} \begin{document} \maketitle \begin{enumerate} \item Let $\mathbf{x}=(x_1,\ldots,x_n)$, where the $x_i$ are nonnegative real numbers. Set \[ M_r(\mathbf{x}) = \left(\frac{x_1^r+x_2^r+\cdots+x_n^r}{n}\right)^{1/r}, \qquad r \in \mathbf{R} \setminus \{0\}, \] and \[ M_0(\mathbf{x})=\left( x_1 x_2 \ldots x_n \right)^{1/n}. \] We call $M_r(\mathbf{x})$ the \emph{$r$th power mean} of $\mathbf{x}$. Claim: \[ \lim_{r \rightarrow 0} M_r(\mathbf{x}) = M_0(\mathbf{x}). \] \item Define \[ V_n= \left[ \begin{array}{lllll} 1 & 1 & 1 & \ldots & 1\\ x_1 & x_2 & x_3 & \ldots & x_n\\ 9

x_1^2 & x_2^2 & x_3^2 & \ldots & x_n^2\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ x_1^{n-1} & x_2^{n-1} & x_3^{n-1} & \ldots & x_n^{n-1} \end{array} \right]. \] We call $V_n$ the \emph{Vandermonde matrix} of order $n$. Claim: \[ \det V_n = \prod_{1 \leq i < j \leq n}(x_j-x_i). \] \end{enumerate} \end{document} After saving the file and typesetting it, the output should look like this:

10

My Document A. Student December 3, 2001

1. Let x = (x1 , . . . , xn ), where the xi are nonnegative real numbers. Set  Mr (x) =

xr1 + xr2 + · · · + xrn n

1/r r ∈ R \ {0},

,

and 1/n

M0 (x) = (x1 x2 . . . xn )

.

We call Mr (x) the rth power mean of x. Claim: lim Mr (x) = M0 (x).

r→0

2. Define

    Vn =   

1 x1 x21 .. .

1 x2 x22 .. .

1 x3 x23 .. .

... ... ... .. .

1 xn x2n .. .

xn−1 1

xn−1 2

xn−1 3

...

xnn−1

    .  

We call Vn the Vandermonde matrix of order n. Claim: Y

det Vn =

(xj − xi ).

1≤i
7

How to learn more

There are many aspects of LATEX that are not discussed in this introduction, such as graphics, user-defined environments, and packages. Here are some resources for you to investigate to learn more. The definitive book about TEX is [7]. A good beginning book is [11]. In order to learn more about LATEX, an excellent place to start is [10]. Other good introductory books are [1], [5], and [6]. To go further, you may want to consult [2], [4], and [3], which are all advanced books. Some useful websites about TEX and LATEX are (“The Comprehensive TEX Archive Network”), (“The TEX Users Group”), and (“LATEX Help”). Information about PCTeX (a user-friendly LATEX environment) is available at 11

(“PCTeX HomePage”). Good general references about mathematical writing and typesetting are [9], [8], and [12].

References [1] A. Diller. LATEX: Line by Line: Tips and Techniques for Document Processing. John Wiley & Sons, New York, second edition, 1999. [2] M. Goossens, F. Mittelbach, and A. Samarin. The LATEX Companion. Addison–Wesley, Reading, second edition, 2000. [3] M. Goossens and S. Rahtz. The LATEX Web Companion: Integrating TEX, HTML, and XML. Addison–Wesley Series on Tools and Techniques for Computer Typesetting. Addison–Wesley, Reading, 1999. [4] M. Goossens, S. Rahtz, and F. Mittelbach. The LATEX Graphics Companion: Illustrating Documents With TEX and PostScript. Addison–Wesley Series on Tools and Techniques for Computer Typesetting. Addison–Wesley, New York, 1997. [5] G. Gr¨ atzer. First Steps in LATEX. Birkh¨auser, Boston, 1999. [6] D. F. Griffiths and D. J. Higham. Learning LATEX. SIAM, New York, 1997. [7] D. E. Knuth. The TEX Book. Addison–Wesley, Reading, second edition, 1986. [8] D. E. Knuth, T. Larrabee, and P. M. Roberts. Mathematical Writing. Mathematical Association of America, Washington, D.C., revised edition, 1989. [9] S. G. Krantz. A Primer of Mathematical Writing: Being a Disquisition on Having Your Ideas Recorded, Typeset, Published, Read, and Appreciated. American Mathematical Society, Providence, 1997. [10] L. Lamport. LATEX: A Document Preparation System, User’s Guide and Reference Manual. Addison–Wesley, New York, second edition, 1994. [11] W. Snow. TEX for the Beginner. Addison–Wesley, Reading, 1992. [12] E. Swanson, A. O’Sean, and A. Schleyer. Mathematics Into Type. American Mathematical Society, Washington, D.C., updated edition, 1999.

12

Getting Started With LATEX

Oct 28, 2009 - TEX), a mathematical typesetting system in which you can create, edit, ... In this section you will learn how to use LATEX to create and typeset a ...

134KB Sizes 2 Downloads 235 Views

Recommend Documents

Getting Started With LATEX
The enumerate environment is opened with a \begin{enumerate} command and closed with an \end{enumerate} command. Within the environment, each item to be enumerated is preceded by an \item command. Highlighted text. Boldfaced text is produced with a \

Getting Started with LATEX
LATEX is a computer program for typesetting documents. It takes a ..... within the text of a paragraph one should place a $ sign before and after the formula,.

Getting Started with Contract4J
are using it on your own risk. Submitting any suggestions, or similar, the ... Go to the Contract4J web-page and download the latest release. In my case it is ... Selecting the JAR files to add to the Contract4J library project's build path.

Getting Started with Contract4J
Go to the Contract4J web-page and download the latest release. In my case it is ... Selecting the JAR files to add to the Contract4J library project's build path.

Getting Started with CodeXL - GitHub
10. Source Code View . ..... APU, a recent version of Radeon Software, and the OpenCL APP SDK. This document describes ...... lel_Processing_OpenCL_Programming_Guide-rev-2.7.pdf. For GPU ... trademarks of their respective companies.

Getting Started with Go - GitHub
Jul 23, 2015 - The majority of my experience is in PHP. I ventured into Ruby, ... Compiled, Statically Typed, Concurrent, Imperative language. Originally ...

Getting Started with Project-Based Learning
and meet the immediate needs of your students rather than being in permanent crisis-mode trying to ... help us master the bigger thing step by step. Through ...

Getting Started with Protege-Frames
Jun 6, 2006 - To create a new project later, select File | New Project.... 2. Click Create ... The internal Protege system classes :THING and .... the left, at the top of the Class Hierarchy area) to delete the class, and then clicking on :THING and.

getting started with html
Aug 28, 2009 - Figure 1: A simple web page. Example 2.1. We create a minimal page. This and other examples can be created in a simple editor such as ...

Getting Started with Transact-SQL Labs - GitHub
The SQL Server Database Engine is a complex software product. For your systems to achieve optimum performance, you need to have a knowledge of Database Engine architecture, understand how query design affects performance, and be able to implement eff

Getting Started with Transact-SQL Labs - GitHub
An online video presentation. • A hands-on ... prerequisite software or making any required configuration changes. ... comfortable configuring service accounts).

Getting Started with MediaFire.pdf
Page 3 of 8. Page 3 of 8. Getting Started with MediaFire.pdf. Getting Started with MediaFire.pdf. Open. Extract. Open with. Sign In. Main menu. Page 1 of 8.

Getting Started with Transact-SQL Labs - GitHub
Create a list of all customer contact names that includes the title, first name, middle ... Customers may provide adventure Works with an email address, a phone ...

Getting Started with Transact-SQL Labs - GitHub
challenges in the Lab Solution folder for this module. ... and customer ID. ... Note: Support for Sequence objects was added to Azure SQL Database in version 12 ...

Getting Started with Transact-SQL Labs - GitHub
In this lab, you will use SELECT queries to retrieve, sort, and filter data from the AdventureWorksLT database. Before starting this lab, you should view Module 2 ...

Getting Started with Transact-SQL Labs - GitHub
SQL Database, a cloud-based relational database service. This is the .... Page 5 .... local network or computer that's preventing the connection. If you're using a ...