Background
I would like to add a thick rule centered between two columns.
Example Code
A minimum working example that illustrates the issue:
\setupcolors[state=start]
\startuseMPgraphic{StyleVerticalRule}
thickness := 6.50pt;
if CurrentColumn < NOfColumns :
setbounds currentpicture to OverlayBox
shifted( -3*thickness, 0 );
draw rightboundary OverlayBox
withpen pensquare scaled thickness
withcolor \MPcolor{red};
fi
\stopuseMPgraphic
\defineoverlay[StyleVerticalRule][
\useMPgraphic{StyleVerticalRule},
]
\definecolumnset[StyleColumns][
n=2,
background=StyleVerticalRule,
]
% Horizontal line below the section header.
\define[2]\StyleSection{%
\framed[
frame=off,
bottomframe=on,
framecolor=pink,
rulethickness=1.0pt,
width=local,
]{\vbox{#2}}}
\setuphead[section][
command=\StyleSection,
after={\startcolumnset[StyleColumns]},
aftersection={\stopcolumnset},
]
\starttext
\startbodymatter
\startchapter[title={Chapter}, reference=sec:my-chapter,]
\startsection[title={Section}, reference=sec:my-section,]
\startsubsection[title={Equipment},reference=sec:my-equipment,]
\input knuth
\input knuth
\stopsubsection
\stopsection
\stopchapter
\stopbodymatter
\stoptext
Problem
The vertical rule height appears to be \textheight
, rather than height of the columns. The code above produces:
The vertical rule extends beyond the subsection header because, I think, it references OverlayBox
. I would like to use the column height, not the text height, to produce:
Questions
With respect to multi-column layouts:
- How do you restrict the height of the vertical rule so that it respects the column height (i.e., how do you determine the column height)?
- How would you add sufficient space to the section's column margins so that the vertical rule does not overlap any text?
- What is the required calculation to ensure the vertical rule is centered between the columns (i.e.,
-3*thickness
seems… incorrect)?
I also could not find any definition for OverlayBox
, although I found a few examples.
Related
Information that is somewhat related:
- How to place text between two columns and which breaks the rule dividing them in ConTeXt?
- formatting natural table header with conTeXt
- https://tex.stackexchange.com/a/17813/2148
- Creating a grid which fills available text area on a page in ConTeXt?
- http://www.ntg.nl/pipermail/ntg-context/2011/058352.html
- http://wiki.contextgarden.net/TABLE
Best Answer
When using columnsets, your entire page design must be done using columnsets. So, if you want chapter or section heads to span the entire page, you will have to define a columnspan.
For simple two column documents, you can use
\startcolumns ... \stopcolumns
, or its MkIV replacement\startmixedcolumns ... \stopmixedcolumns
. Here is an example:which gives