# nicematrix \ddots has different performances in different documentclass

When I use \documentclass{article}, just like (no problem)

\documentclass{article}
\usepackage{nicematrix}
\NiceMatrixOptions{transparent,nullify-dots}

\newcommand{\underbracedmatrix}[2]{%
\left(\;
\smash[b]{\underbrace{
\begin{NiceMatrix}[columns-width = auto]#1\end{NiceMatrix}
}_{#2}}
\;\right)
\vphantom{\underbrace{\begin{NiceMatrix}#1\end{NiceMatrix}}_{#2}}
}

\begin{document}
$$K= \underbracedmatrix{ 3 & 1 & & & \\ 1 & 2 & 1 & & \\ & 1 &\ddots&\ddots& \\ & &\ddots& 3 & 1 \\ & & & 1 & 1 \\}{n}$$
\end{document}


But when I use \documentclass{revtex4-1}, it just like

\documentclass{revtex4-1}
\usepackage{nicematrix}
\NiceMatrixOptions{transparent,nullify-dots}

\newcommand{\underbracedmatrix}[2]{%
\left(\;
\smash[b]{\underbrace{
\begin{NiceMatrix}[columns-width = auto]#1\end{NiceMatrix}
}_{#2}}
\;\right)
\vphantom{\underbrace{\begin{NiceMatrix}#1\end{NiceMatrix}}_{#2}}
}

\begin{document}

$$K= \underbracedmatrix{ 3 & 1 & & & \\ 1 & 2 & 1 & & \\ & 1 &\ddots&\ddots& \\ & &\ddots& 3 & 1 \\ & & & 1 & 1 \\}{n}$$

\end{document}


I do not know how to fix it.

• Welcome to tex.se! Where is available document class vertex4-1? prob ably it should be revtex4-1 . With this package the result is as you reported. – Zarko May 17 at 16:37
• @Zarko Oh, my mistake! Yes, It is 'revtex4-1', but the problem still exists. – LamGF May 17 at 17:18
• I will try to find a solution to this problem (I wrote the extension nicematrix). – F. Pantigny May 26 at 7:54
• @F.Pantigny Thanks a lot! The new version (2.1.5 2019-05-27) works well on revtex4-1 and revtex4-2. – LamGF May 29 at 21:04

I have written a new version of nicematrix to solve this problem. The new version (2.1.5 2019-05-27) is now compatible with the classes revtex4-1 and revtex4-2.