0

In the following beamer frame, I want the description text to stay top-left, while the xymatrix-figure should be centered. However, whatever I tried with \centering, \begin{center} and other online found solution, I've always gotten the diagram aligned left.

\begin{frame}
  \frametitle{Butterfly network}

  Some text

  \begin{figure}[b]
    \begin{center}
      \begin{displaymath}
          \xymatrix@R=0.9pc@C=3.5pc{
            S_1 \ar@{.>}[rd] \ar@{.>}[ddd] & & S_2 \ar@{.>}[ld] \ar@{.>}[ddd] \\
            & A_1 \ar@{.>}[d] & \\
            & A_2 \ar@{.>}[ld] \ar@{.>}[rd] & \\
            R_2 &  & R_1 \\
          }
      \end{displaymath}
    \end{center}
  \end{figure}
\end{frame}

PS I'm quite new to LaTeX, explanation why this solution doesn't work would be very welcome.

EDIT: Wrapping \xymatrix inside \centerline has made the diagram appear almost in the middle, a little to far right...

PSS Running TexLive 2013 on OpenSuSe 13.1

1

I don't know, what the problem is for you, but as you do not provide a complete MWE, I can only do as you requested. The matrix is centred. I reduced the code a little bit.

% arara: pdflatex

\documentclass{beamer}
\usepackage[all]{xypic}

\begin{document}
\begin{frame}
  \frametitle{Butterfly network}
  Some text
      \begin{displaymath}
          \xymatrix@R=0.9pc@C=3.5pc{
            S_1 \ar@{.>}[rd] \ar@{.>}[ddd] & & S_2 \ar@{.>}[ld] \ar@{.>}[ddd] \\
            & A_1 \ar@{.>}[d] & \\
            & A_2 \ar@{.>}[ld] \ar@{.>}[rd] & \\
            R_2 &  & R_1}
      \end{displaymath}
\end{frame}
\end{document}

enter image description here

If you are still having problems, you may try the tikz-cd package instead. Maybe, this is working for you.

% arara: pdflatex

\documentclass{beamer}
\usepackage{tikz-cd}

\begin{document}
\begin{frame}[fragile]
\frametitle{Butterfly network}
Some text
    \[
    \begin{tikzcd}[row sep=small]
    S_1 \ar[dotted]{rd} \ar[dotted]{ddd} & & S_2 \ar[dotted]{ld} \ar[dotted]{ddd} \\
    & A_1 \ar[dotted]{d} & \\
    & A_2 \ar[dotted]{ld} \ar[dotted]{rd} & \\
    R_2 & & R_1
    \end{tikzcd}
    \]
\end{frame}
\end{document}
  • 1
    Sorry for forgetting about MWE. I've switched to tikzcd and now it appears centered (without any outer code change). The mysteries of ..TeX... Thank you! – Maverick Jun 5 '14 at 11:14

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.