This action might not be possible to undo. Are you sure you want to continue?

Mathematics part 1 - Getting to grips with LaTeX - Andrew Roberts

**Andrew Roberts Home Coding » Writing » Photography »
**

Tw eet 2 6

**Getting to Grips with LaTeX
**

Mathematics - Part 1

by Andrew Roberts One of the greatest motivating forces for Donald Knuth when he began developing the original TeX system was to create something that allowed simple construction of mathematical formulae, whilst looking professional when printed. The fact that he succeeded was most probably why Tex (and later on, LaTeX) became so popular within the scientific community. Regardless of the history, typesetting mathematics is one of LaTeX's greatest strengths. However, it is also a large topic due to the existence of so much mathematical notation. So, this will be part one - getting to know the basics.

Maths environments

LaTeX needs to know beforehand that the subsequent text does in fact contain mathematical elements. This is because LaTeX typesets maths notation differently than normal text. Therefore, special environments have been declared for this purpose. They can be distinguished into two categories depending on how they are presented: text - text formulae are displayed inline, that is, within the body of text were it is declared. e.g., I can say that a + a = 2a within this sentence. displayed - displayed formulae are separate from the main text. As maths require special environments, there are naturally the appropriate environment names you can use in the standard way. Unlike most other environments however, there are some handy shorthands to declaring your formulae. The following table summarises them: Type Environment LaTeX shorthand Tex shorthand

$ . . . $ $ $ . . . $ $

Text \ b e g i n { m a t h } . . . \ e n d { m a t h } \ ( . . . \ ) Displayed \ b e g i n { d i s p l a y m a t h } . . . \ e n d { d i s p l a y m a t h }\ [ . . . \ ]

Additionally, there is second possible environment for the displayed type of formulae: e q u a t i o n . The difference between this and d i s p l a y m a t his that e q u a t i o nalso adds sequential equation numbers by the side. See mathenv.pdf for an illustration of how the various basic environments are used.

Symbols

Mathematics has lots and lots of symbols! If there is one aspect of maths that is difficult in LaTeX it is trying to

www.andy-roberts.net/writing/latex/mathematics_1 1/4

pdf. you must use the \ f r a c { numerator} { denominator}command. they would overwhelm this tutorial if I tried to list them all. then that is achieved like this: x ^ { 2 i } _ { 3 j }(or x _ { 3 j } ^ { 2 i } .Andrew Roberts remember how to produce them. distinct commands must be issued in order to display the desired symbols. etc.net/writing/latex/mathematics_1 2/4 . There are of course a set of symbols that can be accessed directly from the keyboard: +-=!/()[]<>|': Beyond those listed above. Fractions To create a fraction. The carat (^) character is used to raise something. that's the top and bottom respectively!) You can also embed fractions within fractions. Too many to remember. How to use them is best shown by example: x ^ n x ^ { 2 n } Power Index n _ i n _ { i j } Note: if more than one character is to be raised (or lowered) then you must group them using the curly braces ( { } ). you are after the square root.8/13/12 Mathematics part 1 . for the majority of times. order is not significant).andy-roberts. if you need to assign both a power and an index to the same entity. try symbols. this can be generalised to produce a root of any magnitude: www. Also. set and relations symbols. arrows. Therefore.Getting to grips with LaTeX . as shown in the examples below: \ f r a c { x + y } { y z } \ f r a c { \ f r a c { 1 } { x } + \ f r a c { 1 } { y } } { y z } Powers and indices Powers and indices are mathematically equivalent to superscripts and subscripts in normal text mode. binary operators. Roots Typically. And there are a lot! Greek letters. and in fact. and the underscore (_) is for lowering. (For those who need their memories refreshed. for a complete reference document. which is done easily using the following command: \ s q r t { x } . However. We will of course see some of these symbols used throughout the tutorial.

. It instead has a slightly more generalised environment called a r r a y .net/writing/latex/mathematics_1 3/4 . they would be fine for an equation a simple equation that remained on a single line (e. The a r r a yenvironment is basically equivalent to the t a b l eenvironment (see tutorial 4 to refresh your mind on table syntax.. Without them.and \ r i g h t . You must enclose the expression that you want in brackets with these commands.commands provide the means for automatic sizing of brackets. such as matrices typically rely on brackets to enclose them. The second example illustrates the LaTeX way of coping with this problem.g. There are in fact many more possible symbols that can be used. .pdf) for the rest. For a simple 2x2 matrix: www. So why the need for a dedicated section? Well.) Arrays are very flexible. As you can see. Brackets The use of brackets soon becomes important when dealing with anything but the most trivial equations. Matrices LaTeX doesn't have a specific matrix command to use. but we shall focus on matrices. .g. regardless of the size of root you're after.andy-roberts. special types of mathematical structures. (3 + 2) x (10-3) = 35) but not for equations that have greater vertical size.Andrew Roberts \ s q r t [ n] { arg} LaTeX will automatically ensure that the size of the root notation adjusts to the size of the contents. formulae can become ambiguous. Also. I think that can be shown by example: $ $ ( \ f r a c { x ^ 2 } { y ^ 3 } ) $ $ $ $ \ l e f t ( \ f r a c { x ^ 2 } { y ^ 3 } \ r i g h t ) $ $ The first example shows what would happen if you used the standard bracket characters. and this will give you your matrix. which should be more than adequate for most peoples' needs. such as those using fractions.. and then enclose it with appropriate left and right brackets.8/13/12 Mathematics part 1 . Please check out table 5 from the symbols reference (symbols. e. but are somewhat uncommon. The dots after the command should be replaced with one of the characters depending on the style of bracket you want. The \ l e f t . and can be used for many purposes.Getting to grips with LaTeX . you still use the \ s q r tcommand. You can use the array to arrange and align your data as you want. and without it will output a square root. The n is optional. You may recall that you already have the ( ) [ ]symbols at your disposal. . n=3. Also.

pdf | matrices.pdf Useful resources: symbols. 2011 « Back to LaTeX tutorials.8/13/12 Mathematics part 1 .andy-roberts.Andrew Roberts $ $\ l e f t [ \ b e g i n { a r r a y } {cc} 1&2\ \ 3&4 \ e n d { a r r a y }\ r i g h t ] $ $ Files: mathenv.tex | mathenv.pdf | basic_maths.tex | matrices.Getting to grips with LaTeX .pdf Last updated: December 8.tex | basic_maths.net/writing/latex/mathematics_1 4/4 . Tw eet 2 6 10 comments Discussion Com m unity Andrew Roberts © 2012 www.

Latex tutorial

Latex tutorial

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd