A Very Simple Cover Page

From ConTeXt wiki
Jump to: navigation, search

If you are looking for something fancy with graphics, bells, and whistles, this is not for you. (Simple Cover Page might be.) However, if you are looking for a very simple cover page with simple code, then read on.

Very often a white paper or some other document needs a cover page. The cover page needs to have a specific (and special) layout, so some layout commands are required. The textual content is limited, and in many cases there is no graphics whatsoever. The cover page below is really plain vanilla:

% --- Cover page

\dontleavehmode
\blank[6cm]

\startalignment[center]
  \ssd Polar Bears of Antarctica \par
  \ssc A Suggestion
\stopalignment

\blank[10cm]

\startalignment[flushright]
\dontleavehmode
\ssb
\bTABLE
  \setupTABLE[r][each][frame=off]
  \bTR \bTD Dr. I.M.Looney \eTD \eTR
  \bTR \bTD Institute of Bad Ecology \eTD \eTR
  \bTR \bTD February 30, 2006 \eTD \eTR
\eTABLE
\stopalignment
\page

Analysis of the code

These two commands together make a 6-centimeter blank on the top of the page:

\dontleavehmode
\blank[6cm]

The \dontleavehmode in the beginning is a bit of TeX-magic. TeX has a horizontal and a vertical mode, and if it is in the vertical mode when it encounters a \blank, no blank will appear. The \dontleavehmode forces the right mode.

The title is centered. The actual layout may need some tweaking with e.g. \blank. This one looks reasonably fine on the paper (and bad in the Wiki).

\startalignment[center]
  \ssd Polar Bears of Antarctica \par
  \ssc A Suggestion
\stopalignment

Another measured waste of paper (this time no mode problems):

\blank[10cm]

And then the rest of the information is embedded in a natural TABLE. All the text in the TABLE is left-aligned, but the TABLE itself is right-aligned. So, the longest row dictates the position of the TABLE. The downside of this approach is that if you have a number of cover pages with different authors, the starting position jumps around.

\startalignment[flushright]
\dontleavehmode
\ssb
\bTABLE
  \setupTABLE[r][each][frame=off]
  \bTR \bTD Dr. I.M.Looney \eTD \eTR
  \bTR \bTD Institute of Bad Ecology \eTD \eTR
  \bTR \bTD February 30, 2006 \eTD \eTR
\eTABLE
\stopalignment

N.B.: the \startalignment requires the \dontleavehmode if there is no text immediately after the start command.

And finally, let's finish the page:

\page

And that's it, a very simple cover page. While it may be useful as such, it has several shortcomings. For example, the positions are not absolute, so a change in the title may move the information block in the lower right corner. Using the TABLE is just a show-off. If you do not need the "align-by-rightmost" alignment, \startnarrower[..][..] ... \stopnarrower provides much the same functionality with fewer commands and cleaner code.

C O N T E X T G A R D E N

Personal tools
Namespaces
Variants
Actions
Help
External Help
Installation
Navigation
Toolbox