TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
try: \newenvironment{wrapfigure}[3][]{\begin{figure}[htb]\centering}{\end{figure}} but I suppose that it has more optional arguments – Herbert Jul 29 '11 at 15:49
You might also want to look at the xparse package. – mbork Jul 29 '11 at 16:47
up vote 6 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.