Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
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
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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