# [texhax] Difference between \centering and \begin{centering}...

Stephen Hicks sdh33 at cornell.edu
Sat Sep 11 19:56:06 CEST 2010

There isn't much difference.  \begin{centering} basically expands to
\begingroup\centering, while \end{centering} expands to \endgroup
because (IIRC) \endcentering isn't defined.

The reason it's not working properly with your tabular environment is
much more subtle, and unfortunately I can't give a good explanation,
other than to comment that \\ seems to do weird stuff with the
grouping (i.e. I've found that local definitions get lost between
rows), presumably expanding to something like
\endgroup\dosomestuff\begingroup, though this might actually be built
into TeX's alignment routines for all I know.  Without seeing how
you're using it, though, I can't really explain why \centering works,
though...

steve

On Thu, Sep 9, 2010 at 2:57 PM, Daniel Freedman
<freedman at physics.cornell.edu> wrote:
> Hi,
>
> I'm trying to understand the difference between the use of:
>
>  \centering
>
> and the use of
>
>  \begin{centering}
>  ...
>  \end{centering}
>
> I'm well aware of the difference between either of these and the use
> of the 'center' environment (this establishing a separate environment,
> which adds some more vertical 'glue' space, as I understand it).
>
> However, I thought the first two above should be identical.  Indeed,
> when I use them to center figures, they seem to work identically.
> However, it's interesting that the latter does NOT seem to work to
> center 'tabular' enrivonments, while the former does...
>
> Can someone educate me, please?  :)
>
> Thanks,
> Daniel
>
> --
> Daniel Freedman <{freedman at physics | dfreedman at cs}.cornell.edu>
>  Post-Doc, Distributed Systems, Computer Science, Cornell University
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/