5

Is it possible to shorten the vertical line in `tabularray? I would like to use it for augmented matrices as follows, but I find the line too long:

\documentclass[a4paper]{article} 
\usepackage{amsmath}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}
\begin{equation*}
M =
\begin{+pmatrix}[vline{Y,Y} = {1,Z}{.1pt}]
123 & 2  & 9    & 3 \\
1   & -3 & -600 & 3 \\
\end{+pmatrix}
\end{equation*}
\end{document}

enter image description here

2 Answers 2

6

You can make use of the options abovepos and belowpos. With value -1, "the vline is trimmed by rowsep" as stated in the manual. You need to define this separately for the upper and the lower row, however:

\documentclass[a4paper]{article} 
\usepackage{amsmath}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}
\begin{equation*}
M =
\begin{+pmatrix}[
        vline{Y} = {1}{abovepos = -1}, 
        vline{Y} = {Z}{belowpos = -1}
    ]
123 & 2  & 9    & 3 \\
1   & -3 & -600 & 3 \\
\end{+pmatrix}
\end{equation*}
\end{document}

enter image description here

In case you want to add a third row or even more rows, you would need to additionally define these middle rows:

\documentclass[a4paper]{article} 
\usepackage{amsmath}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}
\begin{equation*}
M =
\begin{+pmatrix}[
        vline{Y} = {1}{abovepos = -1}, 
        vline{Y} = {2-Y}{},
        vline{Y} = {Z}{belowpos = -1}
    ]
123 & 2  & 9    & 3 \\
1   & -3 & -600 & 3 \\
1   & -3 & -600 & 3 \\
1   & -3 & -600 & 3 \\
\end{+pmatrix}
\end{equation*}
\end{document}

enter image description here

I changed the line width to the default 0.4 pt, since I think that 0.1 pt is a bit too thin. But feel free to change to vline{Y} = {1}{0.1pt, abovepos = -1} or whatever you like.

3

Between the matrices there is an interesting package called spalign. Usage: \spalignaugmatn [column alignment]{augmented columns}{text} produces a matrix with a vertical divider located augmented columns from the right side of the matrix. The column alignment is interpreted as in \spalignmat; the default is r. The result is fine and it is as nicematrix and tabularray.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{spalign}


\begin{document}
\[\spalignaugmatn[l]{1}{123 2 9 3;1 -3 -600 3}\]
\[\spalignaugmatn[c]{1}{123 2 9 3;1 -3 -600 3}\]
\[\spalignaugmatn[r]{1}{123 2 9 3;1 -3 -600 3}\]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .