Solved

Labeling matrix columns in LaTeX

Posted on 2007-08-01
11,061 Views
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?
0
Question by:pallosp

LVL 53

Expert Comment

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

LVL 9

Author Comment

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

LVL 53

Expert Comment

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

LVL 53

Accepted Solution

>> 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

LVL 9

Author Comment

Perfect appearance, thank you!
0

Featured Post

A Guide to the PMT, FV, IPMT and PPMT Functions In MS Excel we have the PMT, FV, IPMT and PPMT functions, which do a fantastic job for interest rate calculations.  But what if you don't have Excel ? This article is for programmers looking to re…
When designing and editing page layouts in inDesign, fonts can become messy without the help of paragraph styles. How many times have you re-read through a document you created and noticed a sentence in the middle of a paragraph happened to be a dif…
Learn how to automatically add page numbers in your next InDesign project. This can be very helpful in multi-page books and magazines that you are designing. Make sure your Pages window visible.:  In the document you wish to add page numbers to. Act…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.