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

learn more… | top users | synonyms (1)

56
votes
5answers
90k views

How to add a matrix to a LaTeX document

How do we add a matrix to a LaTeX document?
41
votes
8answers
9k 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} & ...
39
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 ...
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 ...
27
votes
4answers
4k 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} \\ ...
27
votes
2answers
5k 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 ...
26
votes
2answers
14k 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
5answers
34k 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 ...
24
votes
1answer
6k 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
8k 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 ...
21
votes
3answers
10k 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 \ ...
21
votes
2answers
6k 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 ...
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} ...
19
votes
3answers
955 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:
19
votes
1answer
3k 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} ...
18
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
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
4k 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
603 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
5answers
8k views

bordermatrix with blocks

I need to write a complicated matrix, that has a structure as in the attached picture.
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 ...
15
votes
5answers
847 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 ...
15
votes
1answer
608 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
8k 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
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} ...
14
votes
4answers
7k 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 \\ ...
14
votes
1answer
251 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 ...
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
4answers
972 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
3answers
371 views

Force latex to show a square matrix as square

How can i force latex to print out square matrix as a square matrix with equal width and height in math-mode? I also read amsmath documentation, but don't found any useful help on it. For example ...
13
votes
1answer
3k 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
2answers
438 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
3k 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
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} ...
12
votes
2answers
2k 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
388 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
6answers
2k views

Formatting arrows between rows of corresponding matrices

Some material I'm creating requires output that looks like this: (note the position of the arrows). I'm using the following code (with the AMS macros) to generate this, and I'm looking for ...
12
votes
1answer
630 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
325 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
276 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
531 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
3answers
807 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
664 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
5answers
352 views

drawing a matrix with its minors

I want to create something like this: This should be a matrix and I want to consider its minors which are drawn by __|. I want to draw also a line from one minor to a place outside of the matrix to ...
10
votes
4answers
438 views

Matrix with its name on it, of huge size

How can I replace the original matrix [L] which is of normal size with a huge one, like this figure shows (the red result is what I want):