I would like to translate my approach to center all figure environments to figure* environments. How?

% \def\figure{\def\@floatboxreset{\reset@font\normalsize\@setminipage\@IEEEfiguretopskipspace}\@float{figure}}
% \@namedef{figure*}{\def\@floatboxreset{\reset@font\normalsize\@setminipage\@IEEEfiguretopskipspace}\@dblfloat{figure}}
% \patchcmd{\figure*}{\normalsize}{\normalsize\centering}{}{error}
        not centered!

The straightforward approach up there does not work, probably due to the use of \@namedef instead of \def.

  • The reference to \@nameref is completely irrelevant, in my point of view
    – user31729
    Commented Jan 15, 2016 at 21:54
  • Yes, I changed the title of the question already. Thanks!
    – bers
    Commented Jan 15, 2016 at 21:56
  • Actually I meant the reference to \@nameref in the new title ;-)
    – user31729
    Commented Jan 16, 2016 at 9:12
  • actually, a better title would be "how to patch a starred environment". Commented Jan 16, 2016 at 16:59

1 Answer 1


In order to patch an environment such as figure* you can do

\expandafter\patchcmd\csname figure*\endcsname{....}{...}{}{}

This method is ineffective with commands such as \section*, which are defined in a completely different way.

On the other hand, if you just want to add \centering to all floats, you can just add \centering to \@floatboxreset:


This will influence also table and other floats, though.

  • Thanks! Knowing now that the star may be the culprit, I wonder how long it takes until someone shows me dozens of duplicates for this simple question...
    – bers
    Commented Jan 15, 2016 at 21:54
  • You could probably mention that this method only works for starred environments like the example of figure* even though the question title talks of commands (\section* for example is rather different, as you know:-) Commented Jan 15, 2016 at 22:03
  • @DavidCarlisle I was from the phone.
    – egreg
    Commented Jan 15, 2016 at 23:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .