11.07.2015 Views

LATEX Tips - eDisk

LATEX Tips - eDisk

LATEX Tips - eDisk

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

L A TEX <strong>Tips</strong>Professor ResslerSeptember 19, 2013This document has some examples and suggestions intended to make yourTEXing go more smoothly. You have my permission to paste source code forthis document into your L A TEX document.1 Math modeIf you look at a math textbook or journal you will see that mathematical expressionsare typeset differently than other text. Letters are italicized, the spacingis different, and there are lots of symbols. For example, compare the outputfor y=mx+b (clunky, not in math mode) and y = mx + b (looks good, in mathmode). You manage this difference in L A TEX by typing mathematics in the mathenvironment.The simplest way to use math mode is to enclose a mathematical expressionin dollar signs. You can see this in the source code for math mode equation in theprevious paragraph. I recommend putting mathematical expressions betweenthe pair \( \), as in ∫ π− cos nxsin nxdx = ∣ π0 n. This slightly more complicated0construction uses different symbols to begin and end math mode, a feature thatis useful when you are debugging L A TEX code.Check your output after you type your work. Every variable should be italicized,while functions (like the sine function above) and English words shouldnot be italicized.2 Emphasized wordsYou can produce an italicized word in L A TEX by typing \emph{word you wish to emphasize.} around the3 SymbolsYour L A TEX program should come with some kind of template for making mathsymbols. In TeXShop you can select the pull-down menu Window/LaTeXPanel... to open a clickable panel with lots of symbols and environments.1


L A TEX <strong>Tips</strong>Prof. ResslerThere are lots of ways to find the command for making a new math symbol.One way is to look up section 3.10 of “The (Not So) Short Introduction toL A TEX2e” from the L A TEX project website. The section includes lists for makingmath accents (such as â), Greek letters (α), binary relations (⊆), arrows (→),and many other symbols. You can also find L A TEX symbol commands on-line;for example, try searching for “latex real numbers.” Another fun way to findcode for a math symbol it to draw the symbol you want at the website Detexify.Table 1 has some useful L A TEX symbols.Table 1: L A TEX symbolsto produce type (in math mode)Z, R \mathbb{Z}, \mathbb{R}≠\neq≤, ≥ \leq , \geq∼\sim|, ∤ \mid, \nmid∈\in⊆\subseteq∅∑\emptysetnj=1\sum_{j=1}^{n}· \cdotmax, min \max, \minsup, inf \sup, \inf4 FunctionsYou can instruct L A TEX to typeset a function in math mode by typing \functionname.For example, in math mode typing log x produces logx, but typing \log x producesthe much more handsome log x.5 Displayed equationsUse the equation* environment to produce a displayed equation such asΓ(z) =∫ ∞0t z−1 e −t dt.L A TEX automatically uses math mode for everything in a displayed equationenvironment.If you want to refer to an equation later, use the equation environment.This produces a number at the right margin, as in∫∇f · dr = f (r(b)) − f (r(b)) . (1)C2


L A TEX <strong>Tips</strong>Prof. ResslerL A TEX produces equation numbers by default; the asterisk in equation* suppressesthe number. In order to refer to an equation later you should label itand use the label; see the \label command in the source code for (1) and the\eqref command in the code for this sentence.6 Multiline EquationsL A TEX has lots of ways to write a displayed equation on several lines. I recommendusing the align environment (and align* if you do not want to printequation numbers) provided by the amsmath package and our homework classfile.For example, in a recent paper [1, p. 1403] I wrote that a nontrivial elementM = ( a bc d)(of a Hecke group) fixes the complex number(s)z = a − d ± √ (d − a) 2 + 4bc2c= a − d ± √ (a + d) 2 − 4,2cwhere I used the fact that ad − bc = 1 for the second equality. The & in thecode tells L A TEX where to align subsequent equations; one should precede eachequal sign. The \\ in the code tells L A TEX to move to a new line; note that thelast line does not end with \\.Sometimes a multiline equation has parts so long that the equation does notfit between the margins, or even the page. For example, you can see the problemwith(x + 1) 5 − 3(x + 1) 4 = (x 5 + 5x 4 + 10x 3 + 10x 2 + 5x + 1) − 3(x 4 + 4x 3 + 6x 2 + 4x + 1)= x 5 + 2x 4 − 2x 3 − 8x 2 − 7x − 2.A solution is to use the line return command \\ force L A TEX to start a new lineat the first equal sign. You must also type an additional & tell L A TEX where toput the equal signs on the line. A better way to typeset the equation above is(x + 1) 5 − 3(x + 1) 4= (x 5 + 5x 4 + 10x 3 + 10x 2 + 5x + 1) − 3(x 4 + 4x 3 + 6x 2 + 4x + 1)= x 5 + 2x 4 − 2x 3 − 8x 2 − 7x − 2.You can put the alignment character & anywhere in the line; it becomes invisiblewhen typeset.7 Justification TagsIn certain proofs we will be very explicit about the reason for each step. Oneplace for this is in a sequence of calculations given by a string of equations.3


L A TEX <strong>Tips</strong>Prof. ResslerWhen you type your own proof in this style you should use displayed multilineequations (described above) and place the justification at the right margin usingthe command \tag*{}, which produces text (whatever you type inside the {}) atthe right margin. Using this format we could justify the steps in the calculation(m + n)p = p(m + n) Comm. Prop. Mult.= pm + pn Dist. Prop.= mp + np. Comm. Prop. Mult.8 ListsUse the L A TEX list environment enumerate to type propositions with parts. Forexample, the two parts of Proposition 1.22 in The Art of Proof are1. For all m ∈ Z, −(−m) = m.2. −0 = 0.You can see that the enumerate environment numbers the items with Arabicnumerals followed by a period. You can instruct L A TEX to label items in thesame way as The Art of Proof (lower case Roman numerals inside parentheses)by placing the command\renewcommand{\labelenumi}{(\roman{enumi})}inside the enumerate structure, as in(i) For all m ∈ Z, −(−m) = m.(ii) −0 = 0.The command\renewcommand{\labelenumi}{(\alph{enumi})}will produce lower case alphabetical labels, as in(a) For all m ∈ Z, −(−m) = m.(b) −0 = 0.If you want to typeset only part of a list (say, to prove one part of a proposition)you can use the command\setcounter{enumi}{n}to reset the counter in the list environment to n. For example, we can list onlythe second item from above as(b) −0 = 0.4


L A TEX <strong>Tips</strong>Prof. Ressler9 Proof casesYou should use L A TEX’s list environment itemize to organize a proof that usescases. The itemize environment normally produces bulleted lists, as in• First item.• Second item.When you do a proof by cases, you should replace the bullets with case numbers.The source code\begin{itemize}\item[Case 1:] First case.\item[Case 2:] Second case.\end{itemize}will produceCase 1: First case.Case 2: Second case.10 DelimitersDelimiters are symbols that group mathematical expressions in equations. Theones we use most frequently are parentheses ( ), braces { } brackets [ ], andabsolute value bars | |.It can look silly to enclose a big expression with small delimiters, as in theequation2xA(|z| 2 + 1 ) + B( 2y|z| 2 + 1 ) + − 1C(|z|2 |z| 2 ) + D = 0. (2)+ 1You can fix this by typing the commands \left and \right immediately infront of the left and right delimiters, respectively. Doing that to equation (2)produces( ) ( )2x2yA|z| 2 + B+ 1 |z| 2 + C+ 1( |z| 2 )− 1|z| 2 + D = 0.+ 1You must pair the commands \left and \right or L A TEX will complain. Ifyou want to use a single delimiter-like symbol you can do it by using . (period)as an empty delimiter symbol. For example, you can produce∫ π0sin nxdx =− cos nxnL A TEX uses braces for lots of commands, so if you want to typeset braces youmust type \{ and \}.∣π0.5


L A TEX <strong>Tips</strong>Prof. Ressler11 Piecewise FunctionsUse the amsmath package for a nice way to write piecewise functions. For example,in display mode the code|x| =\begin{cases}x, & \text{if } x \geq 0, \\-x, & \text{if } x < 0.\end{cases}produces|x| ={x, if x ≥ 0,−x, if x < 0.12 Multiline subscriptsUse the command \substack{ } to produce multiline subscripts. For example,in display mode the code\lim_{\substack{x \rightarrow x_{0} \\y \rightarrow y_{0}}}u(x,y)produceslimx→x 0y→y 0u(x, y).References[1] W. Ressler, On binary quadratic forms and the Hecke groups, Int. J. NumberTheory, 5 (2009), 1401–1418.6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!