Command/definemixedcolumns

From Wiki
< Command
Revision as of 21:27, 30 December 2017 by Koenich (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The following code provides a simple example usage for \definemixedcolumns:

%\setupcolors[state=start] % This is only necessary in older ConTeXt mkii.

\hyphenation{sig-ni-fi-cant-ly} % for correct line formatting

\startuseMPgraphic{StyleVerticalRule}
  draw OverlayBox;
\stopuseMPgraphic

\defineoverlay[StyleVerticalRule][\useMPgraphic{StyleVerticalRule}]

\definemixedcolumns
  [sectioncolumns]
  [n=2, separator=rule, rulecolor=darkgreen, rulethickness=3pt, balance=yes]

% Horizontal line below the section header.
\defineframed[sectionframed]
             [frame=off, bottomframe=on, framecolor=darkgreen,
              rulethickness=1pt, width=local, align=normal, % to get a vbox
             ]

\define[2]\StyleSection{\sectionframed{#2}}

\setuphead
    [section]
    [command=\StyleSection, after={\startsectioncolumns},
     aftersection={\stopsectioncolumns}]

\starttext
  \startchapter[title={Chapter}, reference=sec:my-chap,]
    \startsection[title={Section}, reference=sec:my-sect,]
        \startsubsection[title={Content}, reference=sec:my-cont,]
          \input knuth
          \input knuth
        \stopsubsection
    \stopsection
  \stopchapter
\stoptext