How to symmetricize this nxn Identity matrix

With nicematrix:

\documentclass{article}
\usepackage{nicematrix}

\begin{document}
$\begin{pNiceMatrix}[nullify-dots,xdots/shorten=4pt]
1 & 0 & & \Cdots & & 0 \\
0 & 1 & \Ddots & & & \Vdots \\
\Vdots &  \Ddots & \Ddots \\
\\
  &   & &        & & 0 \\
0 & \Cdots & & & 0 & 1
\end{pNiceMatrix}$
\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Output of the above code


One more with nicematrix:

enter image description here

\documentclass[12pt]{article}
\usepackage{nicematrix}

\begin{document}
    \[
\mathbf{I} =
\begin{bNiceMatrix}
1   &       & \Block{2-3}<\huge>{0} \\
    &   1   &        &      &       \\
    &       &   1    &      &       \\
\Block{2-3}<\huge>{0}
    &       &       & \Ddots    &   \\
    &       &       &      &   1   \\
\end{bNiceMatrix}
    \]
\end{document}

Tags:

Matrices