# Why subfigure are not centered

I'm using beamer with subfigure. I would center it but doesn't work. Why? A MWE follows:

\documentclass{beamer}
\mode<presentation>

\usetheme{Warsaw}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{frame}
\begin{figure}\centering
\parbox{1.3in}{
A
}
\begin{minipage}{1.3in}
B
\end{minipage}
\end{figure}
\end{frame}
\end{document}
-
Weird solution: Move the centering commands into the parbox and minipage. –  percusse May 8 '12 at 9:57
As percusse says: \parbox doesn't carry on the \centering command and resets to justified text. –  egreg May 8 '12 at 10:00
You should be place a % after the { behind \parbox, otherwise you the line break will be taken as a space which will effect the effective alignment. –  Martin Scharrer May 8 '12 at 10:58

As you can see in next code, your figure is already centered, but what parbox and minipage contain is not centered. As percusse and egreg told you, move \centering inside both environments and you will have everithing centered.

\documentclass{beamer}
\mode<presentation>

\usetheme{Warsaw}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}

\begin{document}
\begin{frame}

\lipsum[2]

\begin{figure}
\fbox{\parbox{1.3in}{%
A
}}
\begin{minipage}{1.3in}
B
\end{minipage}}
\end{figure}

\begin{figure}
\fbox{\parbox{1.3in}{\centering
A
}}