Can you help me how to do that dashed line on this matrix ?

Can you help me how to do that dashed line on this matrix


I will add another simple solution if you like.

enter image description here

\[ \left[
1 &  2 \\ 
3 & 4 \\
5 & 6 \\ 
\end{array} \right] \]

ADDENDUM: 2020-7-24. Using {bNiceArray} of nicematrix package you will have the square brackets at the same position as in {bmatrix} of amsmath.




1 & 2 \\
3 & 4 \\
5 & 6

Remark: If you don't put \NiceMatrixOptions{letter-for-dotted-lines=V}, you will have a dotted line (drawn by nicematrix).

Result of the second code

| improve this answer | |
  • The dashes are of different lengths which is more or less inevitable if you have long dashes. Is it possible to make them shorter and more tightly packed? – Anush Jul 24 at 8:22
  • Instead of \left[\begin{NiceArray}...\end{NiceArray}\right], it's possible to use \begin{bNiceArray}...\end{bNiceArray} with the same result (which is a result similar to {bmatrix} of amsmath). – F. Pantigny Jul 24 at 8:48
  • @F.Pantigny Very kind F. Pantigny you are right totally. The reason of my addendum is the same: I'm using papeeria.com that can compile with your previous version of nicematrix (I use the most recent TeXlive2019). Please, can you edit my addenudum adding your screenshot? Thank you very much. – Sebastiano Jul 24 at 11:55
  • 1
    @Sebastiano: I have edited your addendum :-) – F. Pantigny Jul 24 at 12:38
  • @F.Pantigny Excellent. Always thank you. – Sebastiano Jul 24 at 12:42


        -2 & -4 \\
         2 & -1 \\
        -8 & 16

To obtain

enter image description here

| improve this answer | |
  • Unfortunately, it does not work for me; it (TeXStudio) says: Package array Error: Illegal pream-token (;): c' used. \begin{array}{c;{2pt/2pt}c} Package array Error: Illegal pream-token (2pt/2pt):c' used. \begin{array}{c;{2pt/2pt}c} – Alex Konnen Dec 13 '19 at 19:04
  • 1
    @AlexKonnen works fine here. add a MWE and I'll try to see what happens. – Denis Dec 18 '19 at 7:34
  • I have found the reason why it did not work: my document included \usepackage{tabularx}; I assume that \usepackage{arydshln} is somehow incompatible with the latter; if I remove tabularx, the code works, with tabularx it does not. – Alex Konnen Dec 19 '19 at 19:38
  • The vertical dashes seem to end with a short bold dash. Can this be avoided? – Anush Jul 24 at 8:24
  • You can try to modify the option of the dashed line. Here I set 2pt / 2pt. – Denis Jul 24 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.