This week I’m attending the 4th Annual ConTeXt User Meeting in Breijlov, Czech Republic. The location is awesome: an old-ish hotel situated next to a roaring river that white-caps right in front of the outdoor seating/smoking area. If I were to open the window in the conference room right now, no one would be able to hear the person speaking.

I took the opportunity last night during the post-talk hackathon to ask the prolific Wolfgang Schuster for advice on an issue that has been bugging me considerably. For my thesis I composed a dedication page to the friends I’ve lost this year, which includes a poem. The version I handed in with my thesis ended up looking like this:

The spacing there is quite un-poetic, don’t you think?

It was generated by a macro that I defined inside a Pandoc template, which allowed me to keep my Markdown source (from which the ConTeXt is generated, through Pandoc which molten melds it with the template I just mentioned) from having any ConTeXt in it. This macro looked like this:

\def\makededicated{
 \startalignment[center]
 \blank[force,3*big]
 {\bf This thesis is dedicated to}
 \blank[none]
 {\bf the living memories of Caroline Gallagher and Jacob Renshaw.}
 \stopalignment

 \setupnarrower[left=4cm]
 \switchtobodyfont[9.5pt]
 \startnarrower[left]
 \blank[big]
 Though forever is longer than
 \blank[none]
 the time we meet again,
 \blank[none]
 in the space between
 \blank[none]
 this now and our then,
 \blank[none]
 as absence brings you
 \blank[none]
 into moments, I'll miss
 \blank[none]
 you, my friends.
 \stopnarrower

 \switchtobodyfont[12pt]

There are a few newbie errors in there. For instance, rather than having two \switchtobodyfont commands–one for setting the font smaller for the poem, the other to set it back to the size of the rest of the document–I can simply use \bgroup at the beginning and \egroup at the end.

The main reason the line-spacing is awkward there, however, is that I did not set \setupwhitespace or \setupinterlinespace to smaller values. If we wrap the poem in the \broup..\egroup “on-the-fly” environment, these values can be set to whatever we want without affecting the look and feel of the rest of the document. This is important because the reason I wasn’t playing around with these settings is that I couldn’t afford to break my workflow so close to the thesis deadline, let alone spend much time making the dedication page look perfect in the first place.

The final mistake was that I used \blank[none] to format the separate lines. While it technically works (obviously), it is not the cleanest way to do it. No, ideally the poem is set just as the following:

\setuplines[space=on]
\startlines
      Though forever is longer than
      the time we meet again,
      in the space between
      this now and our then,
      as absence brings you
      into moments, I'll miss
      you, my friends.
\stoplines

THIS IS THE WAY TO DO IT IN A NORMAL DOCUMENT! Enjoy your beautifully typeset poetry!

And indeed, in a normal usage it would work perfectly! Even concrete poetry can be achieved, because ConTeXt will treat all whitespace as intentional. So you can go ahead and re-typeset your favorite e.e. cummings, or lay out your own wildly spaced poetry with incredible ease.

However, because this poem appears in a macro, \startlines..\stoplines is not available (remember, I had to macro-ize the poem so that it would integrate easily into my non-standard workflow). The answer lies in using the \par command to break the lines (Wolfgang says this is preferable to \blank. I’m not totally sure why, but I’ll take his much-respected word on it).

The final solution looks like this in ConTeXt:

\def\makededicated{
  \startalignment[center]
    \blank[force,3*big]
      {\bf This thesis is dedicated to}
    \blank[none]
      {\bf the living memories of Caroline Gallagher and Jacob Renshaw.}
  \stopalignment

  \bgroup
  \setupnarrower[left=4cm]
  \switchtobodyfont[9.5pt]
  \setupinterlinespace[1.5em]
  \setupwhitespace[none]
  \startnarrower[left]
    \blank[3*big]
      Though forever is longer than \par
      the time we meet again, \par
      in the space between \par
      this now and our then, \par
      as absence brings you \par
      into moments, I'll miss \par
      you, my friends.
  \stopnarrower
  \egroup
}

and like this in PDF

Thesis dedication page (at least somewhat more optimal)

A much better looking testament to my friends, in my opinion.