To produce html and pdf files from the same set of sources I need to transform all wrapfigure environments (package wrapfig) to standard figure environments. One example is:

\caption{La traiettoria bla bla.}

Defining something like this (and not loading wrapfig package):


works but leaves an annoying ']i0pt' between image and caption. Any idea (except manual editing of the resulting html...) Thanks!

  • 3
    try: \newenvironment{wrapfigure}[3][]{\begin{figure}[htb]\centering}{\end{figure}} but I suppose that it has more optional arguments
    – user2478
    Jul 29, 2011 at 15:49
  • 1
    You might also want to look at the xparse package.
    – mbork
    Jul 29, 2011 at 16:47

1 Answer 1


The wrapfig manual states that the syntax is:

\begin{wrapfigure}[<number of narrow lines>]{<placement>}[<overhang>]{<width>}

Note the two optional and two mandatory arguments. You need to define a replacement which removes all of this possible arguments. This is possible by removing the first two with as environment arguments and then use a gobble macro to remove the other two:


You could also use the xparse package to define an environment with two such optional arguments:


Using xparse is very useful if you want to redefine very complicated macros or environments. However, if you want to reduce the number of used packages I would go with the first method.

You must log in to answer this question.

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