Command/definemixedcolumns

From Wiki
< Command
Revision as of 21:23, 30 December 2017 by Koenich (talk | contribs) (Edited slightly for readability and updated for newer mkiv. Colors didn't work as expected either.)
Jump to navigation Jump to search

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

%\setupcolors[state=start] % 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=darkblue,
    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-chapter,]
  \startsection[title={Section}, reference=sec:my-section,]
      \startsubsection[title={Equipment},reference=sec:my-equip,]
        \input knuth
        \input knuth
      \stopsubsection
  \stopsection
\stopchapter

\stoptext