# How to write dimensions below a matrix

I would like to write the dimensions of a matrix below the matrix itself, but I managed only to either:

1. write the dimensions below the matrix with underbrace (see matrix A in my code)
2. write the dimensions as a subscript of the matrix (see matrix B in my code)

What I want is (1) but without any underbrace sign, and possibly the n*n written in a smaller font. I attach below a MWE

\documentclass{beamer}

\usepackage{amssymb}
\usepackage{mathpazo}
\usepackage{multimedia}
\usepackage{amsfonts}
\usepackage{amsmath}

\setcounter{MaxMatrixCols}{10}

\title{Title}
\subtitle{Subtitle}
\author{Author}
\date{}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\section{Introduction}

\begin{frame}\frametitle{Write dimensions below matrix}
\begin{center}
$\begin{bmatrix} \underbrace{A}_{n\times n} & B_{n\times n} \\ C & D% \end{bmatrix}%$
\end{center}

\end{frame}
\end{document}


Use \underset, with \scriptscriptstyle in order to reduce the size.

Note that loading mathpazo does nothing unless you select suitable font themes.

\documentclass{beamer}

\usefonttheme{serif}
\usefonttheme{professionalfonts}
\usepackage{mathpazo}

\begin{document}

\begin{frame}\frametitle{Write dimensions below matrix}

$\begin{bmatrix} \underset{\scriptscriptstyle n\times n}{A} & \underset{\scriptscriptstyle n\times n}{B} \\[1.5ex] C & D \end{bmatrix}$

\end{frame}
\end{document}


Avoid awkward constructions such as \begin{center}$<formula>$\end{center}: displaymath is much better, with its shorthand $...$.

with using of the package stackengine:

\documentclass{beamer}

\usepackage{amssymb}
\usepackage{mathpazo}
%\usepackage{multimedia} not relevant for your problem
\usepackage{amsmath}
%\setcounter{MaxMatrixCols}{10}
\usepackage{stackengine}

\begin{document}

\begin{frame}
\frametitle{Write dimensions below matrix}
$\stackMath \begin{bmatrix} \stackunder{A}{_{n\times n}} & \stackunder{B}{_{n\times n}} \\[2ex] C & D \end{bmatrix}%$
\end{frame}
\end{document}


or see, if writing matrix symbol in \mathbf{...} better emphasize matrices:

\begin{frame}
\frametitle{Write dimensions below matrix}
$\stackMath \begin{bmatrix} \stackunder{\mathbf{A}}{_{n\times n}} & \stackunder{\mathbf{B}}{_{n\times n}} \\[2ex] C & D \end{bmatrix}%$
\end{frame}


which gives