4

I recently found the nicematrix package, and I am using it to for scripting.

Since my goal is to have a macro/environment which makes an augmented matrix (vertical line before the last column in my case), I was searching for a way to pass something like RRR|R as format string to pNiceMatrix.

Soon I figured out that this is not possible (right?) and found that the NiceArray environment would support this.

Since setting the parentheses is not a problem (I can specify this in my macro/environment declaration, thus later this is irrelevant),

I was wondering if I'd have any drawbacks by moving from pNiceMatrix to NiceArray?

atticus
  • 557

1 Answers1

5

For a matrix with (let's say) 3 columns, there is no difference between {pNiceMatrix} and {pNiceArray}{CCC}.

If you want a vertical rule, indeed, you need {pNiceArray} in order to have a explicit preamble.

\documentclass{article}

\usepackage{nicematrix}

\begin{document}

$\begin{pNiceMatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 
\end{pNiceMatrix}
\qquad
\begin{pNiceArray}{CCC}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 
\end{pNiceArray}
\qquad
\begin{pNiceArray}{CC|C}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 
\end{pNiceArray}$

\end{document}

Result of the above code

F. Pantigny
  • 40,250
  • Ok thanks. This is the last step of my gaussMatrix environment for now. I've got just one little problem with pgfkeys and nicematrix (new post https://tex.stackexchange.com/questions/548110/pgfkeys-and-nicematrix-calculate-with-pgfkeys-and-use-in-niceatrix-preamble) – atticus Jun 06 '20 at 16:42
  • 1
    You should accept the answer. I will see the other question. – F. Pantigny Jun 06 '20 at 16:46
  • Thanks for the remainder ;) Now I think I'm finish with the environment (for now), if you're interested, look at https://gitlab.com/AtticusSullivan/gaussenv ;) (and thanks for all your help again) – atticus Jun 06 '20 at 17:37
  • 1
    In this answer, since version 5.0 of nicematrix one must write c instead of C in the preambles of the {pNiceArray} (but there is an option for backward compatibility). – F. Pantigny Jul 18 '20 at 21:12