# A Short Guide to LaTeX (1 Viewer)

#### jet

##### Banned
Hi everyone,
With the use of LaTeX becoming more widespread, I've decided to write a short guide to LaTeX. If you have any problems, post in this thread or message me somehow.
jetblack2007.

The graphical editor supplied to us is excellent, though I think at least a small amount of knowledge of how to work with LaTeX is helpful. All you do is combine normal text with commands to tell the editor how it should format something, for example turn an expression into a fraction.

Maths Mode
The LaTeX editor is in a mode known as maths mode, which is fine-tuned for mathematical typesetting. All spaces are ignored, and maths commands don't need to be wrapped by special tags in order to be interpreted by the engine.

Numbers and Simple Operations
For many characters, if it's on your keyboard, it works. Numbers are written as numbers, and the + and - signs do not require any special commands. Multiplication and Division, however, are expressed using the /times and /div commands.
For example:
Code:
1 2 3 4 5 6 7 8 9 0 + - \times \div ( )
becomes
$\bg_white 1 2 3 4 5 6 7 8 9 0 + - \times \div ( )$

Text
As spaces are ignored in maths mode, and text letters are treated as mathematics, writing something like this:
Code:
Hello world, how are you this fine morning?
turns into
$\bg_white Hello world, how are you this fine morning?$

The solution is simple. A command known as \text{} exists, which allows you to write all your text inside the parentheses, and it is treated as text.
E.g.
Code:
\text{Hello world, how are you this fine morning?}
becomes
$\bg_white \text{Hello world, how are you this fine morning?}$

Another way, suggested by Trebla, is to wrap the text in $tags, instead of the \text{} function. It does exactly the same thing. E.g Code: $Hello world, how are you this fine morning? becomes: $\bg_white Hello world, how are you this fine morning?$ Starting a new line Simply pressing Enter and expecting a new line to be interpreted does not work in LaTeX. Instead, you have to use a double slash, \\. This signals to the engine that it should start a new line. E.g. Code: \text{Line 1} \\ \text{Line 2} becomes: $\bg_white \text{Line 1} \\ \text{Line 2}$ (Suggested by kaz1) Fractions The command \frac{}{} is used for fractions, where the numerator goes in the first set of parentheses and the denominator in the second set. So, Code: \frac{x^3 - x^2}{5x - 1} becomes $\bg_white \frac{x^3 - x^2}{5x - 1}$ Brackets Sometimes mathematical expressions (like fractions) can be so big that they exceed the size of the brackets. In this case you can use the \left and \right commands before the bracket. They will then be automatically resized to the size of their contents. To compare: Code: ( \frac{1}{x}) \text{ versus }\left (\frac{1}{x} \right ) become: $\bg_white ( \frac{1}{x}) \text{ versus }\left (\frac{1}{x} \right )$ You can do this with the following brackets: (), [], || (Note that because maths mode ignores spacing, I had to include it within the text command to ensure the text wasn't sandwiched between expressions with no spacing) Square Roots The \sqrt{} command places a root sign over whatever is in the set of parentheses. It resizes according to the size of the radicand. So: Code: \sqrt{x\left (5x - 1\right )} is: $\bg_white \sqrt{x\left (5x - 1\right )}$ Superscript and subscript Superscript and subscript formatting is indicated by the ^{} and _{} commands respectively. Whatever is in the parentheses is super/subscripted. Therefore: Code: x^{\frac{5}{3}}, M_{\text{AB}} become: $\bg_white x^{\frac{5}{3}}, M_{\text{AB}}$ Spacing: Sometimes you just need that little bit of extra space between characters. There is a set of inbuilt functions to do this. From smallest of bigger, they are: \! , \, , \: , \; , \quad and \qquad So Code: a \! a \, a \: a \; a \quad a \qquad a becomes: $\bg_white a \! a \, a \: a \; a \quad a \qquad a$ (Note: The first command, \! is actually 'negative' space, forcing characters closer together) Integrals The integral sign is given by the command \int which can be modified to include limits using super/subscripts. Normally I like to put a \, before the dx to make it look neat. E.g. The code Code: \int^{6}_{\frac{1}{2}} x^2 - 3x + 1 \, dx Becomes: $\bg_white \int^{6}_{\frac{1}{2}} x^2 - 3x + 1 \, dx$ Enclosing something in a box This is just like using a text command, though you use the \fbox{} command. Whatever you want in the box goes in the parentheses. E.g. Code: \fbox{1234567890} is: $\bg_white \fbox{1234567890}$ Other Symbols There are hundreds of other symbols available for you to use. Many of them are included in the graphical interface of the editor, so the commands can be learnt that way, though I think some of the more common ones can be placed here: Trig functions with built-in formatting and spacing: \sin: $\bg_white \sin x$ \cos: $\bg_white \cos x$ \tan: $\bg_white \tan x$ \sec: $\bg_white \sec x$ \csc: $\bg_white \csc x$ \cot: $\bg_white \cot x$ \arcsin: $\bg_white \arcsin x$ \arccos: $\bg_white \arccos x$ \arctan: $\bg_white \arctan x$ Greek letters (just their name preceded by a \. If capital letters have the first letter as a capital) \alpha: $\bg_white \alpha$ \beta: $\bg_white \beta$ \gamma: $\bg_white \gamma$ \Gamma: $\bg_white \Gamma$ \delta: $\bg_white \delta$ \Delta: $\bg_white \Delta$ \theta: $\bg_white \theta$ \Theta: $\bg_white \Theta$ etc. Miscellaneous symbols: \circ: $\bg_white \circ$ (useful in superscript for degrees) \triangle: $\bg_white \triangle$ \angle: $\bg_white \angle$ \equiv: $\bg_white \equiv$ \rightarrow: $\bg_white \rightarrow$ \Rightarrow: $\bg_white \Rightarrow$ \infty: $\bg_white \infty$ For a large amount of other symbols: http://tinyurl.com/y8elxfb The Align Environment When you want to align certain parts of a solution vertically, (e.g. equals under equals) you use what is called the align environment. You mark which part of each line you want aligned together with the & sign, and latex does all the work for you. For example, Casic posted: $\bg_white 5x = 2x + 3x \\ = 3x + 2x \text{ (since } \mathbb{R} \text{ is commutative)} \\ = 5x$ (this is missing the align environment). Clearly writing our equals under equals would be helpful. You start the align environment with the command \begin{align*} (the asterisk tells LaTeX you don't want the lines numbered) and end it with the \end{align*} command. So, the code for this is: Code: \begin{align*}5x &= 2x + 3x \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &= 5x \end{align*} Noting that the alignment symbol (&) is placed before the = signs, which is where we want them aligned. This becomes: \bg_white \begin{align*}5x &= 2x + 3x \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &= 5x \end{align*} Piecewise functions When you need to define piecewise functions, you use the cases environment. It works the same as the alignment environment, beginning through \begin{cases} and ending through \end{cases}. Each case is specified on a new line within the cases environment. So: Code: f(x) = \begin{cases}\text{Case } 1 \\ \text{Case } 2 \end{cases} is: $\bg_white f(x) = \begin{cases}\text{Case } 1 \\ \text{Case 2 } \end{cases}$ Last edited: #### Trebla ##### Administrator Administrator For texts I would use to surround the text (in this version anyway, it works oppositely in other versions).

e.g. $Insert text$ becomes: $\bg_white Insert text$

#### Aquawhite

##### Retiring
Haha, thanks for that jetblack2007. It would be nice to see people using LaTeX because it makes reading and solving problems a lot easier for everyone. Although I must say that when you go into LaTeX you can see the options available anyway... like what buttons to push.

I prefer to just use buttons, rather than code.

#### gurmies

##### Drover
Any idea how to put a solution in a box?

Last edited by a moderator:

#### kaz1

##### et tu
Also you should put in how to start a new line.

#### Cazic

##### Member
Nice. Maybe mention the align* and cases environment too?

\bg_white \begin{align*}6x &= 2x + 3x \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &= 6x \end{align*}

and

$\bg_white |x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$

Last edited by a moderator:

#### jet

##### Banned
Any idea how to put a solution in a box?
Do you have an example you can show me?

#### jet

##### Banned
Nice. Maybe mention the align* and cases environment too?

\bg_white \begin{align*}6x &= 2x + 3x \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &= 6x \end{align*}

and

$\bg_white |x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$
Ok. I will put them in later. I don't think cases is so important, just because we hardly use piecewise functions, so I will add it in the very end

#### Trebla

Nice. Maybe mention the align* and cases environment too?

\bg_white \begin{align*}6x &= 2x + 3x \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &= 6x \end{align*}
Er.....isn't 2x + 3x = 5x? lol

#### Cazic

##### Member
Hahaha. Ever notice it's always the simplest things?

\bg_white \begin{align*}6x &\neq 2x + 3x & \text{for } x \neq 0 \\ &= 3x + 2x & \text{(since } \mathbb{R} \text{ is commutative)} \\ &\neq 6x & \text{for } x \neq 0 \end{align*}

#### untouchablecuz

##### Active Member
you mean this?
nah

like the [k=n-m-1] which has a box around it

(i think this is what he means)

(this is just Q ive done for someone)

#### gurmies

##### Drover
nah

like the [k=n-m-1] which has a box around it

(i think this is what he means)

(this is just Q ive done for someone)

Exactly this.

#### jet

##### Banned
I'll update the guide tonight. Dinner calls

Ty Sir =]

#### Cazic

##### Member
$\bg_white \fbox{\text{Here is some text and some} \mu \alpha \tau \eta \sigma}$

Last edited by a moderator:

#### Aquawhite

##### Retiring
I love math fails... . Especially while online or using LaTeX ^_^

#### Sanjeet

##### Member
How do I get LaTeX?

#### Fakeuser

##### New Member
Test post.

Can someone tell me how you enable it? None of the commands are working for me (I must be forgetting something critical).

Edit: Never mind, I forgot you needed the $\bg_white tag (I didn't see that in your guide )."/>

Last edited: