{matrices} is about matrices in {equations} and {diagrams}.

learn more… | top users | synonyms (1)

53
votes
5answers
80k views

How to add a matrix to a LaTeX document

How do we add a matrix to a LaTeX document?
41
votes
8answers
8k views

Highlight elements in the matrix

I have a matrix and need to highlight some elements in the matrix. I have found how to highlight a single element (I want to put the cell in the square): $$ A = \begin{bmatrix} \fbox{0} & ...
36
votes
5answers
2k views

Perform matrix operations (addition, product, transpose, etc.) in LaTeX?

I know the calc package can perform infix-notation arithmetic in LaTeX... but I want more! I'd like to perform (not necessarily infix-notation) linear-algebra operations such as scalar ...
34
votes
5answers
7k views

How do I label different rows or columns of a matrix using braces?

I have a matrix enclosed in brackets [ ] (or (), or {}, or |'s, or ||'s): - a b c d - | e f g h | | i j k l | - m n o p - which I want to label like so: R |---| -- - a b c d ...
25
votes
2answers
13k views

How can I increase the line spacing in a matrix?

I'm trying to create a pmatrix whose components are rather complicated fractions (Christoffel symbols), and the line spacing is too small making the whole thing a bit cramped and hard to read. Is ...
24
votes
4answers
3k views

Using display style fraction in a matrix environment

I'd like use the \dfrac command in a bmatrix environment as follows: \documentclass{article} \usepackage{amsmath} \begin{document} \[ \begin{bmatrix} \dfrac{\partial f}{\partial x} \\ ...
24
votes
2answers
4k views

Unknown error using tikz matrix of nodes in beamer

I am having trouble getting a basic example of a matrix of notes to show up in my beamer presentation. I am using the code copied from the pgf manual. Here is a complete working example. The error I ...
24
votes
1answer
5k views

TikZ matrix as a replacement for tabular

I would like to use TikZ matrices to for some drawings. I am currently using nodes and positioning them manually to simulate a tabular. That helps in positioning arrows and shading. However, if I ...
22
votes
5answers
7k views

What's the best way make an “augmented” coefficient matrix?

When studying systems of linear equations, it's nice to remind people that the last column of the coefficient matrix holds the constants. This is often done in books by putting a vertical line ...
22
votes
3answers
28k views

typesetting column vector

I would like to define a command which typesets a column vector. For one vector I can have something like: \left( \begin{array}{c} a\\ b\\ \end{array} \right) I would like the command to produce ...
20
votes
5answers
2k views

Huge matrix in my document. Possible ways to make it look better?

The following is the source for a matrix I'm using in my document: \documentclass{scrartcl} \usepackage[english]{babel} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \usepackage{amsmath} ...
20
votes
3answers
8k views

How do I left-align entries in a matrix with \begin{matrix}?

I'd like to left align the -1 entry in the following matrix so that the 1s line up. Is there a way to get matrices to ignore signs in that way? \begin{matrix} 1 & 1 \ 1 & -1 \ ...
20
votes
2answers
5k views

Upper triangular matrix with big zero in lower triangular?

I can represent an upper trapezoidal matrix say as shown below. I would like to replace all those zeros with a single big zero that spans across the low triangle rows and columns, and maybe also add a ...
18
votes
3answers
853 views

Matrix with labels nested in braces

What's the best way to produce a matrix with labels that are nested in braces, like this:
17
votes
1answer
2k views

TikZ two-blocks matrix

I would like to get a plot like the one I sketched below, basically two blocks of the same matrix with arrows going up and anti-diagonally for the red block and arrows going up for the green one. The ...
17
votes
3answers
2k views

How can I visualize Matrix operations?

I would like to visualize some matrix operations like that: How can I do that (preferably something that also works for mathjax)?
17
votes
3answers
3k views

Multirow/multicolumn cells in TikZ matrices?

Is it possible to make TikZ matrix cells span multiple rows/columns, like they can in LaTeX tables using \multirow/\multicolumn? Specifically, I'd like to typeset something like the following in a ...
17
votes
1answer
529 views

Brackets around matrices in TikZ

I'm writing a custom package for labeled matrices using TikZ. I noticed an inconsistency in TikZ. This is best illustrated with the following MWE: \documentclass{standalone} \usepackage{tikz} ...
16
votes
3answers
2k views

Typesetting a Row Vector

In the question typesetting a column vector, a very nice solution was given for typesetting a column vector with an arbitrary number of rows. I am attempting to modify the code to produce row vectors ...
16
votes
1answer
2k views

How to create a matrix with 20 columns in latex

The code below works, but when I add 10 more columns, it does not. So, how can I add ten more columns to the matrix below? \documentclass{article} \usepackage{amsmath} \begin{document} ...
15
votes
5answers
8k views

bordermatrix with blocks

I need to write a complicated matrix, that has a structure as in the attached picture.
15
votes
1answer
578 views

How does this macro for augmented matrices work?

I've used this code I found somewhere to typeset literally hundreds of augmented matrices, and it's been amazing: \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage{arydshln} ...
14
votes
3answers
7k views

Where is the \matrix command?

From what I can see, \matrix was a TeX command, but I cannot seem to find documentation on it. It works in MathJax, so I wonder if it can be used in LaTeX. ie this is valid MathJax: $$ \left[ ...
14
votes
1answer
6k views

How to typeset block matrices?

I need to typeset a block matrix that is made of a 2X2 structure of blocks such that the (1,1) block and the (2,2) blocks are zero and the (1,2) and the (2,1) blocks are non-zero (and happen to have a ...
13
votes
5answers
729 views

Drawing a large binary matrix as colored grid in TikZ

I have a pretty big binary matrix of maybe 70 rows and 64 columns. For ease of viewing, I would like to draw this matrix in TikZ where e.g. a 1 is represtented by a red square and a 0 is a white ...
13
votes
4answers
845 views

Drawing Young tabloids

I would like LaTeX to produce output like the following (without the 2 a so called Young tabloid), ideally by writing \ytabloidshort{123,56} (using one character per cell, ideally allowing ...
13
votes
4answers
2k views

Draw a line through one column of a matrix

I'd like to "cancel" (draw a line through) a column of a matrix (using \begin{pmatrix}..\end{pmatrix}). How can I do this?
13
votes
2answers
2k views

TikZ: Curve through specified points

\documentclass{standalone} \usepackage{comment} \usepackage{tikz,pgf} \usetikzlibrary{fit,scopes,calc,matrix,positioning,decorations.pathmorphing} \begin{document} \begin{tikzpicture} ...
12
votes
2answers
416 views

Print zeroes in a sparse matrix in a lighter color

For a report I need to print some sparse matrices as full matrices, so that means that there are a lot of zeroes. If I print them in the same color as the meaningful entries, it doesn't look very ...
12
votes
3answers
2k views

Horizontal row separation line in tikz matrix (like \hline in tabular)

In this question tikz-matrix-as-a-replacement-for-tabular a nice solution was given to let the matrix in tikz behave like tabular. In this solution cell/.style={rectangle} was used to draw lines ...
12
votes
2answers
1k views

vertical dotted line in column vector / amsmath matrix

I would like to typeset the following set of equations: ... but with contiguous, vertical dotted lines in the column vectors, such that the top and bottom rows of the matrix and of the vectors are ...
12
votes
2answers
2k views

Array with labeling columns

Is there an intelligent way to label (or name) columns in a matrix? I would like to have something like \[M=\left[\begin{array}{c|cc} 1 & 2 & 3\\ 4 & 5 & 6 ...
12
votes
2answers
360 views

Long dashes for denoting omitted columns of a matrix

Mathematicians would often to like to think of a row of a m by n matrix with entries from a , say, field, as a vector in the n-dimensional vector space over the field. Though I am not a ...
12
votes
1answer
2k views

matrix in a matrix

I would like to draw a matrix with top left, top right, bottom left and bottom right blocks. The top left should be a 3x3 matrix with numerical entries, the top right is 0, the bottom left is 0 and ...
12
votes
1answer
226 views

Are there specialized libraries or packages to draw blocked/partitioned/splitting matrices in Tikz?

I need to write matrix splitting and factorization operations (for my linear algebra course). It is hard to do these is direct Latex. I can use Visio to draw these easily, but I'd prefer to use Tikz ...
12
votes
1answer
605 views

Enter matrices by columns rather than rows in TikZ

I find myself drawing a lot of quantum circuits these days, and I do them in TikZ because it produces very nice diagrams. A quantum circuit is a lot like staff (as in music). You go from left to ...
11
votes
3answers
246 views

How to create diagonal matrix with an aligned diagonal?

How do I display truly diagonal matrices? I want to have a diagonal bloc matrix. The solution below has several problems : the diagonal terms aren't really aligned in the first half, and the diagonal ...
11
votes
3answers
227 views

Avoiding overlapping superscripts and subscripts in matrices

I was working on some calculus today and tried to typeset a matrix of partial derivatives and ran into some trouble. Here is my code: \documentclass{minimal} \usepackage{mathtools} \begin{document} ...
11
votes
2answers
469 views

How can I add clips above matrix?

\documentclass{mwrep} \usepackage{kbordermatrix} \usepackage{amsmath} \begin{document} \begin{equation} \bar{P}= \kbordermatrix{ \mathrm{state} & 1 & 2 & 4 & 3 & 6 & ...
11
votes
2answers
2k views

Arrows at right angles on a tikzpicture matrix

I'm trying to do something pretty simple but haven't been able to find an answer so far. I have a flow chart and I want to draw straight arrows at right angles instead of 'bent' arrows, inside of a ...
11
votes
4answers
5k views

Diagonal dots spanning multiple lines/columns of a matrix

I'm filling in large sparse matrices, for example \begin{bmatrix} 0 & -2 & 1 & & -1 & 2 \\ 2 & \ddots & \ddots & \ddots & & -1 \\ ...
11
votes
3answers
754 views

Column sums in matrix array

I am trying to get my equation to look like the following: I cannot seem to get anywhere close (is there a way to get labels in \bordermatrix to go at the bottom?). Here is my code so far (without ...
11
votes
1answer
606 views

Correct delimiter height in TikZ

When using the left delimiter and right delimiter options, I am having the problem that their height is not equal to the node they are surrounding. Here is an example: \documentclass{article} ...
11
votes
3answers
3k views

Vertical vectors in angle brackets

I wanted to produce the following formula: which is nothing but a vertical vector in angle brackets. I expected the following code to do the job: \left\langle \begin{matrix} a \\ ...
10
votes
6answers
2k views

Labelling Ax = b under an actual Matrix

I wish to achieve the following in Latex: | a b | x | x1 | = | b1 | | c d | | x2 | | b2 | A x b Where I write the labels A, x, and b under the respective matrices. The code I'm ...
10
votes
3answers
1k views

Look for a bigger delimiter than \Bigg

\documentclass{article} \usepackage{amsmath} \begin{document} \[\left. \begin{vmatrix} a_{11}&a_{12}&a_{13}\\ a_{21}&a_{22}&a_{23}\\ a_{31}&a_{32}&a_{33} ...
10
votes
2answers
2k views

Problem with defining shortcuts for TikZ matrices.

For answering a question yesterday I wanted to define a shortcut for creating a matrix inside a tikzpicture. As a minimal example, consider \newcommand\mymatrix[1]{ \begin{tikzpicture} ...
10
votes
3answers
257 views

How to create vertical and horizontal dotted lines in a matrix?

Similar to this question, I am trying to output a similar matrix with dotted line instead of dashed line. Is there anyway to do this? I also try to use these three packages: ...
10
votes
3answers
162 views

How to provide more horizontal space between cases in a system?

I have the following ugly system: This is my LaTeX code: \newcommand{\Aaa}{\begin{bmatrix} 1 & 0 \\ 0 & -1\end{bmatrix}} \newcommand{\Ba}{\begin{bmatrix} 0 & 1 \\ -1 & ...
10
votes
2answers
1k views

Using brackets as delimiters for matrix in TikZ-PGF Matrix Library

The TikZ-PGF manual is clear that for the matrix library, the delimiters are parentheses and braces: Delimiters are parentheses or braces to the left and right of a formula or a matrix. I ...