Sorry if this has been asked before, I am trying to produce a matrix that appears as in the linked image. In particular, I am wondering how to get the labels on the top and bottom of the matrices, as well as the dots indicating continuation in the matrix contents
[Tex/LaTex] Produce matrix with labels underneath
matrices
Related Solutions
Here's a possible code for the first matrix:
\documentclass{book}
\usepackage{easybmat}
\begin{document}
\[
A= \delta^{-2}
\left(
\begin{BMAT}[8pt]{cc:cc:cc:c}{cc:cc:cc:c}
1 & -1 & 0 & & & & 0 \\
-1 & 1 & 0 & 0 & 0 & & \\
0 & 0 & \bullet & \bullet & 0 & &\\
& 0 & \bullet & \bullet & 0 & 0 & \\
& & 0 & 0 & \bullet & \bullet & 0 \\
& & & 0 & \bullet & \bullet & 0 \\
0 & & & 0 & 0 &0 &
\end{BMAT}
\right)
\]
\end{document}
Using this example code you can easily build the second matrix.
The gmatrix
environment uses low level table making functions, which are affected by the current baseline skip, which is increased in align
.
An easy modification of https://tex.stackexchange.com/a/337481/4427 solves the problem. See the answer for more options to xgmatrix
.
\documentclass{article}
\usepackage{amsmath}
\usepackage{gauss}
\usepackage{xparse}
\newcommand{\BAR}{%
\hspace{-\arraycolsep}%
\strut\vrule
\hspace{-\arraycolsep}%
}
\ExplSyntaxOn
\keys_define:nn { gauss }
{
type .tl_set:N = \l_gauss_type_tl,
type .initial:n = {},
right .code:n = \tl_set:cn { g@post } { \relax$ },
right .value_forbidden:n = true,
spread .tl_set:N = \l_gauss_spread_tl,
spread .initial:n = 1,
colsep .dim_set:N = \l_gauss_colsep_dim,
colsep .initial:n = \arraycolsep,
}
\NewDocumentEnvironment{xgmatrix}{O{}}
{
\keys_set:nn { gauss } { #1 }
\normalbaselines % <----------- ADDED
\linespread{\l_gauss_spread_tl}\selectfont
\setlength{\arraycolsep}{\l_gauss_colsep_dim}
\begin{gmatrix}[\l_gauss_type_tl]
}
{
\end{gmatrix}
}
\ExplSyntaxOff
\begin{document}
\[
\begin{gmatrix}[b]
1 & 2 & \BAR & 3 \\
4 & 5 & \BAR & 6 \\
7 & 8 & \BAR & 9
\rowops
\swap{0}{1}
\mult{0}{\cdot 7}
\add[5]{1}{2}
\end{gmatrix}
\]
\begin{align*}
\begin{gmatrix}[b]
1 & 2 & \BAR & 3 \\
4 & 5 & \BAR & 6 \\
7 & 8 & \BAR & 9
\rowops
\swap{0}{1}
\mult{0}{\cdot 7}
\add[5]{1}{2}
\end{gmatrix}
\end{align*}
\begin{align*}
\begin{xgmatrix}[type=b]
1 & 2 & \BAR & 3 \\
4 & 5 & \BAR & 6 \\
7 & 8 & \BAR & 9
\rowops
\swap{0}{1}
\mult{0}{\cdot 7}
\add[5]{1}{2}
\end{xgmatrix}
\end{align*}
\end{document}
Best Answer
If not closed, then this might as well have an answer. Here are a few ways of producing, for example, the second matrix above:
Which give, respectively:
To my eye, the third option produces the best spacing. However, the second two methods work only by virtue of the underset and overset text being in the center column. If it were in a different column, then the first method might be modified to give better spacing, or one of the answers linked in the comments might be preferable.