5

Background

I would like to place balanced itemized lists inside a two-column layout.

Problem

Changing the font affects the balanced layout; the fonts are:

Code

The following code demonstrates the issue:

\starttypescript [sans] [TestSans]
  \definefontsynonym [Sans]           [name:chivoregular]
  \definefontsynonym [SansBold]       [name:chivoblack]
  \definefontsynonym [SansItalic]     [name:chivoitalic]
  \definefontsynonym [SansBoldItalic] [name:chivoblackitalic]
\stoptypescript

\starttypescript [serif] [TestSerif]
  \definefontsynonym [Serif]           [name:gentiumbasic]
  \definefontsynonym [SerifBold]       [name:gentiumbasicbold]
  \definefontsynonym [SerifItalic]     [name:gentiumbasicitalic]
  \definefontsynonym [SerifBoldItalic] [name:gentiumbasicbolditalic]
\stoptypescript

\definetypeface [TestFont] [rm] [serif] [TestSerif] [default]
\definetypeface [TestFont] [ss] [sans]  [TestSans]  [default]

\usetypescript[TestFont][ec]
%\setupbodyfont[TestFont]

\define[1]\IngredientName{\expanded{\index{#1+\namedstructurevariable{section}{title}}{#1}}}

\define[1]\IngredientUnit{#1}

\define[1]\IngredientMeasure{
  \if\relax\detokenize{#1}\relax
    %
  \else
    #1
  \fi
}

\define[3]\ingredient{\startitem\IngredientUnit{#1}\IngredientMeasure{#2}\IngredientName{#3}\stopitem}

\definestartstop[TestIngredientGroup]
\defineitemgroup[TestIngredient]

\setupstartstop[TestIngredientGroup][
  before={\startmixedcolumns[balance=yes,grid=,]},
  after={\stopmixedcolumns},
]

\defineitemgroup[TestIngredient]
\setupitemgroup[TestIngredient][each][packed][
  width=\zeropoint,
  %before={\vskip-.5em},
  %after={\vskip.5em},
  symbol=,
]

\setuphead[subsection][
  number=no,
  %before={\testcolumn[2]},
  %after={\empty},
  style=\ss,
]

\starttext

\startTestIngredientGroup
\startsubsection[title={Main Ingredients},]
\startTestIngredient
  \ingredient{1}{}{egg}\ingredient{1}{}{avocado}
  %\ingredient{1}{pkg}{applewood-smoked bacon}\ingredient{1}{}{onion}\ingredient{2}{tbsp}{flour}\ingredient{2\vfrac{1}{2}}{cup}{fish stock}\ingredient{1}{}{potato}\ingredient{\vfrac{1}{2}}{tsp}{cayenne pepper}\ingredient{\vfrac{1}{2}}{tsp}{nutmeg}\ingredient{1\vfrac{1}{2}\emdash{}2}{cup}{milk}\ingredient{\vfrac{1}{2}}{cup}{cream}\ingredient{1}{pinch}{salt}\ingredient{1}{pinch}{pepper}\ingredient{1}{tsp}{lime juice}
\stopTestIngredient
\stopsubsection
\stopTestIngredientGroup

\stoptext

The result initially looks satisfactory; the problem occurs when trying to adjust the whitespace, the font, or both.

Reproduce Problem

Apply the fonts by uncommenting: %\setupbodyfont[TestFont], which produces:

Font Change

The columnar content has shifted from the left column to the right column. This can be addressed by uncommenting: %before={\vskip-.5em},, which produces:

Vertical Skip

This works for two lines, but enabling %\ingredient{1}{pkg}{applewood-smoked bacon}... results in missing text:

Missing Text

Several lines have disappeared completely, regardless of font. The lines can be made visible again, but then the situation reverts to shifting the content from the left column to the right column when there are only a couple of items in the list.

I've tried:

  • setting grid=strut, grid=, grid=verytolerant, and grid=stretch;
  • adding [intro] to the lists;
  • using \testcolumn[3] to prevent orphaned subsection titles; and
  • coding various combinations of \vskip and \empty on before and after attributes for both the itemized list and the subsection title.

Question

Using a two-column setup, is there a way to reduce the amount of space?

The best result I can achieve without losing any content contains extraneous whitespace:

Extraneous Whitespace

What I would like to achieve resembles:

Desired Result

1

Avoid \vskip in favour of \blank[small].

For example, on the lists use:

before={\blank[small]},
after={\blank[small]},

And on the subsection title use:

\setuphead[subsection][
  % Avoid orphaned titles.
  before={\testcolumn[3]},
  after={\blank[small]},
]

This produces the desired result.

See also: http://wiki.contextgarden.net/Command/blank

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.