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.
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"/>
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"/>
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
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>
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)
Two commands control indenting of the first line: indenting and setupindenting.
The first command determines the amount of the indent for the first line.
\setupindenting[12pt]
<cmd name="setupindenting"> <opt>12pt</opt> </cmd>
The indenting command, determines when indenting will occurr. By default, ConTeXt will not indent blocks of text that it determines do not look good, such as a block of text after a vertical space. To override this feature and gain complete control over indenting, set indenting to “first”.
\indenting[first]
<cmd name="indenting"> <opt>first</opt> </cmd>
This indents all paragraphs by the amount of the setupindenting command. You probably don’t want headings and titles indented, so just before you write your header, use the noindenting command.
\indenting[first] \setupindenting[12pt] body text ...\par % turn off indenting for a section head \noindenting section head\par % body text will again be indented more body text..\par
<cmd name="indenting"> <opt>first</opt> </cmd> <cmd name="setupindenting"> <opt>12pt</opt> </cmd> body text.. <!--turn off indenting for a section head--> section head\par <!--body text will again be indented--> more body text ...\par
You don’t need to use the indenting command to get indenting to work. If you do not, ConTeXt will use the default of not indenting paragraphs after vertical spaces.
To reduce the width of a text, as for a quote, use the envirnoment “narrower.” Set up the dimensions with the setupnarrower command.
\setupnarrower[left=24pt, right=30pt] \startnarrower[left, right] body text.. \stopnarrower
<cmd name="setupnarrower"> <opt>left=24pt, right=30pt</opt> </cmd> <env name="narrower"> <opt>left, right</opt> quote text </env>
If you do not use the setupnarrower command, ConTeXt will set right and left to 12pt.
If you only want to indent the left, leave off the right for the option in setupnarrower. Likewise, leave off the left if you only want to indent your text to the right.
By default, ConTeXt justifies text. In fact, creating pretty text is one ConTeXt’s main feature. If you want your text non-justified, use the setupalign command with the option of right.
\setupalign[right]
<cmd name="setupalign"> <opt>right</otp> </cmd>
To align text to the left, set the option to left.
To center the text, set the option to middle.
Justified text is easier to read because the spaces between the words are the same.
Kudos for the developers of ConTeXt for making non-justified text so easy to use. In other forms of TeX, using non-justified text required complicated code.
The above code works for setting the alignment for the entire document. To change just a block of text, start a new alignment enviornment. Within this enivronment, the text will take on the justification assigned to it.
\startalignment[middle] {\bfd ABSTRACT OF THESIS}\par \blank[.5in] \stopalignment
As the exmple shows, this structure is good for titles of sections. The examples below don’t allow the fexibilit that of the startalignment environment.
Most likely, you will use one type of alignment for your document, such as justified or non-justified. However, you will often want to change the alignment for just a portion of text, such as the date at the top of a letter, or a title.
To center a line, use the midaligned command.
\midaligned{This text is centered}
<cmd name="midaligned"> <parm>This text is centered</parm> </cmd>
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>
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>
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...}
At present I am a sojourner in civilized life again. <cmd name="footnote"> <parm> Thoreau... </parm> </cmd>
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...}
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
There are a number of ways to set the number for the footnote marker.
To reset the number for every page so each new page starts at 1 (or the symbol or character associated with 1), set the byway option in the setupfootnotes to bypage.
To reset the number for every section, so each new section starts at 1 (or the symbol or character associated with 1), set the byway option in the setupfootnotes to section, where section is the name of your section. This document uses uses only the part section. In order to have my footnotes start at 1 after each part command, I would type way=bypart.
To reset the number manually, set the byway option in the setupfootnotes to bytext. Before each footnote, issue the setnumber command. Put footnote as the option, and the desired number minus 1 as the parameter. If you want the number to be 3, use 2 as your parameter.
\setupfootnotes[way=bytext, conversion=characters] % set the number manually % the next footnote will be *3* \setnumber[footnote]{2} The twelve labors of Hercules\footnote{Hercules had to perform 12 near-impossible tasks to become a god} were trifling in comparison with those which my neighbors have undertaken;
Always use a number as the parameter of the setnumber command. If you want another footnote marker such as a Roman numeral, use the conversion option (see above), and ConTeXt will convert whatever number you choose to the appropriate symbol.
Crete custom space between footnotes by using the setupfootnotedefinition command. Like the setupfootnotes command, this command has an after and before property, only in the case of setupfootnotedefinition, these properties determine the space between individual footnotes rather than before and after the complete block of footnotes.
%set up the amount of space before each footnote \def\DistanceBef{\blank[12pt]} % set up the amount of space after each footnote \def\DistanceAft{\blank[12pt]} \setupfootnotedefinition[ after=\DistanceAft, before=\DistanceBef, ] At present I am a sojourner in civilized life again. \footnote{Thoreau started writing {\sl Walden} in 1846. .. } ... I would fain say something, no so much concerning the Chinese and Sandwich Islanders \footnote{Hawaiians}
To create a footnote with a first line indent, use the hspace command right before your footnote text. You will have to define the actual spacing in a separate command issued previously.
% define amount of space \definehspace[footnoteSpace][12pt] At present I am a sojourner in civilized life again. \footnote{\hspace[footnoteSpace]Thoreau started writing ...}
In order to create a footnote with a hanging indent, you will have to indent the first line by the negative amount of the indent using the hskip command. At the same time, indent the entire footnote by the positive amount of the indent. Last, push the text up by the negative amount of a line by using the vskip command in order to delete the extra space created by the indentin environment.
% define amount to indent \setupnarrower[left=12pt] At present I am a sojourner in civilized life again. \footnote{ \startnarrower[left] % create a negative vertical space equivlent to the line height \vskip-14pt % indent the first line by the negative amount \hskip-12pt Thoreau started writing {\sl Walden} in 1846, a few months after . . . \stopnarrower}
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 |
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
If you use continue as an additional property in the startitemize command, you can continue numbering a list already started. (\startitemize[n, continue])
If you use inmargin as an additional property in the startitemize command, you will push the markers into the margin.
If you use the use intro property in the startitemize command, you will ensure theat the previous paragraph and the list will stick together and not be broken by a page break.
If your item contains more than one paragraph, use the par comand to separate them. Note that the ConTeXt manual suggests you use the head command instead of the item command for items with more than one paragraph, but I found the head command could not handle items with more than 2 paragraphs.
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. ...
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, ] ...
copyright 2005 Paul Henry Tremblay
License: GPL
home | contents | previous | next
last updated: 2005-05-19