Section columns + sidebar
Hi again everyone, Here's hoping a second question so soon will be okay. I'm trying to add a sidebar (a margin rule) to the outer margin of my doublesided layout. This sidebar is bound to a specific kind of section that uses columns with balance=no. In the working example below, the sidebar on the second page goes as far as the length of the second column, which is shorter than the leftmost one. I'd like the sidebar to follow the length of the longest column. Is there a different approach to this? --- \setuppapersize[letter][letter] \setuplayout[topspace=0.5cm, bottomspace=0.5cm,cutspace=4cm, rightmargin=3cm, backspace=2cm, leftmargin=1cm,header=1cm, footer=0.5cm,height=middle, width=middle,margindistance=0.2cm, headerdistance=0.2cm, footerdistance=0.2cm] \setuppagenumbering[alternative=doublesided] \definemixedcolumns[sectioncolumns][n=2, align=right, balance=no] \setupmarginrule[location=outer, rulethickness=0.5pt] \starttext \startsection[number=no] \startsectioncolumns \startmarginrule \dorecurse{8}{\input knuth\par} \stopmarginrule \stopsectioncolumns \stopsection \stoptext --- Thank you, as always! JFS
On 12/28/2025 10:16 PM, Jeff Smith wrote:
Hi again everyone,
Here's hoping a second question so soon will be okay.
I'm trying to add a sidebar (a margin rule) to the outer margin of my doublesided layout.
This sidebar is bound to a specific kind of section that uses columns with balance=no.
In the working example below, the sidebar on the second page goes as far as the length of the second column, which is shorter than the leftmost one.
I'd like the sidebar to follow the length of the longest column.
Is there a different approach to this?
--- \setuppapersize[letter][letter]
\setuplayout[topspace=0.5cm, bottomspace=0.5cm,cutspace=4cm, rightmargin=3cm, backspace=2cm, leftmargin=1cm,header=1cm, footer=0.5cm,height=middle, width=middle,margindistance=0.2cm, headerdistance=0.2cm, footerdistance=0.2cm]
\setuppagenumbering[alternative=doublesided]
\definemixedcolumns[sectioncolumns][n=2, align=right, balance=no]
\setupmarginrule[location=outer, rulethickness=0.5pt]
\starttext
\startsection[number=no] \startsectioncolumns \startmarginrule
\dorecurse{8}{\input knuth\par}
\stopmarginrule \stopsectioncolumns \stopsection
\stoptext ---
Easiest is to add a 'command' option so that you can plug in whatever you like but first Wolfgang needs to check this for possible interferences. \unprotect \pushoverloadmode \def\page_mix_routine_package_step {% needs packaging anyway \setbox\scratchbox\page_mix_command_package_column \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone % new \page_marks_synchronize_column\plusone\c_page_mix_n_of_columns\recurselevel\scratchbox % backgrounds \anch_mark_column_box\scratchbox\recurselevel % for the moment a quick and dirty patch .. we need to go into the box (hence the \plusone) .. a slowdowner % moved to start: \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_mix_n_of_columns\plusone % the framed needs a reset of strut, align, setups etc \mixedcolumnseparatorheight\ht\scratchbox \mixedcolumnseparatordepth \dp\scratchbox \ifempty{\mixedcolumnsparameter\c!command}\else \scratchwidth\wd\scratchbox \setbox\scratchbox\hpack{\lastnamedcs{\box\scratchbox}}% \ht\scratchbox\mixedcolumnseparatorheight \dp\scratchbox\mixedcolumnseparatordepth \wd\scratchbox\scratchwidth \fi \inheritedmixedcolumnsframedbox\currentmixedcolumns\scratchbox} \protect % we could have one graphic and test for RealPage \startreusableMPgraphic{leftline} draw leftboundary OverlayBox shifted (-.5cm,0) withpen pencircle scaled OverlayLineWidth ; setbounds currentpicture to OverlayBox ; \stopreusableMPgraphic \startreusableMPgraphic{rightline} draw rightboundary OverlayBox shifted (.5cm,0) withpen pencircle scaled OverlayLineWidth ; setbounds currentpicture to OverlayBox ; \stopreusableMPgraphic \defineoverlay[leftline] [\reuseMPgraphic{leftline}] \defineoverlay[rightline][\reuseMPgraphic{rightline}] \starttexdefinition protected MyCommand #1 \ifodd\realpageno \ifnum\recurselevel=2\relax #1 \else \framed[background=leftline,frame=off,offset=overlay]{#1}% \fi \else \ifnum\recurselevel=2\relax \framed[background=rightline,frame=off,offset=overlay]{#1}% \else #1 \fi \fi \stoptexdefinition \setuppapersize[letter][letter] \setuplayout[topspace=0.5cm, bottomspace=0.5cm,cutspace=4cm, rightmargin=3cm, backspace=2cm, leftmargin=1cm,header=1cm, footer=0.5cm,height=middle, width=middle,margindistance=0.2cm, headerdistance=0.2cm, footerdistance=0.2cm] \setuppagenumbering[alternative=doublesided] \definemixedcolumns [sectioncolumns] [n=2, command=\MyCommand, align=right, balance=no] \starttext \startsection[number=no] \startsectioncolumns \dorecurse{8}{\input knuth\par} \stopsectioncolumns \stopsection \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen -
Jeff Smith