Difference between revisions of "A Very Simple Cover Page"

From Wiki
Jump to navigation Jump to search
m (A bit of mark-up cleaning)
m (+Category:Sample documents)
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
% --- Cover page
 
% --- Cover page
  
\strut
+
\dontleavehmode
 
\blank[6cm]
 
\blank[6cm]
  
Line 17: Line 17:
  
 
\startalignment[flushright]
 
\startalignment[flushright]
\strut
+
\dontleavehmode
 
\ssb
 
\ssb
 
\bTABLE
 
\bTABLE
Line 32: Line 32:
 
<context>
 
<context>
 
% --- Cover page
 
% --- Cover page
 
+
\setuplayout[scale=0.5,width=13cm]
\strut
+
\framed[align=flushleft,width=13cm]{
 +
\dontleavehmode
 
\blank[6cm]
 
\blank[6cm]
 
\startalignment[center]
 
\startalignment[center]
Line 42: Line 43:
 
\blank[10cm]
 
\blank[10cm]
 
\startalignment[flushright]
 
\startalignment[flushright]
\strut
+
\dontleavehmode
 
\ssb
 
\ssb
 
\bTABLE
 
\bTABLE
Line 51: Line 52:
 
\eTABLE
 
\eTABLE
 
\stopalignment
 
\stopalignment
\page
+
\blank[2cm]
 +
}
 
</context>
 
</context>
  
 
= Analysis of the code =
 
= Analysis of the code =
  
A strut is needed in the beginning to give the <tt>\blank</tt> something to start with. Then there is a 6-centimeter blank:
+
These two commands together make a 6-centimeter blank on the top of the page:
  
 
<texcode>
 
<texcode>
\strut
+
\dontleavehmode
 
\blank[6cm]
 
\blank[6cm]
 
</texcode>
 
</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).
 
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).
Line 72: Line 76:
 
</texcode>
 
</texcode>
  
Another waste of paper:
+
Another measured waste of paper (this time no mode problems):
  
 
<texcode>
 
<texcode>
Line 82: Line 86:
 
<texcode>
 
<texcode>
 
\startalignment[flushright]
 
\startalignment[flushright]
\strut
+
\dontleavehmode
 
\ssb
 
\ssb
 
\bTABLE
 
\bTABLE
Line 93: Line 97:
 
</texcode>
 
</texcode>
  
N.B.: the <tt>\startalignment</tt> requires some text immediately afterwards, hence the <tt>\strut</tt>. If that is left out, the TABLE sits on the left!
+
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:
 
And finally, let's finish the page:
Line 101: Line 105:
 
</texcode>
 
</texcode>
  
And that's it, a very simple cover page. 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.
+
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]]

Latest revision as of 08:59, 1 June 2009

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.