[dev-context] Wrong structure numbers in margin

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed May 16 19:58:00 CEST 2012


Am 16.05.2012 um 19:24 schrieb Marco:

> Hi Hans,
> 
> could you check the definition of \placeheadmarginalternative in
> strc-ren.mkiv? The current solution fails when structure number are
> set to “margin” in a doublesided layout because of the hard-coded
> \leftmargindistance. The “maybe better” solution actually seems to
> work better.

\inleftmargin can be a problem when you have another margin data command before the heading.

> \unexpanded\def\placeheadmarginalternative#1#2%
>  {\vbox
>     {\localheadsetup
>      \begstrut % use one \strut here!
>      \dontleavehmode % in case there is no strut, else side effects with llap
>      \ifconditional\headshownumber
> 				% this gives a wrong result on the second page
>        %\llap{\hbox{\hfill{#1}\hskip\localheadskip\hskip\leftmargindistance}}% introduces whitespace
>        % maybe better:
>         \inleftmargin{\hbox{\hss{#1}\hskip\localheadskip}}%
>      \fi
>      {#2}}}


It’s simpler to check for odd/even page and use the right dimension:

\unexpanded\def\placeheadmarginalternative#1#2%
 {\vbox
    {\localheadsetup
     \begstrut % use one \strut here!
     \dontleavehmode % in case there is no strut, else side effects with llap
     \ifconditional\headshownumber
       \llap{\hbox{\hfill{#1}\hskip\dimexpr\localheadskip+\doifoddpageelse\leftmargindistance\rightmargindistance\relax}}% introduces whitespace
     \fi
     {#2}}}

Wolfgang


More information about the dev-context mailing list