[texhax] Equivalent of CSS "collapsing margins"?

William Adams will.adams at frycomm.com
Thu Oct 25 14:13:06 CEST 2007


On Oct 25, 2007, at 6:29 AM, Edsko de Vries wrote:

> Is there any way to collapse adjoining \vspace commands? Or better  
> yet,
> to define a command, say \vspace*, which behalves like \vspace but
> automatically collapse adjoining vertical spaces? For instances,
>
> \vspace*{1em}
> \vspace*{2em}
>
> should give a total vspace of 2em. If this is not possible at all,
> perhaps a poor-man's version would be a version of vspace where any
> subsequent vspace commands are ignored, so that
>
> \vspace*{1em}
> \vspace*{2em}
>
> gives a total vspace of 1em. This is not ideal, but better than  
> nothing
> :) Of course, when there is any text in between the two calls to
> \vspace, the second vspace command should not be ignored. I have
> searched for a solution but came up empty. Any hints would be
> appreciated!
>
> (This kind of thing is very useful when defining macros for example:
> suppose one macro defines a vspace of 2em after the macro  
> expansion, and
> another defines a vspace of 1em before the macro expansion; the total
> vspace should be 2em, not 3em).

I believe you'll find the macro \addvspace of interest.

William

-- 
William Adams
senior graphic designer
Fry Communications




More information about the texhax mailing list