Difference between revisions of "Command/definemixedcolumns"

From Wiki
Jump to navigation Jump to search
(Edited slightly for readability and updated for newer mkiv. Colors didn't work as expected either.)
 
Line 2: Line 2:
  
 
<pre>
 
<pre>
%\setupcolors[state=start] % only necessary in older ConTeXt mkii
+
%\setupcolors[state=start] % This is only necessary in older ConTeXt mkii.
 +
 
 
\hyphenation{sig-ni-fi-cant-ly} % for correct line formatting
 
\hyphenation{sig-ni-fi-cant-ly} % for correct line formatting
  
Line 13: Line 14:
 
\definemixedcolumns
 
\definemixedcolumns
 
   [sectioncolumns]
 
   [sectioncolumns]
   [
+
   [n=2, separator=rule, rulecolor=darkgreen, rulethickness=3pt, balance=yes]
    n=2,  
 
    separator=rule,
 
    rulecolor=darkblue,
 
    rulethickness=3pt,
 
    balance=yes,
 
  ]
 
  
 
% Horizontal line below the section header.
 
% Horizontal line below the section header.
 
\defineframed[sectionframed]
 
\defineframed[sectionframed]
             [
+
             [frame=off, bottomframe=on, framecolor=darkgreen,
              frame=off,
+
              rulethickness=1pt, width=local, align=normal, % to get a vbox
              bottomframe=on,
 
              framecolor=darkgreen,
 
              rulethickness=1pt,
 
              width=local,
 
              align=normal, % to get a vbox
 
 
             ]
 
             ]
  
Line 36: Line 26:
 
\setuphead
 
\setuphead
 
     [section]
 
     [section]
     [
+
     [command=\StyleSection, after={\startsectioncolumns},
      command=\StyleSection,
+
    aftersection={\stopsectioncolumns}]
      after={\startsectioncolumns},
 
      aftersection={\stopsectioncolumns},
 
    ]
 
  
 
\starttext
 
\starttext
\startchapter[title={Chapter}, reference=sec:my-chapter,]
+
  \startchapter[title={Chapter}, reference=sec:my-chap,]
  \startsection[title={Section}, reference=sec:my-section,]
+
    \startsection[title={Section}, reference=sec:my-sect,]
      \startsubsection[title={Equipment},reference=sec:my-equip,]
+
        \startsubsection[title={Content}, reference=sec:my-cont,]
        \input knuth
+
          \input knuth
        \input knuth
+
          \input knuth
      \stopsubsection
+
        \stopsubsection
  \stopsection
+
    \stopsection
\stopchapter
+
  \stopchapter
 
 
 
\stoptext
 
\stoptext
 
</pre>
 
</pre>

Latest revision as of 21:27, 30 December 2017

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