[texhax] Put figure/table in the center

Ross Moore ross at ics.mq.edu.au
Sun Oct 26 15:00:19 CET 2003


Hello Tran,

On Sun, 26 Oct 2003, Tran Hong Quang wrote:

> Hi all,
>
> How can I put figure/table in the center?

\begin{figure}
\begin{center}
 .... whatever ....
 .... more stuff ...
\end{center}
\caption{....}
\end{figure}

works for most instances of  ... whatever ...

However, you may come across some environments for which this
doesn't work, due to TeX's vertical/horizontal mode mechanism.
In that case, a simple fix is to stat as follows:

\begin{figure}
\begin{center}\leavevmode
              ^^^^^^^^^^^

I use this a lot with Xy-pic diagrams, which create a TeX \hbox:

\begin{figure}
\begin{center}\leavevmode
 ... perhaps some customising definitions ...
\begin{xy}
....
....
\end{xy}
etc.


>
> Thanks

Hope this helps,

	Ross Moore

>
> _______________________________________________
> TeX FAQ: http://faq.tug.org/
> TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
>


More information about the texhax mailing list