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?

1 Answer 1

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

4
  • 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 tex.stackexchange.com/questions/548110/…)
    – atticus
    Commented Jun 6, 2020 at 16:42
  • 1
    You should accept the answer. I will see the other question. Commented Jun 6, 2020 at 16:46
  • Thanks for the remainder ;) Now I think I'm finish with the environment (for now), if you're interested, look at gitlab.com/AtticusSullivan/gaussenv ;) (and thanks for all your help again)
    – atticus
    Commented Jun 6, 2020 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). Commented Jul 18, 2020 at 21:12

You must log in to answer this question.

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