LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   [LaTeX] Centreing a xymatrix in figure environment (https://www.linuxquestions.org/questions/linux-software-2/%5Blatex%5D-centreing-a-xymatrix-in-figure-environment-332666/)

solarize 06-12-2005 01:35 AM

[LaTeX] Centreing a xymatrix in figure environment
 
I'm trying to center some xy-pic code but using \centering or center environments fails to do so. Anybody know why and how I can solve it?

Here the code I try to center:

Code:

\begin{figure}
\centering
\xymatrix@-1pc@R=10pt@C=0.4pt{
& & & & & *+[F-:<5pt>]{Q_r} \ar@{-}[dl] \ar@{-}[dr] \\
& & & & *+[F]{S_1} \ar@{-}[dl] & \ldots & *+[F]{S_n} \ar@{-}[dr] \\
& & & *+[F-:<5pt>]{Q_1} \ar@{-}[dl] \ar@{-}[dr] & & \ldots & &
*+[F-:<5pt>]{Q_n} \ar@{-}[dl] \ar@{-}[dr]\\
& & *+[F]{S_{n+1}} \ar@{-}[dl] & \ldots & *+[F]{S_{n+m}} \ar@{-}[dr] & & & & &\\
& *+[F-:<10pt>]{Q_{n+1}} \ar@{-}[dl] \ar@{-}[dr] & & \ldots & &
*+[F-:<10pt>]{Q_{n+m}} \ar@{-}[dl] \ar@{-}[dr] & & & \\
& & & & & & &
}
\caption{A DPN domain graph.}
\label{fig:dpn_cluster}
\end{figure}


jgombos 06-12-2005 06:58 PM

I'm not familiar with the type of object you're centering, or if it has any special requirements. My knee-jerk suggestion would be to try doing an \hfill before and after your xypic, or whatever the heck that thing is. If you get to a point where you're ready to give up on an elegent solution, you can always force some space on the left using \hspace.

mjrich 06-12-2005 07:10 PM

You can use \centerline{} if you wish. Thus, your code becomes
Code:

\begin{figure}

\centerline{
\xymatrix@-1pc@R=10pt@C=0.4pt{
& & & & & *+[F-:<5pt>]{Q_r} \ar@{-}[dl] \ar@{-}[dr] \\
& & & & *+[F]{S_1} \ar@{-}[dl] & \ldots & *+[F]{S_n} \ar@{-}[dr] \\
& & & *+[F-:<5pt>]{Q_1} \ar@{-}[dl] \ar@{-}[dr] & & \ldots & &
*+[F-:<5pt>]{Q_n} \ar@{-}[dl] \ar@{-}[dr]\\
& & *+[F]{S_{n+1}} \ar@{-}[dl] & \ldots & *+[F]{S_{n+m}} \ar@{-}[dr] & & & & &\\
& *+[F-:<10pt>]{Q_{n+1}} \ar@{-}[dl] \ar@{-}[dr] & & \ldots & &
*+[F-:<10pt>]{Q_{n+m}} \ar@{-}[dl] \ar@{-}[dr] & & & \\
& & & & & & &
}
}
\caption{A DPN domain graph.}
\label{fig:dpn_cluster}

\end{figure}

Cheers,

mj

solarize 06-13-2005 01:44 AM

Super.... centerline{} worked. Thanks!

Although strange that \centering and \begin{center} ... \end{center} didn't?!?!?!?


All times are GMT -5. The time now is 12:20 AM.