Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Figure environment definition in a class

5 views
Skip to first unread message

Lynda Metref

unread,
Oct 29, 2009, 4:19:20 AM10/29/09
to
Hello,

I want to write a class for a thesis and I get stuck when defining the
figure environment. I used the book class as basis and the goal is to
have all figure environments centred.

I have tried this:
\renewenvironment{figure}
{\@float{figure} \centering}
{\end@float}
but now the argument [htb] used to give a hint on the figure position
is not taken into account any more.

Any idea?

Thank you

Joseph Wright

unread,
Oct 29, 2009, 5:02:26 AM10/29/09
to

The trick is not to redefine figure but to mess with some internals.

\let\orig@floatboxreset\@floatboxreset
\def\@floatboxreset{%
\centering
\orig@floatboxreset
}

(If the floatrow package is going to be used, instead use its
objectset=centering setting.)
--
Joseph Wright

Enrico Gregorio

unread,
Oct 29, 2009, 5:10:27 AM10/29/09
to
Joseph Wright <joseph...@morningstar2.co.uk> wrote:

> On Oct 29, 8:19ÔøΩam, Lynda Metref <lynda.met...@gmail.com> wrote:
> > Hello,
> >
> > I want to write a class for a thesis and I get stuck when defining the
> > figure environment. I used the book class as basis and the goal is to
> > have all figure environments centred.
> >
> > I have tried this:
> > \renewenvironment{figure}

> > ÔøΩ ÔøΩ ÔøΩ ÔøΩ {\@float{figure} \centering}
> > ÔøΩ ÔøΩ ÔøΩ ÔøΩ {\end@float}


> > but now the argument [htb] used to give a hint on the figure position
> > is not taken into account any more.
> >
> > Any idea?
> >
> > Thank you
>
> The trick is not to redefine figure but to mess with some internals.
>
> \let\orig@floatboxreset\@floatboxreset
> \def\@floatboxreset{%
> \centering
> \orig@floatboxreset
> }

It's easier with

\g@addto@macro\@floatboxreset{\centering}

which is mostly equivalent to your solution, but avoids a new
command. I'd put \centering last anyway, after \@setminipage,
but I don't actually know if this makes a difference. :)

Both approaches have the drawback that also table environments
will be centered.

Ciao
Enrico

Joseph Wright

unread,
Oct 29, 2009, 5:46:57 AM10/29/09
to
On Oct 29, 9:10 am, Enrico Gregorio <grego...@math.unipd.it> wrote:
> Both approaches have the drawback that also table environments
> will be centered.
>
> Ciao
> Enrico

I'd call that a good thing :-)
--
Joseph Wright

Lynda Metref

unread,
Oct 29, 2009, 6:13:43 AM10/29/09
to
It works well!!!
Thank you all :)


On Oct 29, 10:46 am, Joseph Wright <joseph.wri...@morningstar2.co.uk>
wrote:

Enrico Gregorio

unread,
Oct 29, 2009, 7:50:07 AM10/29/09
to
Joseph Wright <joseph...@morningstar2.co.uk> wrote:

> On Oct 29, 9:10ÔøΩam, Enrico Gregorio <grego...@math.unipd.it> wrote:
> > Both approaches have the drawback that also table environments
> > will be centered.
> >
> > Ciao
> > Enrico
>
> I'd call that a good thing :-)

One never knows what self-made publishers like to do. :)

Ciao
Enrico

0 new messages