4

I want to decrease the space between the vertical dots and the elements of my matrix. How can I achieve this?

\documentclass{article}

\usepackage{amsmath,amssymb,mathtools,nicematrix}
\NiceMatrixOptions{transparent}


\begin{document}
\begin{align}
    \begin{bNiceMatrix}
    zI-A&\vdots&-B\\\cdots&\cdots&\cdots\\C&\vdots&D
    \end{bNiceMatrix}\begin{bNiceMatrix}
    x_z\\\cdots\\u_z
    \end{bNiceMatrix}&=0\\
    \begin{bNiceMatrix}
    z+2&0&0&\vdots&-2&0\\0&z+1&0&\vdots&0&-2\\0&0&z+2&\vdots&0&-1\\\cdots&\cdots&\cdots&\cdots&\cdots&\cdots\\
    0.5&1&0&\vdots&0&0\\0.5&0&1&\vdots&0&0
    \end{bNiceMatrix}\begin{bNiceMatrix}
    x_{z_1}\\x_{z_2}\\x_{z_3}\\\cdots\\\frac{1}{\sqrt{2}}\\-\frac{1}{\sqrt{2}}
    \end{bNiceMatrix}&=\begin{bNiceMatrix}
    0\\0\\0\\0\\0
    \end{bNiceMatrix}
\end{align}

\end{document}

As you can see there is an awkward space between the matrix elements and dot lines. How can I decrease this space? Matrix Example

5
  • Welcome. Have you seen into the manual nicematrix tug.org/texlive//Contents/live/texmf-dist/doc/latex/nicematrix/…? I think that is important also the pag 7 and § 6.3. Regards.
    – Sebastiano
    Mar 30, 2019 at 13:24
  • @Sebastiano I've read it but I can't find anything on spacing. If it's there, unfortunately, I'm unable to locate or understand it.
    – Al_Fh
    Mar 30, 2019 at 13:28
  • Don't worry about it. Here are always some great users who will help you for sure.
    – Sebastiano
    Mar 30, 2019 at 13:35
  • 1
    Thanks for the encouragement @Sebastiano
    – Al_Fh
    Mar 30, 2019 at 13:38
  • 1
    I see no way to change the spacing between the dots.
    – egreg
    Mar 30, 2019 at 14:13

2 Answers 2

2

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$  

Result with array

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$   

Result with NiceArray

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$  

Result with a dotted line of nicematrix

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$  

Result with arydshln

2
  • 1
    My sincere congratulations for to have written a new version of nicematrix that I like very much. You can see my profile with some answer for this package. Thank you very much for your precious contribute. +1
    – Sebastiano
    Jul 4, 2019 at 11:42
  • 1
    Thank you very much. This is excellent news. Much appreciated!
    – Al_Fh
    Jul 6, 2019 at 12:04
3

So after looking around I couldn't find anything in the package however I was able to use the 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}

Better spacing matrix

Using the environment instead of "NiceArray" will fix the problem of "\hdashline" dash lines exceeding the matrix length while allowing the advantages of package.

Matrix, where dash lines don't exceed the martrix width

p.s: Feel free to edit if you have the time. English isn't my first language.

You must log in to answer this question.

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