# Thread: Array in MHL Latex

1. ## Array in MHL Latex

I tried to create a 7x5 matrix in MHL latex. I wrote this code, but I keep getting an "invalid equation" error. I really don't know what I did wrong. Can anybody point out my mistake? Thanks.

\begin{array}{cc}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\ 0&0&0&1&0\\0&0&0&0&1\\0&0&0&0&0\\0&0&0&0&0\end{arr ay}

$\displaystyle \begin{array}{cc}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\ 0&0&0&1&0\\0&0&0&0&1\\0&0&0&0&0\\end{array}$

2. ## Re: Array in MHL Latex

There are some small changes I made. First off I've never liked the "array" command...I prefer "matrix." Second, I moved the "tex" command to be sandwiched between the "font" and "color." I don't see any actual color there so maybe something else needs to be done. Third, there was a \\end. I removed the extra \.

$$\begin{matrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0 &0&1&0\\0&0&0&0&1\\0&0&0&0&0\\0&0&0&0&0\end{matrix }$$

[TEX]\begin{matrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0 &0&1&0\\0&0&0&0&1\\0&0&0&0&0\end{matrix}[/TEX]

gives

$\displaystyle \begin{matrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0 &0&1&0\\0&0&0&0&1\\0&0&0&0&0\\0&0&0&0&0\end{matrix }$

$\displaystyle \begin{matrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0 &0&1&0\\0&0&0&0&1\\0&0&0&0&0\end{matrix}"$$\displaystyle alt="\begin{array}{cc}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\ 0&0&0&1&0\\0&0&0&0&1\\0&0&0&0&0\\end{array}"$

I don't know what "alt = " is supposed to do. Sorry!

-Dan

3. ## Re: Array in MHL Latex

Matrix:

$\displaystyle \begin{matrix}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0 &0&1&0\\0&0&0&0&1\\0&0&0&0&0\\0&0&0&0&0\end{matrix }$

Array:

$\displaystyle \begin{array}{ccccc}1&0&0&0&0\\ 0&1&0&0&0\\ 0&0&1&0&0\\ 0&0&0&1&0\\ 0&0&0&0&1\\ 0&0&0&0&0 \end{array}$

Insert spaces at least every 50 characters, but avoid newlines in math formulas.

4. ## Re: Array in MHL Latex

So that's it! You have to include {ccccc} in the array command for five columns! Maybe that should be explained in our pdf handout. Many thanks.