Changes

Jump to navigation Jump to search
3,489 bytes added ,  10:29, 13 December 2020
m
merging "Cover Page - A very simple one" content
\stoptext
</context>
 
== A very very simple one ==
 
If you are looking for something fancy with graphics, bells, and whistles, this is not for you. 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:
 
<texcode>
% --- 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
 
</texcode>
 
<context>
% --- Cover page
\setuplayout[scale=0.5,width=13cm]
\framed[align=flushleft,width=13cm]{
\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
\blank[2cm]
}
</context>
 
= Analysis of the code =
 
These two commands together make a 6-centimeter blank on the top of the page:
 
<texcode>
\dontleavehmode
\blank[6cm]
</texcode>
 
The <tt>\dontleavehmode</tt> 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 <tt>\blank</tt>, no blank will appear. The <tt>\dontleavehmode</tt> forces the right mode.
 
The title is centered. The actual layout may need some tweaking with e.g. <tt>\blank</tt>. This one looks reasonably fine on the paper (and bad in the Wiki).
 
<texcode>
\startalignment[center]
\ssd Polar Bears of Antarctica \par
\ssc A Suggestion
\stopalignment
</texcode>
 
Another measured waste of paper (this time no mode problems):
 
<texcode>
\blank[10cm]
</texcode>
 
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.
 
<texcode>
\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
</texcode>
 
N.B.: the <tt>\startalignment</tt> requires the <tt>\dontleavehmode</tt> if there is no text immediately after the <tt>start</tt> command.
 
And finally, let's finish the page:
 
<texcode>
\page
</texcode>
 
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, <tt>\startnarrower[..][..] ... \stopnarrower</tt> provides much the same functionality with fewer commands and cleaner code.
[[Category:Sample documents]]
 
[[Category:Sample documents]]

Navigation menu