Extended description

From ConTeXt wiki
Jump to navigationJump to search

< Modules

The xdesc module by Giuseppe Bilotta (Oblomov) provides a means to treat special descriptions such as epigraphs. In this case the object has several attributes, which can be typeset in several ways. The module can be downloaded from the modules:xdesc site.

Example setup for epigraphs

An epigraph (sometimes also wrongly called epigram) is a concise and witty saying or a short witty poem. An example would be

We haven't got the money, so we've got to think!
Ernest Rutherford, 1871–1937

We first load now the module and setup a new description

\usemodule[xdesc]
\defineextendeddescription[epigraph][epigraphs]%
                          [author,years,source,note,whois]

We now define the commands to typeset the epigraphs, one short version which is useful for production

\starttemplate[epigraph][short]
\startframedtext[right][frame=off,offset=none,background=none,
                        width=0.65\textwidth,top=,bottom=]
  \small{\it \getslot{content}}
  \unskip\nobreak\hfil\penalty50\hskip1em\hbox{}\nobreak\hfil
  \hbox{\small{--- \getslot{author}%
        \doifelse{\getslot{years}}{}{}{, \getslot{years}}}}
  \parfillskip=0pt \finalhyphendemerits=0
\stopframedtext
\stoptemplate

and a medium long version. which is a bit lengthier,

\starttemplate[epigraph][medium]
\startframedtext[right][frame=off,offset=none,background=none]
{\it \getslot{content}}\par
\rightaligned{--- \getslot{author}, \getslot{years}}\par
\startalignment[left]
\small \getslot{source}
\stopalignment
\stopframedtext
\stoptemplate

The version we want to use can be set via

\selecttemplate[epigraph][short] % medium,short

It is now time to get type in a quote

\startepigraph[epg:Rutherford]
   [author={Ernest Rutherford},
     years={1871--1937},
     whois={New Zealand physicist},
    source={in {\it Bulletin of the Institute of Physics} (1962) vol. 13}]
  We haven't got the money, so we've got to think!
\stopepigraph

To typeset the epigraph, simply call:

\getepigraph[epg:Rutherford]