Math I: Super/Subscripts and Common Commands
Total Page:16
File Type:pdf, Size:1020Kb
LATEX for Absolute Beginners Math Typesetting I Math I: Super/Subscripts and Common Commands Introduction This tutorial will show you how to do some basic typesetting of math symbols, equations and matrices. Although LATEX in its basic form (i.e. when you start to write it in WinEdt) can do almost everything in math that the normal user will want to do, we can make it more user-friendly by telling it to load certain packages into its operating memory. ² open WinEdt and write the following: \documentclass{article} \usepackage{amsmath, amssymb} \begin{document} \end{document} Note that this is just like last time, except that we have added \usepackage{amsmath, amssymb} in our preamble. These packages gives LATEX access to some more symbols and some more structures that we will ¯nd useful and will make our lives a bit easier today. You don't have to load them every-time you want to write math, but some of our commands and symbols today (or in the second math typesetting session)|speci¯cally those connected to matrices|will work only if you do. Note that amsmath and amssymb are di®erent packages that need to be separated by a comma. Reminder: In Line and Display ² when you want some math in the same line as your text, you use the dollar signs. So, $4x-6y=67$ will produce the expression in the text, as 4x ¡ 6y = 67. Here is another sentence to convince you it was genuinely in text. ² when you want some math displayed on its own below your text, you use \[ \]. So, \[x+37=56\] gives x + 37 = 56: ² everything I say below about writing math in dollar signs will apply to the math display mode, \[ \], too. Sometimes it will look slightly di®erent, 1 LATEX for Absolute Beginners Math Typesetting I because LATEX adjusts heights of characters and their spacing to look more Pn reasonable given it is in text. For example, i=1 f(x) looks di®erent to Xn f(x); i=1 but they were produced using the same commands (but in-line and dis- played, respectively) ² note that numbers like 1, 2, 67, 3459 are always in math mode. There seems to be a UK/US di®erence when writing large numbers with commas. Americans often don't leave a space between the comma and the next number, but many other nationalities do. So, Brits write $100,000$ to write 100; 000, whereas Americans write 100,000 (without the $ $ signs) to write 100,000. ² note that letters in math mode look very di®erent compared to those in text. So $x$ gives x, while in text, we would have x ² Be careful with punctuation in math mode. Suppose you wanted to write @y 1 = ; @x jxj then you need to be sure that you put the comma (or semi-colon, or whatever) in the right place. This displayed formula was produced with the following code: \[\frac{\partial y}{\partial x}=\frac{1}{|x|},\] Note that the comma that comes at the end of the formula occurs before the command \]. If we put the comma after the \] command it would appear on the next line (incorrectly). That said, when we write in line math |recall with dollar signs| make sure you put the comma after the closing dollar sign. Greek Letters In math mode, you sometimes need Greek letters, like γ, ², Á and so on. ² generally, the command structure is $\letter-name$. So, to get a theta you type $\theta$. That gives you θ. ² note that I used a lower-case t at the start of theta to get a lower case theta in math mode. To get an upper case one, you use a capital T. So, $\Theta$ gives £ 2 LATEX for Absolute Beginners Math Typesetting I ² this upper/lower case distinction is not the case for all Greek letters: for example, there is only one type of alpha and beta LATEX will produce (and they both take the lower case): $\alpha$ gives you ® and $\beta$ gives you ¯, whilst $\Beta$ will give you an `unde¯ned command' message ² if you can't remember all the names of the letters, WinEdt can help youP out. Look at the top of your tool bar, and you will see a sum button (this is actually a capital epsilon, but is produced using $\sum$. To the left of it is a pictureP of a video camera and to the right is an umlauted E. Pressing the button gives you all the math and Greek characters you will need (and a lot of other useful symbols beside). Pick one, and press its button. Notice that it just writes the command for that symbol: you need to put it in dollar signs otherwise LATEX won't understand what you want to do. ² when you write a greek letter command (or any other math command), you must leave a space between the end of the command and the next nonoperation|like +; ¡; ¥; £ |character. So, it won't know what to do with $\alpha5$, but if you give it $\alpha 5$ it will write ®5 (note how it deletes the space you left between the characters). Subscripts and Superscripts ² to subscript an expression, like Pi you use an underscore in the following way: $P_i$. If there an expression of several symbols that are to be a subscript, you need to use braces. If you don't use an opening brace after the underscore, only the ¯rst character will be subscripted. So, $R_i\beta$ gives you Ri¯, but $R_{i\beta}$ gives you Ri¯. ² to superscript an expression, like F x you use the hat symbol in the fol- lowing way: $F^x$. If there an expression of several symbols that are to be a superscript, you need to use braces. If you don't use an opening brace after the hat, only the ¯rst character will be superscripted. So, $G^2\alpha$ gives you G2®, but $G^{2\alpha}$ gives you G2®. ² sometimes symbols have a subscript and a superscript. Here is a John m Duggan favorite: xi which was produced by writing $x_i^m$: you could also use $x^m_i$ since LATEX understands either order of superscripts and subscripts. What was said about braces (above) still applies. ² subscripts and superscripts can themselves have subscripts and super- scripts. To get eki , you use $e^{k_i}$. Note that the i used for the subscript of the k is smaller than the e and the k. ² for things like integrations and sums, we use exactly the same principles. To show integration between x and 1 for example, we type $\int^\infty_x$ 3 LATEX for Absolute Beginners Math Typesetting I R 1 which yields x , or Z 1 x in display mode. Summing between i = 1 and n over xi is written as $\sum^{n}_{1} x_i$ Pn which yields i=1 xi, or Xn xi i=1 in display mode. Inequalites, equalities, set notation etc. A LTEX hasP lots of symbols available for use. You can ¯nd many of these if you press the key on the tool-bar as we discussed above. We will not list all the possible symbols (you can ¯nd them in any LATEX guide book), but some of the common ones are in the table below (once again, all of this must be in the math mode). Some of the are commands are intuitive, some aren't. You (may) need to use the packages we speci¯ed above to have access to of all of them. Notice that some of them allow you to write subscripts/superscripts and limits in the way we discussed before. For example, you could write \[\bigcap^\infty_{i=1}(i-1,i)=\emptyset\] if the mood so took you. This gives: \1 (i ¡ 1; i) = ;: i=1 (If that is correct, credit to me. If it is wrong, blame Tu¹gbaGÄuven»c.She never did give us solution sets. ) 4 LATEX for Absolute Beginners Math Typesetting I output input output input = = 6= \ne < < > > · \leq ¸ \geq 2 \in 3 \ni 2= \notin 8 \forall 9 \exists @ \nexists ; \emptyset R \mathbb{R} 0 \prime ¥ \blacksquare @ \partial ¥ \div S[ \cup T\ \cap \bigcup \bigcap ½ \subset ⊃ \supset ⊆ \subseteq ¶ \supseteq , \Leftrightarrow () \Longleftrightarrow ( \Leftarrow ) \Rightarrow £ \times ¼ \approx xjy x|y Q) \therefore 1 \infty \prod _ \vee ^ \land Words: lim, det, sin... In math you often use small words like cos to mean cosine, max to mean maxi- mum and so on. If you just write the words in math mode, it won't look correct. For example, if we write $sin\theta$ we get sinθ, which is not what we want. If we write $\sin\theta$, though, it reads as: sin θ. The commands for these operators are generally intuitive, and we give a brief list of some common ones here. output input output input det \det inf \inf lim \lim lim inf \liminf lim sup \limsup sup \sup max \max min \min Pr \Pr arg \arg cos \cos exp \exp sin \sin cos \cos tan \tan deg \deg lim \varinjlim lim \varprojlim ¡! á 5 LATEX for Absolute Beginners Math Typesetting I Brackets Examples include parentheses like (a; b) which was produced using (a,b) or curly braces like fa; bg produced using \{a,b\}. ² if you type the commands above, they give you only a certain (regulated) size of delimiter. But that doesn't look correct in some circumstances. For example: Xn ( ); i=1 produced by \[(\sum_{i=1}^n)\] looks strange. You can correct for this by using variable size delimiters which have the general format: \leftopen delimiter math bit \rightclose delimiter.