# Math Help - Some Tips

1. ## Some Tips

We're gonna use the following environment

\begin{array}

\end{array}

Here's an example

\begin{aligned}
a&=b\\
a^2&=ab\\
a^2-b^2&=ab-b^2\\
(a+b)(a-b)&=b(a-b)\\
a+b&=b\\
2b&=b\\
2&=1
\end{aligned}

As you can see, in each line, we put one "&" at the left side of the equal symbol.

At the end of each line, we put "\\" to start a new one.

Once done this, let's put the LaTeX's Tags and yields


\begin{aligned}
a&=b\\
a^2&=ab\\
a^2-b^2&=ab-b^2\\
(a+b)(a-b)&=b(a-b)\\
a+b&=b\\
2b&=b\\
2&=1
\end{aligned}

Implies & Iff

We all know that we can type \Longrightarrow to generate $\Longrightarrow$ & \Longleftrightarrow to generate $\Longleftrightarrow$. We can short this, replacing that commands by \implies & \iff, which both of them generate the same.

\frac

Sometimes, we wanna write \frac{1}{2} to generate $\frac12$, we can also short this, writing the following: \frac12. Which generates the same. Be careful, for letters we must leave one space, so for example to write $\frac ab$, it writes \frac ab.

Another thing about fractions are examples like this

$\frac{\dfrac{a+b}{a-b}}{x+y}$

When we write another \frac, it should be \dfrac, otherwise, we're gonna get $\frac{\frac{a+b}{a-b}}{x+y}$, which definitely is not nice.

--

To write limits, just put \lim_{x\to1}, or with letters \lim_{x\to a}.

Cases

To generate things like

$f(x)=|x|=\left\{\begin{array}{rr}x&\text{if }x\ge0\\
-x&\text{if }x<0\end{array}\right.$

was used the following environment

f(x)=|x|=\left\{\begin{array}{rr}x&\text{if }x\ge0\\
-x&\text{if }x<0\end{array}\right.

After the {array}, we have the {rr}, which means "right, right", this says how we want to align, we can also use {cr} which is "center, right", and many others.

2. Just a quick note for the "Cases" ...case: If there are more than two instances, I find the following command useful:

\begin{cases} (this and that), (if this and that) // (this and that), (if this and that) //... \end{cases}

We end up with something like:

$
f(x)=|x|=\begin{cases} x, \ \mbox{if } \ x>0 \\
-x, \ \mbox{if } \ x<0 \\ 0, \ \mbox{if } \ x=0\end{cases}
$

3. Originally Posted by Rebesques
$
f(x)=|x|=\begin{cases} x, \ \mbox{if } \ x>0 \\
-x, \ \mbox{if } \ x<0 \\ 0, \ \mbox{if } \ x=0\end{cases}
$
Yep.

But if someone wants a little bit of "make-up", we can set

$f(x)=|x|=\left\{\begin{array}{rr}x,\text{ if }x>0\\
-x,\text{ if }x<0\\
0,\text{ if }x=0\end{array}\right.$

generated by

f(x)=|x|=\left\{\begin{array}{rr}x,\text{ if }x>0\\
-x,\text{ if }x<0\\
0,\text{ if }x=0\end{array}\right.

which in my opinion looks definitely better

4. If u like 'em with make-up on I am more of a naturalist myself.

5. An array can be enclosed with a number of symbols.

$\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$ . . \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}

$\begin{bmatrix}1 & 0 \\ 0 & 1 \end{bmatrix}$ . . \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

$\begin{Bmatrix}1 & 0 \\ 0 & 1 \end{Bmatrix}$ . . \begin{Bmatrix} 1 & 0 \\ 0 & 1 \end{Bmatrix}

$\begin{vmatrix}1 & 0 \\ 0 & 1 \end{vmatrix}$ . . \begin{vmatrix} 1 & 0 \\ 0 & 1 \end{vmatrix}

$\begin{Vmatrix}1 & 0 \\ 0 & 1 \end{Vmatrix}$ . . \begin{Vmatrix} 1 & 0 \\ 0 & 1 \end{Vmatrix}

For an augmented matrix, use:
\left( \begin{array}{cc|c} 1 & 0 & a \\ 0 & 1 & b \end{array} \right)

$\left( \begin{array}{cc|c}1 & 0 & a \\ 0 & 1 & b \end{array}\right)$

A binomial coefficient $\begin{pmatrix}9 \\ 3\end{pmatrix}$ can be constructed with: .\begin{pmatrix} 9 \\ 3 \end{pmatrix}
. . but it can be done with: .9 \choose 3 .or: .\binom {9}{3}

A partition $9\choose2,3,4$ can be constructed with: .9 \choose 2,3,4 .or: .\binom {9}(2,3,4}

Note: Those spaces are not required in the code; they're used here for clarity.

6. Some odds and ends . . .

$\begin{array}{ccccc}\rightarrow & \backslash\text{rightarrow} & \quad & \Rightarrow & \backslash\text{Rightarrow} \\
\leftarrow & \backslash\text{leftarrow} & \quad & \Leftarrow & \backslash\text{Leftarrow} \\
\uparrow & \backslash\text{uparrow} & \quad & \Uparrow & \backslash\text{Uparrow} \\
\downarrow & \backslash\text{downarrow} & \quad & \Downarrow & \backslash\text{Downarrow}
\end{array}$

$\begin{array}{ccccc}\nearrow & \backslash\text{nearrow} & \quad &
\searrow & \backslash\text{searrow} \\
\swarrow & \backslash\text{swarrow} & \quad & \nwarrow & \backslash\text{nwarrow} \end{array}$

$\begin{array}{ccccc}\circlearrowleft & \backslash\text{circlearrowleft} & \quad & \circlearrowright & \backslash\text{circlearrowright} \\
\curvearrowleft & \backslash\text{curvearrowleft} & \quad & \curvearrowright & \backslash\text{curvearrowright}
\end{array}$

$\begin{array}{cccccccc}\cdots & \backslash\text{cdots} & \quad & \vdots & \backslash\text{vdots} & \quad & \ddots & \backslash\text{ddots}\end{array}$

$\begin{array}{cccccccc}\bullet & \backslash\text{bullet} & \quad & \circ & \backslash\text{circ} & \quad & \bigcirc & \backslash\text{bigcirc}\end{array}$

$\begin{array}{cccccccc}
\star & \backslash\text{star} & \quad & \bigstar & \backslash\text{bigstar} & \quad & \divideontimes & \backslash\text{divideontimes}\\ \\
\between & \backslash\text{between} & \quad & \blacksquare & \backslash\text{blacksquare} & \quad & \blacktriangle & \backslash\text{blacktriangle} \end{array}$

$\begin{array}{cccccccc}\spadesuit & \backslash\text{spadesuit} & \quad & \clubsuit & \backslash\text{clubsuit} \end{array}$
. . . (But there is no \heartsuit nor \diamondsuit . . . why?)

My error ... somehow.
I tried many times, but \heartsuit and \diamondsuit gave me a "Latex error" message.
Of course, now that I've publically embarrassed myself, it works fine.

7. Originally Posted by Soroban
...(But there is no \heartsuit nor \diamondsuit . . . why?)

hello:

$\diamondsuit$

$\heartsuit$

(but they are not black )

8. Originally Posted by Soroban
(But there is no \heartsuit nor \diamondsuit . . . why?)

Originally Posted by earboth
hello:

$\diamondsuit$

$\heartsuit$

(but they are not black )
Perhaps because these suits are red and there is no red font in LaTeX?

-Dan

9. Originally Posted by topsquark
Perhaps because these suits are red and there is no red font in LaTeX?

-Dan
i guess the best we can do is to make the outline red: $\color {red} \heartsuit \mbox { } \diamondsuit$

...isn't there a code to shade things in LaTex?

10. When forming matrices or determinants, I find that the minus-signs
. . are quite large and are rather distracting.

For example: . $\begin{bmatrix}-17 & 0 & -29 \\ -29 & -17 & 0 \\ 0 & -29 & -17 \end{bmatrix}$

\begin{bmatrix} -17 & 0 & -29 \\ -29 & -17 & 0 \\ 0 & -29 & -17 \end{bmatrix}

If it's too annoying, I insert .\text{ } around each minus-sign.

Then we have: . $\begin{bmatrix}\text{-}17 & 0 & \text{-}29 \\ \text{-}29 & \text{-}17 & 0 \\ 0 & \text{-}29 & \text{-}17 \end{bmatrix}$

I also find that the grouping symbols for arrays
. . tend to "squeeze" the array: . $\begin{vmatrix}1 & 0 \\ 0 & 1\end{vmatrix}$

\begin{vmatrix}1 & 0 \\ 0 & 1\end{vmatrix}

So I insert a space \; at the ends of each row: . $\begin{vmatrix}\; 1 & 0 \; \\ \; 0 & 1 \; \end{vmatrix}$

\begin{vmatrix} \; 1 & 0 \; \\ \; 0 & 1 \; \end{vmatrix}

Yes, it means extra work, but I think the final result is worth the effort.

Obviously, I enjoy creating orderly layouts
. . and I delight in finding such improvements.

I've kept these tips to myself up to now
. . (lest someone snickers and says, "Wow, he's got OCB!")
but then I figured: someone might appreciate these . . .

11. Originally Posted by Soroban

So I insert a space \;
I find that the ~ is slightly easier to type. This also inserts a space.

-Dan

12. Originally Posted by Soroban
For example: . $\begin{bmatrix}-17 & 0 & -29 \\ -29 & -17 & 0 \\ 0 & -29 & -17 \end{bmatrix}$
We may also use the array environment as follows

$\left[\begin{array}{rrr}-17&0&-29\\
-29&-17&0\\
0&-29&-17\end{array}\right]$

This works for digits alignment.

The following code was applied here

\left[\begin{array}{rrr}-17&0&-29\\
-29&-17&0\\
0&-29&-17\end{array}\right]

not hard to write. Personally, looks better.

13. Originally Posted by Soroban
$\begin{vmatrix}1 & 0 \\ 0 & 1\end{vmatrix}$
If you use the array environment, yields the following

$\left|\begin{array}{cc}1&0\\
0&1\end{array}\right|$

\left|\begin{array}{cc}1&0\\
0&1\end{array}\right|.

And we're done

--

One can choose the {r}{c}{l}, all depends of the make-up.

14. Originally Posted by topsquark
I find that the ~ is slightly easier to type. This also inserts a space.

-Dan
I agree. in addition, when you have \, all over the place (i have seen people use it between every term) makes for such unaesthetic code.

Can someone show me how to make tables? Like a truth table

i want to know how to make tables that have an outline, as well as tables with just an inner skeleton but no outline around the edges

i also want to know how to create the type of skeleton that just separates headings and columns, and those that bar off each cell to itself

15. You can use the LaTable.

Page 1 of 2 12 Last