Blocks

Paragraph Formatting

The basic block unit in ConTeXt is the paragraph. Create a paragraph block with the par command.

A one line paragraph\par
Another one line paragraph\par


A one line paragraph<cmd name="par" gr="0"/>
Another one line paragraph<cmd name="par" gr="0"/>


ConTeXt allows you to also create a paragraph with a simple blank line, such as you would in email. TeXML works the opposite: it will get rid of any blank lines. So if you use TeXML, the only way to form a paragraph is with the par command.

Space between, before and after

Use the commands setupwhitespace to control the amount of space between paragraph. To reset the amount of space to the default value, use “none” as a value.

\setupwhitespace[5mm]
first paragraph\par
second paragraph\par
third paragraph\par
\setupwhitespace[none]
fourth paragraph\par
fifth paragraph\par

<cmd name="par" gr="0"/>
<cmd name="setupwhitespace">
 <opt>5mm</opt>
</cmd>
first paragraph
<cmd name="par" gr="0"/>
second paragaph
<cmd name="par" gr="0"/>
third paragaph
<cmd name="par" gr="0"/>
<cmd name="setupwhitespace">
 <opt>none</cmd>
</cmd>
fourth paragarph
<cmd name="par" gr="0"/>
fifth paragarph
<cmd name="par" gr="0"/>

creating space between each paragraph

creating space between each paragraph

If you want to add extra space before of after a paragraphs, use the blank command.

before paragraph
\blank[24pt]
This paragraph has 24 points before it and 36 points after it.\par
\blank[36pt]
after paragraph\par

<cmd name="blank">
 <opt>24pt</opt>
</cmd>
This paragraph has 24 points before it and 36 points after it.
<cmd name="par" gr="0"/>
<cmd name="blank">
 <opt>36pt</opt>
</cmd>
after paragraph
<cmd name="par" gr="0"/>

space before and after paragraph

space before and after paragraph

The blank command will not put any blank space at the top of th page unless you use the force option.

\blank[force, 36pt]
% chapter title
Thoreau's Life

<cmd name="blank">
 <opt>force, 36pt</opt>
</cmd>
<!--title chapter-->
Thourea's Life

Line spacing

Set up line spacing with the setupinterlinespace command. This command’s option can be set to small for single spacing (the default), medium for 1.5 spacing, or big for double spacing.

% doublespacing
\setupinterlinespace[big]

<!--doublespacing-->
<cmd name="setupinterlinespace">
 <opt>big</opt>
</cmd>


To gain even more control over the space between lines, change the option to line=x, where x is some value, such as 18pt.

\setupinterlinespace[line=18pt]

<cmd name="setupinterlinespace">
 <opt>line=18pt</opt>
</cmd>

Tips

  • Setting the value of line to some value of ex ensures that your line spacing will always stay in proportion to the size of your font.

  • 2.8ex is the default size of line.

  • 3.5ex seems to be the size for one and one half line spacing (medium).

  • 4.2ex seems to be the size for double spacing (big)

Indenting

Aligning text

Orphan and Widow Controls

Orphans and widows are the ugly text that appears by themselves at the top or bottom of a page. An orphan is the first line of a paragraph on the last line of a page whereas the last line of the paragraph on a new page is a widow. ConTeXt uses the definitions widowpenalty=x and clubpenalty=x to discourage either of these typographical flaws. The default values for each is 150. Increasing the value to 450 should discourage most widows and orphans.

\starttext
% make sure you put these two commands *after*
% the \starttext command
\clubpenalty=450
\widowpenalty=450
...

<env name="text">
<!--
Make sure this text occurs within
the text env
-->
<cmd name="clubpenalty=450"/>
<cmd name="widowpenalty=450"/>
...
</env>

Keeping text with next

Many commercial programs such as Microsoft Word, as well as FO, allow for you to keep section headings with the text that follows, so that they won’t become stuck by themselves at the bottom of the page. You can achieve the same thing with the testpage command.

The testpage command takes one option, a number, which roughly correspond to the number of minimum additional “lines” the page should contain. If the number of the option were 2, ConTeXt checks to see if it can fit two more “lines” on the page. If not, it breaks the page at the testpage command and puts the text on the next page.

This command has the affect of allowing text to stick together. If you issued this command right before a section title, and used the number 3, ConTeXt would check to see if the heading and two additional “lines” below it can fit on the page. If not, it breaks the page, preventing the heading from becoming an orphan.

I put the “lines” in quotes because ConTeXt doesn’t also counts white space as “lines.” If you use white space after your title (an most likely you will), you will have to increase the number in the option. Too high a number will certainly prevent orphans of the title, but will also result an ugly empty spaces at the bottom of pages. 5 or 6 will probably work in most situations.

% space before the sub-title
\blank[12pt]
% make sure the page can contain 5 more virtual lines
% if not, break
\testpage[5]
% the title (which normally would appear in larger 
% font)
Thoreau's Lifestyle\par
% space after the title
\blank[12pt]
<!--space before the sub-title-->
<cmd name="blank">
 <opt>12pt</opt>
</cmd>
<!--
 make sure the page can contain 5 more virtual lines
 if not, break
-->
<cmd name="testpage">
 <opt>3</opt>
</cmd>
<!--
the title (which normally would appear in larger 
 font)
-->
Thoreau's Lifestyle
<cmd name="par" gr="0"/>
<!--space after the title-->
<cmd name="blank">
 <opt>12pt</opt>
</cmd>


Footnotes

default foototes

The footnote command creates footnotes. Put the text of the footnote in the parameter.

At present I am a sojourner in civilized life
again. \footnote{Thoreau...}

source file

At present I am a sojourner in civilized life
again. 
 <cmd name="footnote">
  <parm>
  Thoreau...
  </parm>
 </cmd>

source file

customizing footnotes

Basic customization

The setupfootnotes command allows you to many features for footnotes. This command takes one option, but within that option you can set many properties.

% set up a defintion for the amount of distance
% between the body text and footnotes
% and between the footnotes and footer
\def\DistanceBef{\blank[24pt]}
\def\DistanceAft{\blank[24pt]}

\setupfootnotes[
 % use Roman numerals instead of numbers
 conversion=romannumerals,
 % turn on rule (default)
 % use "off" instead of "on" to get rid of rule
 rule=on,
 % set body font size
 bodyfont=10pt,
 % set width
 width=5in,
 % distnace marker extends into the margin
 margindistance=12pt,
 % distance of footnote from body text
 before=\DistanceBef,
 % distance of footnotes from footer
 after=\DistanceAft,
 ]

At present I am a sojourner in civilized life
again. \footnote{Thoreau...}

source file

customizing footnotes

customizing footnotes

Tips

  • The margindistance property pushes the footnote marker into the margin by the amount you specify. If you do not specify any amount, ConTeXt will push the marker into the margin by a small amount.

  • Other values for conversion are characters for lower-case letters; Characters for upper-case letters; Romannumerals for upper-case Roman numerals; and set 3 for symbols such as daggers and asteristics. You can also experiment with other sets, such as set 1 or set 2. Sets indicate a mathmatical set of symbols defined by ConTeXt.

  • For indenting footnotes, see the next section

Lists

Default list

Form lists by creating an itemize environment. The numbering for the itemized list is determined by the first option of the startitemize command. Here are the possible values for the first option and the result these values produce.

setup result
enumeration symbols
n 1,2,3,4
a a,b,c,d
A A,B,C,D
KA A,B,C,D [small caps]
r i,ii,iii,iv
R I, II, III, IV
KR I, II, III, IV[small caps]
m 1,2,3,4[smaller numbers]
g α,β,γ
G Α,Β,Γ
1
2
3 *
4
5 [circle]
6 [big circle]
7 [bigger circle]
8 ❏ [box]

The item command creates the actual item in the list.

\startitemize[n]
\item {\sl Temperance.} Eat not to dulness. Drink not to Elevation.
\item {\sl Silence.} Speak not but what may benefit other or yourself.
...
\stopitemize

source file

Tips

Defining your own marker

If you wish to use your own markers in a list, rather than have ConTeXt provide them, use the command sym instead of item. Within the parameter, provide the marker you want.

These Names of Virtues with their Precepts were\par
\startitemize
\sym{1)} {\sl Temperance.} Eat not to dulness. Drink not to Elevation.
\sym{2)} {\sl Silence.} Speak not but what may benefit other or yourself.
...

source file

Customizing lists

Customize your list by first using the setupitemize command. If you want to put space before or after the list, or inbetween list items, first establish definitions that you can use in the setupitemize command.

\def\Inbetween{\blank[24pt]}

\def\Before{\blank[24pt]} % between body text and start of list

\def\After{\blank[18pt]} % between body text and start of list

\setupitemize[inbetween=\Inbetween,
before=\Before,
after=\After,
stopper=:,
left=(,
right=),
margin=24pt,
width=48pt,
]
...

source file

customizing a list 1

customizing a list 1

customizing a list 2

customizing a list 2

copyright 2005 Paul Henry Tremblay

License: GPL

home | contents | previous | next

SourceForge.net Logo

last updated: 2005-05-19