How to decrease the space between the matrix elements and the dots in nicematrix package?
So after looking around I couldn't find anything in the nicematrix package however I was able to use the arydshln package to solve the problem. So by using this package and using the NiceArray environment I was able to circumvent my problem.
\documentclass{article}
\usepackage{amsmath,amssymb,mathtools,nicematrix,arydshln}
\NiceMatrixOptions{transparent}
\begin{document}
\begin{align}
\left[ \begin{NiceArray}{c;{1pt/2pt}c}
zI-A & -B\\
\hdashline[1pt/2pt]
C & D \end{NiceArray} \right]
\left[\begin{array}{c}
x_z\\\hdashline[1pt/2pt] u_z
\end{array}\right]&=0\\
\left[ \begin{NiceArray}{ccc;{1pt/2pt}cc}
z+2&0&0&-2&0\\0&z+1&0&0&-2\\0&0&z+2&0&-1\\\hdashline[1pt/2pt]
0.5&1&0&0&0\\0.5&0&1&0&0
\end{NiceArray}\right]
\left[ \begin{NiceArray}{c}
x_{z_1}\\x_{z_2}\\x_{z_3}\\ \hdashline[1pt/2pt] \frac{1}{\sqrt{2}}\\-\frac{1}{\sqrt{2}}
\end{NiceArray}\right] &=\left[ \begin{NiceArray}{c}
0\\0\\0\\\hdashline[1pt/2pt]0\\0
\end{NiceArray} \right]
\end{align}
\end{document}
Using the array environment instead of "NiceArray" will fix the problem of "\hdashline" dash lines exceeding the matrix length while allowing the advantages of nicematrix package.
p.s: Feel free to edit if you have the time. English isn't my first language.
I have written a new version of nicematrix
(version 2.2.1, 2019-07-02) to face that problem.
With the classical environmment array
, you can write:
$\left[\begin{array}{c|c}
zI-A&-B\\
\hline
C &D
\end{array}\right]
\left[\begin{array}{c}
x_z\\
\hline
u_z
\end{array}
\right]
=0$
With the environment NiceArray
, if you want to have exactly the same result, you have to use the options
left-margin
and right-margin
:
\NiceMatrixOptions{left-margin,right-margin}
$\left[\begin{NiceArray}{C|C}
zI-A&-B\\
\hline
C &D
\end{NiceArray}\right]
\left[\begin{NiceArray}{C}
x_z\\
\hline
u_z
\end{NiceArray}
\right]
=0$
You can now use the new features of nicematrix
to draw dotted lines with a :
in the preamble of the array:
\NiceMatrixOptions{left-margin,right-margin}
$\left[\begin{NiceArray}{C:C}
zI-A&-B\\
\hdottedline
C &D
\end{NiceArray}\right]
\left[\begin{NiceArray}{C}
x_z\\
\hdottedline
u_z
\end{NiceArray}
\right]
=0$
If you want to use arydshln
within the environments NiceArray
, you have to 'free' the specifier
:
with the option letter-for-dotted-lines
:
\NiceMatrixOptions{left-margin,right-margin,letter-for-dotted-lines=V}
$\left[\begin{NiceArray}{C:C}
zI-A&-B\\
\hdashline
C &D
\end{NiceArray}\right]
\left[\begin{NiceArray}{C}
x_z\\
\hdashline
u_z
\end{NiceArray}
\right]
=0$