How to create a labelled matrix in LaTeX?

  • #1
36
0
Hi

does anybody know how to create a labelled matrix in LaTeX? By which I mean something like this:
a b
a [ 1 0 ]
b [ 0 1 ]

Where the inner elements are within the braces, but there are tabular label elements for the rows and columns (a and b). Cant get it too look right!

Cheers
 
Physics news on Phys.org
  • #2
Hi rwinston,

If you don't mind parenthesis instead of braces you can use bordermatrix from plain TeX:

[tex]
\bordermatrix{&a_1&a_2& a_3 \cr
b_1 & 1 & 2 & 3 \cr
b_2 & 2 & 3 & 4 \cr
b_3 & 3 & 4 & 5 \cr}
[/tex]


[tex]
\bordermatrix{&a_1&a_2\cr
b_1 & 1 & 2 \cr
b_2 & 2 & 3 \cr}
[/tex]


[tex]
\bordermatrix{&a_1&a_2 \cr
b_1 & 1 & 2 \cr
b_2 & 2 & 3 \cr
b_3 & 3 & 4 \cr}
[/tex]

There is also a newer kbordermatrix package that you can use that gives more options (such as being able to change the delimiters).
 
  • #3
Thanks! Thats exactly what I need!
 

1. How do I create a labelled matrix in LaTeX?

To create a labelled matrix in LaTeX, you will need to use the \begin{matrix} and \end{matrix} commands. Inside these commands, you can input your matrix elements and use the & symbol to separate columns and \\ to separate rows. To add labels to the matrix, you can use the \label{} and \ref{} commands.

2. Can I customize the appearance of my labelled matrix in LaTeX?

Yes, you can customize the appearance of your labelled matrix in LaTeX using various commands. For example, you can use \renewcommand{\arraystretch}{1.5} to increase the spacing between rows, or \setlength{\arraycolsep}{5pt} to adjust the spacing between columns. You can also use \begin{pmatrix} and \end{pmatrix} to create a matrix with parentheses instead of brackets.

3. How can I add mathematical symbols and equations to my labelled matrix in LaTeX?

You can add mathematical symbols and equations to your labelled matrix in LaTeX by using the appropriate commands. For example, you can use \alpha to add the symbol for alpha or \frac{}{} to create a fraction. You can also use the \begin{align*} and \end{align*} commands to add equations to your matrix.

4. Can I add colors to my labelled matrix in LaTeX?

Yes, you can add colors to your labelled matrix in LaTeX by using the \usepackage{color} command and then using the \color{} command to specify a color for your matrix elements. You can also use the \cellcolor{} command to specify a color for a specific cell in your matrix.

5. How do I reference a specific cell in my labelled matrix in LaTeX?

You can reference a specific cell in your labelled matrix in LaTeX by using the \ref{} command and specifying the label of the cell. You can also use the \eqref{} command to add parentheses around the reference number. Additionally, you can use the \cline{} command to add horizontal lines to your matrix and visually indicate the cell you are referencing.

Suggested for: How to create a labelled matrix in LaTeX?

Replies
1
Views
452
Replies
2
Views
567
Replies
1
Views
742
Replies
8
Views
1K
Replies
7
Views
1K
Replies
1
Views
762
Replies
8
Views
1K
Replies
3
Views
826
Replies
1
Views
1K
Back
Top