Received: from mail.proteosys.com ([62.225.9.49]) by nummer-3.proteosys with Microsoft SMTPSVC(5.0.2195.5329); Fri, 7 Mar 2003 14:58:09 +0100 Received: by mail.proteosys.com (8.12.3/8.12.2) with ESMTP id h27Dw6a9009829 for ; Fri, 7 Mar 2003 14:58:07 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.27]) by relay.uni-heidelberg.de (8.12.8/8.12.8) with ESMTP id h27DkY0j013943; Fri, 7 Mar 2003 14:46:34 +0100 (MET) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C2E4B1.95996E80" Received: from listserv (listserv.uni-heidelberg.de [129.206.100.27]) by listserv.uni-heidelberg.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id h270Rl74028465; Fri, 7 Mar 2003 14:46:12 +0100 Received: from LISTSERV.UNI-HEIDELBERG.DE by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 1.8d) with spool id 7072 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 7 Mar 2003 14:46:12 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id h27DkCwE001542 for ; Fri, 7 Mar 2003 14:46:12 +0100 Received: from nic.lth.se (nic.lth.se [130.235.20.3]) by relay2.uni-heidelberg.de (8.12.8/8.12.8) with ESMTP id h27DkEle020982 for ; Fri, 7 Mar 2003 14:46:14 +0100 (MET) Received: from [130.235.3.161] (mathcent81.maths.lth.se [130.235.3.161]) by nic.lth.se (8.12.8/8.12.8) with ESMTP id h27DkDmm028336 for ; Fri, 7 Mar 2003 14:46:14 +0100 (MET) In-Reply-To: <15976.35571.591332.566230@istrati.mittelbach-online.de> References: <630BE70C8320D6118D240002A589ABB204A95102@DERUM201> Return-Path: X-OriginalArrivalTime: 07 Mar 2003 13:58:09.0843 (UTC) FILETIME=[961A1030:01C2E4B1] X-Sender: lars@abel.math.umu.se x-mime-autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id h27DkCwE001543 X-Scanned-By: MIMEDefang 2.28 (www . roaringpenguin . com / mimedefang) X-Spam-Score: -1.3 () IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01 Content-class: urn:content-classes:message Subject: Re: algorithm for \addvspace Date: Fri, 7 Mar 2003 14:46:52 +0100 Message-ID: A X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Re: algorithm for \addvspace Thread-Index: AcLksZY9TJ7FTW+HTUWur46ephmo/Q== From: =?iso-8859-1?Q?Lars_Hellstr=F6m?= To: Reply-To: "Mailing list for the LaTeX3 project" Status: R X-Status: X-Keywords: X-UID: 4569 This is a multi-part message in MIME format. ------_=_NextPart_001_01C2E4B1.95996E80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable At 13.05 +0100 2003-03-07, Frank Mittelbach wrote: >Lars, > > > Yes, that makes perfect sense (although the name does not). > >yes, kind of, but this is really history and we can't change that name = for 2e >not even the semantics i would guess (unless put into fixltx2e). Yes (you wouldn't have had to tell _me_ that; I know it is much too late = to change such behaviour in the 2e core). > > >i actually one in a sequence > > > > > > \addpenalty\@beginparpenalty > > > \addvspace\@topsep > > > \addvspace{-\parskip}% > > > > > >and the net effect of \topsep-\parskip is normally positive. > > > > Yes, but then it should have been > > > > \addpenalty\@beginparpenalty > > \@tempskipb=3D\@topskip > > \advance \@tempskipb -\parskip > > \addvspace\@tempskipb > > > > because otherwise the net results will be wrong (less than = \lastskip) when > > > > \topsep-\parskip < \lastskip < \topsep > >yes again. but this is from around 1986 i fear. so you can claim it is = not >wrong but strange I do claim that it is wrong, but cannot be fixed in the 2e core. It = could be another candidate for fixltx2e.sty. > > >well, how could a simpler command look like? > > > > A first approximation would be like this: > > > > \def\MinimalVspace#1{% > > \ifvmode > > \if@minipage \else > > \ifdim \lastskip =3D\z@ > > \vskip #1\relax > > \else > > \@tempskipb#1\relax > > \ifdim \lastskip<\@tempskipb > > \vskip-\lastskip > > \vskip\@tempskip > > \fi > > \fi > > \fi > > \else > > \@noitemerr > > \fi > > } > >what precisely does this gain you? if used with positive skips nothing = as it >is identical to \addvspace and this is what \addvspace is used for (or = should >be used for, the strange usage in list is something i wouldn't count = here) Cleans up the code, and removes questionable behaviour (discontinuity, nonmonotonicity). >the logic is still as strange as before in the case \lastskip is = negative and >skip positive. I presume you meant to say something different here. The \lastskip < 0 < SKIP case was never questioned. > > It is quite possible that the special code for \lastskip=3D\z@ = should also be > > removed, but with \parskip =3D 0pt plus 1pt being quite common, that = change > > could actually be noticable. > >haven't thought of that before, indeed, this is different from using = the >maximum of \lastskip,SKIP, hmmm > >the if minipage flag is necessary or else you get strange and unwanted = effects >at the beginning of a box, you really don't want to start there with a = space >(normally) OK, I can't claim I have ever learnt what these flags signify anyway. If it's a "beginning of minipage" flag then it makes perfect sense. > > As for the name, I think this would be more intuitive. The user (or = perhaps > > rather class designer) is requesting that at least this amount of = vspace > > should appear at this point. > >but you could document \addvspace clearer and have the same. > > > > >i can see how to define a user command for corrective actions = always > > >adjusts the space in either direction, the only problem is that its > > >natural name (addvspace) is already taken > > > > Well, there's always > > > > \def\AddVspace#1{% Or maybe \reallyaddvspace > > \ifvmode > > \if@minipage \else > > \@tempskipb#1\relax > > \advance \@tempskipb \lastskip > > \vskip-\lastskip > > \vskip\@tempskip > > \fi > > \else > > \@noitemerr > > \fi > > } > >i take my remark back from last night, I don't see how to easily define = the >corrective action command. the above doesn't do the job (i think) We're thinking about different things, but I can see that your \correctspace would be more useful. I was merely thinking about = preserving the "invariant" that \lastskip is the effective total amount of vertical glue since the last non-discardable item, which is what \addvspace and \addvpentalty rely on. >reason: typical situation is like this > > >\addvspace{8pt} % from the end of some object >\correctspace{2pt} % what to put here to change the spacing??????? >\addvspace{10pt} % from the beginning of a new object > >eg end of list followed by \section > >now the place where the user can put in his/her correction command is = between >the two \addvspace commands. so if one things the space is too small = and wants >to change that, eg add 2pts then > >nothin there will give us 10pt total, ie max(8pt,10pt) >\vspace{2pt} will give us 18pt total, ie 8pt + max(2pt,10pt) >\AddVspace{2pt} will give us 10pt total, ie max(max(8pt,2pt),10pt) Don't you mean: max( 8pt+2pt, 10pt) ? > >\vspace{-2pt} by the way will also give 18pt which is really the beauty = of >thescheme :-) > >but if 8pt and 10pt are in the opposite places then >\AddVspace{2pt} suddenly works > >so i think this needs a far more complex integration between \addvspace = (or >whatever the name is for the thing to be used at the border of objects) = and >the corrective command for use in documents How about \def\correctvspace#1{% \relax % Won't hurt, and might help. \ifvmode \@tempskipb=3D\lastskip \vskip-\@tempskipb \vskip #1% \vskip\@tempskipb \else \@noitemerr \fi } ? There is a slight imperfection in that if the break is taken at a penalty abve the correction then it will disappear, whereas it will not disappear if the break is taken at a penalty below the correction, but I think that is reasonable behaviour. One could also provide for inserting = a penalty just before the correction skip. Lars Hellstr=F6m ------_=_NextPart_001_01C2E4B1.95996E80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: algorithm for \addvspace

At 13.05 +0100 2003-03-07, Frank Mittelbach = wrote:
>Lars,
>
> > Yes, that makes perfect sense (although the = name does not).
>
>yes, kind of, but this is really history and we = can't change that name for 2e
>not even the semantics i would guess (unless put = into fixltx2e).

Yes (you wouldn't have had to tell _me_ that; I know = it is much too late to
change such behaviour in the 2e core).

> > >i actually one in a sequence
> > >
> > = >        = \addpenalty\@beginparpenalty
> > = >        \addvspace\@topsep
> > = >        = \addvspace{-\parskip}%
> > >
> > >and the net effect of \topsep-\parskip = is normally positive.
> >
> > Yes, but then it should have been
> >
> >     = \addpenalty\@beginparpenalty
> >     = \@tempskipb=3D\@topskip
> >     \advance = \@tempskipb -\parskip
> >     = \addvspace\@tempskipb
> >
> > because otherwise the net results will be = wrong (less than \lastskip) when
> >
> >     \topsep-\parskip = < \lastskip < \topsep
>
>yes again. but this is from around 1986 i fear. = so you can claim it is not
>wrong but strange

I do claim that it is wrong, but cannot be fixed in = the 2e core. It could
be another candidate for fixltx2e.sty.

> > >well, how could a simpler command look = like?
> >
> > A first approximation would be like = this:
> >
> > \def\MinimalVspace#1{%
> >    \ifvmode
> >       = \if@minipage \else
> = >          \ifdim = \lastskip =3D\z@
> = >           &nb= sp; \vskip #1\relax
> = >          \else
> = >           &nb= sp; \@tempskipb#1\relax
> = >           &nb= sp; \ifdim \lastskip<\@tempskipb
> = >           &nb= sp;    \vskip-\lastskip
> = >           &nb= sp;    \vskip\@tempskip
> = >           &nb= sp; \fi
> = >          \fi
> >       = \fi
> >    \else
> >       = \@noitemerr
> >    \fi
> > }
>
>what precisely does this gain you? if used with = positive skips nothing as it
>is identical to \addvspace and this is what = \addvspace is used for (or should
>be used for, the strange usage in list is = something i wouldn't count here)

Cleans up the code, and removes questionable behaviour = (discontinuity,
nonmonotonicity).

>the logic is still as strange as before in the = case \lastskip is negative and
>skip positive.

I presume you meant to say something different here. = The \lastskip < 0 <
SKIP case was never questioned.

> > It is quite possible that the special code = for \lastskip=3D\z@ should also be
> > removed, but with \parskip =3D 0pt plus 1pt = being quite common, that change
> > could actually be noticable.
>
>haven't thought of that before, indeed, this is = different from using the
>maximum of \lastskip,SKIP, hmmm
>
>the if minipage flag is necessary or else you get = strange and unwanted effects
>at the beginning of a box, you really don't want = to start there with a space
>(normally)

OK, I can't claim I have ever learnt what these flags = signify anyway. If
it's a "beginning of minipage" flag then it = makes perfect sense.

> > As for the name, I think this would be more = intuitive. The user (or perhaps
> > rather class designer) is requesting that = at least this amount of vspace
> > should appear at this point.
>
>but you could document \addvspace clearer and = have the same.
>
>
> > >i can see how to define a user command = for corrective actions always
> > >adjusts the space in either direction, = the only problem is that its
> > >natural name (addvspace) is already = taken
> >
> > Well, there's always
> >
> > \def\AddVspace#1{% Or maybe = \reallyaddvspace
> >    \ifvmode
> >       = \if@minipage \else
> = >          = \@tempskipb#1\relax
> = >          \advance = \@tempskipb \lastskip
> = >          = \vskip-\lastskip
> = >          = \vskip\@tempskip
> >       = \fi
> >    \else
> >       = \@noitemerr
> >    \fi
> > }
>
>i take my remark back from last night, I don't = see how to easily define the
>corrective action command. the above doesn't do = the job (i think)

We're thinking about different things, but I can see = that your
\correctspace would be more useful. I was merely = thinking about preserving
the "invariant" that \lastskip is the = effective total amount of vertical
glue since the last non-discardable item, which is = what \addvspace and
\addvpentalty rely on.

>reason: typical situation is like this
>
>
>\addvspace{8pt}       % from = the end of some object
>\correctspace{2pt}    % what to = put here to change the spacing???????
>\addvspace{10pt}       % from = the beginning of a new object
>
>eg end of list followed by \section
>
>now the place where the user can put in his/her = correction command is between
>the two \addvspace commands. so if one things the = space is too small and wants
>to change that, eg add 2pts then
>
>nothin there    will give us 10pt = total, ie  max(8pt,10pt)
>\vspace{2pt}    will give us 18pt = total, ie 8pt + max(2pt,10pt)
>\AddVspace{2pt} will give us 10pt total, ie = max(max(8pt,2pt),10pt)

Don't you = mean:           &n= bsp;           &nb= sp;      max(   8pt+2pt,  10pt) = ?

>
>\vspace{-2pt} by the way will also give 18pt = which is really the beauty of
>thescheme :-)
>
>but if 8pt and 10pt are in the opposite places = then
>\AddVspace{2pt} suddenly works
>
>so i think this needs a far more complex = integration between \addvspace (or
>whatever the name is for the thing to be used at = the border of objects) and
>the corrective command for use in = documents

How about

\def\correctvspace#1{%
   \relax % Won't hurt, and might = help.
   \ifvmode
      = \@tempskipb=3D\lastskip
      = \vskip-\@tempskipb
      \vskip #1%
      = \vskip\@tempskipb
   \else
      \@noitemerr
   \fi
}

?  There is a slight imperfection in that if the = break is taken at a
penalty abve the correction then it will disappear, = whereas it will not
disappear if the break is taken at a penalty below = the correction, but I
think that is reasonable behaviour. One could also = provide for inserting a
penalty just before the correction skip.

Lars Hellstr=F6m

------_=_NextPart_001_01C2E4B1.95996E80--