# Labeling matrix columns in LaTeX

I display a matrix in LaTeX with the following code:

\left(
\begin{array}{ccc}
1 & 1 & 1 \\
0 & 1 & 2
\end{array}
\right)

I want to give a name for the columns, e.g. the first one would be u vector.
How can these labels put above the columns without messing up the parentheses around the matrix?
LVL 9
###### Who is Participating?

Commented:
>> but there is too much space between the columns

Just for the record - this would fix that :

\begin{array}{@{}r@{}c@{}c@{}c@{}l@{}}
& \vec{u} & \vec{v} & \vec{w} &  \\
\left.\begin{array}{c} \\ \\ \\ \end{array}\right(
& \begin{array}{c} a \\ d \\ g \end{array}
& \begin{array}{c} b \\ e \\ h \end{array}
& \begin{array}{c} c \\ f \\ i \end{array}
& \left)\begin{array}{c} \\ \\ \\ \end{array}\right.
\end{array}
0

Commented:
With my limited knowledge of LaTeX, something like this comes close (but isn't perfect) :

\begin{array}{rcccl}
& u vector & v vector & w vector &  \\
\left.\begin{array}{c} \\ \\ \\ \end{array}\right(
& \begin{array}{c} a \\ d \\ g \end{array}
& \begin{array}{c} b \\ e \\ h \end{array}
& \begin{array}{c} c \\ f \\ i \end{array}
& \left)\begin{array}{c} \\ \\ \\ \end{array}\right.
\end{array}

There's probably an easier solution heh
0

Author Commented:
The layout produced by your code is correct, but there is too much space between the columns if the labels consist of one character, for instance \vec{u} is written above the first column.
0

Commented:
I know it's not perfect, and I've got a suspicion that there's an easier way of doing what you want - but I don't know it :)

You'll have to wait for a real LaTeX expert heh.
0

Author Commented:
Perfect appearance, thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.