4

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
                }
                \qquad
                \begin{minipage}{1.3in}
                    B           
                \end{minipage}
            \end{figure}
        \end{frame} 
\end{document}
  • 1
    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
4

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
                }}
                \qquad\fbox{%
                \begin{minipage}{1.3in}
                    B           
                \end{minipage}}
            \end{figure}

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

        \end{frame} 
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.