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.

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

share|improve this question
    
I get it al right: i.stack.imgur.com/n3R6P.png –  Harish Kumar May 20 at 15:38
    
I've removed custom theme from preamble and still get this: imgur.com/HePuUxi –  Ilya E. May 20 at 15:49
    
@IlyaE. the link in your comment is broken. –  Gonzalo Medina May 20 at 15:52
    
Are you sure? Works here well. –  Ilya E. May 20 at 15:58

1 Answer 1

up vote 1 down vote accepted

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}
share|improve this answer
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! –  Ilya E. Jun 5 at 11:14

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.