LaTeX Lessons

Lesson Ten: Creating an Array

We will start with the minimal array

\documentclass[12pt]{article}
\begin{document}
\[ \begin{array}{cc}
1 & 2 \\
3 & 4
\end{array} \]
\end{document}

Download: latsam10a.tex

The output is...

1   2
3   4

To insert a matrix into LaTeX, add the delimiters \left[ and \right]. For a full list of delimiters see a LaTeX manual.

\documentclass[12pt]{article}
\begin{document}
\[ \left[ \begin{array}{cc}
1 & 2 \\
3 & 4
\end{array} \right] \]
\end{document}

Download: latsam10b.tex

The output is...

output from latsam10b.tex

You can also add lines around your array

\documentclass[12pt]{article}
\begin{document}
\[ \begin{array}{|c|c|}
\hline
\alpha^2-1 & \Delta \beta \\ \hline
\int x^2-x dx & \lim_{n}^{\infty} \frac{n^2}{n+1}\\ \hline
\end{array}\]
\end{document}

Download: latsam10c.tex

The output is...

output from latsam10c.tex

This concludes lesson 10.


All Lessons