%============================================================= %some removed typos (also thanks to erik) %============================================================= %* in layout scheme: head/header foot/footer text/one removed %* \capital becomes \cap %* \Kubic becomes \Cubic %* Hanzeatic becomes Hanseatic %* \abbreviations becomes \abbreviation %* \input{} becomes \input %* table alternatives aangepast (\type{e}||\type{g}) %* \write to/between list was exactly opposite \starttext \TitlePage {\ConTeXt\\an excursion} {English\\Version} {Ton Otten \& Hans Hagen} \Copyright \startfrontmatter \Introduction {Introduction} \SPQR{\startcolumns[n=2,lijn=on]} \CONTEXT\ is a document engineering system based on \TEX. \TEX\ is a typesetting system and a program to typeset and produce documents. \CONTEXT\ is easy to use and enables you to make complex paper and electronic documents. This manual describes the capabilities of \CONTEXT\ and the available commands and their functionality.\footnote{All paper and electronic products around \CONTEXT\ are produced with \CONTEXT. All sources of these products are or will be made available electronically to give you insight in the way these products are made up.} \CONTEXT\ is developed for practical applications: the typesetting and production of documents ranging from simple straight forward books up to very complex and advanced technical manuals and studybooks in a paper or electronic version. This introductory manual describes the \CONTEXT\ functionality necessary to apply standard text elements in a manual or studybook. \CONTEXT, however, is capable of much more and for users who want more there are other \CONTEXT\ manuals and sources available. \CONTEXT\ has a multilingual interface to enable users to work with \CONTEXT\ in their own language. \CONTEXT\ and this manual are available in Dutch, German and English. \SPQR{\stopcolumns} \TableOfContents {Table Of Contents} \stopfrontmatter \page \setupheader[state=normal] \setupfooter[state=normal] \startbodymatter \SPQR{\startcolumns[n=2,lijn=on]} \chapter{How to create a document} \index{input file} Let's assume you want to create a simple document. It has some structure and contains a title page, a few chapters, sections and sub sections. Of course there is a table of contents and an index. \CONTEXT\ can create such a document automatically if you offer the right input by means of a file. So first you have to create an input file. An input file consists of a name and an extension. You can choose any name you want but the extension has to be \type{tex}. If you create a file with the name \type{myfile.tex} you will find no difficulties in running \CONTEXT. An input file could look like this: \startbuffer \starttext \startstandardmakeup \midaligned{How to make a document.} \midaligned{by} \midaligned{The Author} \stopstandardmakeup \completecontents \chapter{Introduction} ... your text\index{indexentry} ... \chapter{One Chapter} \section[firstsection]{The first section} ... your text ... \section{The second section} \subsection{the first sub section} ... your text\index{another indexentry} ... \subsection{the second sub section} ... your text ... \section{The third section} ... your text ... \chapter{Another Chapter} ... your text ... \chapter[lastchapter]{The Last Chapter} ... your text ... \completeindex \stoptext \stopbuffer {\switchtobodyfont[9pt]\typebuffer} \CONTEXT\ expects a plain \ASCII\ input file. Of course you can use any texteditor or wordprocessor you want, but you should not forget that \CONTEXT\ can only read \ASCII\ input. Most texteditors or wordprocessors can export your file as plain \ASCII. The input file should contain the text you want to be processed by \CONTEXT\ and the \CONTEXT\ commands. A \CONTEXT\ command begins with a backslash~\tex{}. With the command \type{\starttext} you indicate the beginning of your text. The area before \type{\starttext} is called the set up area and is used for defining new commands and setting up the layout of your document. A command is usually followed by a bracket pair \type{[]} and/or braces \type{{}}. In \type{\chapter[lastchapter]{The Last Chapter}} the command \type{\chapter} for example tells \CONTEXT\ to perform a few actions concerning design, typography and structure. These actions might be: \startitemize[n,packed] \item start a new page \item increase chapter number by one \item place chapter number in front of chapter title \item reserve some vertical space \item use a big font \item put chapter title (and page number) in table of contents \stopitemize These actions will be performed on the argument that is given between the left and right braces: {\em The Last Chapter}. The \type{[lastchapter]} between brackets has not been mentioned yet. This is a label with a logical name that can be used for referring to that specific chapter. This can be done with yet some other \CONTEXT\ commands: \type{\in{chapter}[lastchapter]} typesets the chapter number, while \type{\about[lastchapter]} returns the title. So now the list of actions can be extended with: \startitemize[continue] \item let label \type{lastchapter} be chapter number (and store this for later use) \stopitemize Other actions concerning running heads, number resetting and interactivity are disregarded at this moment. If you have \CONTEXT\ process this file, you would obtain a very simple document with a few numbered chapter and section headers. While processing the file \CONTEXT\ takes care of many things. One of these things is for example page numbering. But in order to make a table of contents \CONTEXT\ needs page numbers that are not yet known to \CONTEXT\ at the first run. So you have to process this file twice (a two pass job). \CONTEXT\ will produce a few auxilliary files to store this kind of information. These are to be processed by \TEXUTIL. In some instances you have to process an input file three times (a three pass job). One can use \TEXEXEC\ to set up \CONTEXT\ from the command line. This \PERL\ script also takes care of the multiple passes. \chapter{How to process a file }%/ Run \CONTEXT \index{input file+processing} \index[dvifile]{\type{dvi}--file} \index[pdffile]{\type{pdf}--file} If you want to process a \CONTEXT\ input file, you might type at the command line prompt: \starttyping context filename \stoptyping The availability of the batch command \type{context} depends on the system you're using. Ask your system administrator the command you use to start \CONTEXT. If your file's name is \type{myfile.tex} this can be: \starttyping context myfile \stoptyping the extension \type{.tex} is not needed. After pressing \Enter\ processing will be started. \CONTEXT\ will show processing information on your screen. If processing is succesful the command line prompt will return and \CONTEXT\ will produce a \type{dvi} or \type{pdf} file. If processing is not succesful ---for example because you typed \type{\stptext} instead of \type{\stoptext}--- \CONTEXT\ produces a~\type{ ? } on your terminal and tells you it has just processed an error. It will give you some basic information on the type of error and the line number where the error becomes effective. At the instant of \type{?} you can type: \defineparagraphs[key][n=2,before=,after=] \setupparagraphs [key][1][width=4em] \startpacked \key \type{H} \\ for help information on your error \\ \key \type{I} \\ for inserting the correct \CONTEXT\ command \\ \key \type{Q} \\ for quiting and entering batch mode \\ \key \type{X} \\ for exiting the running mode \\ \key \Enter \\ for ignoring the error \\ \stoppacked Most of the time you will type \Enter\ and processing will continue. Then you can edit the input file and fix the error. Some errors will produce a~\type{ * } on your screen and processing will stop. This error is due to a fatal error in your input file. You can't ignore this error and the only option you have is to type \type{\stop}. The program will be halted and you can fix the error. During the processing of your input file \CONTEXT\ will also inform you of what it is doing with your document. For example it will show page numbers and information about process steps. Further more it gives warnings. These are of a typographical order and tells you when line breaking is not successful. All information on processing is stored in a \type{log} file that can be used for reviewing warnings and errors and the respective line numbers where they occur in your file. When processing is succesful \CONTEXT\ produces a new file, with the extension \type{.dvi}. If you run \type{myfile.tex}, a file \type{myfile.dvi} is produced. The abbreviation \type{dvi} stands for Device Indepent. This means that the file can be processed by a printer driver to make the file suitable for printing or viewing. The \type{dvi} file can be transformed to a \PS\ file, \HP\ file or whatever file you want. \chapter[special chars]{Special characters} \index{special characters} You have seen that \CONTEXT\ commands are preceded by a \tex{} (backslash). This means that \tex{} has a special meaning to \CONTEXT. Aside from \tex{} there are other characters that need special attention when you want them to appear in verbatim mode or in text mode. \in{Table}[tab:specchars] gives an overview of these special characters and what you have to type to produce them. \let\normalunderscore=\_ \let\normaltilde =\~ \placetable[here,force][tab:specchars] {Special characters (1).} \starttable[|c|c|c|c|c|] \HL \NC \bf \LOW{Special character} \NC \use2 \bf Verbatim \NC \use2 \bf Text \NC\FR \NC \NC \bf Type \NC \bf To produce \NC \bf Type \NC \bf To produce \NC\LR \HL \NC \type{#} \NC \type{\type{#}} \NC \type{#} \VL \type{\#} \NC \# \NC\FR \NC \type{$} \NC \type{\type{$}} \NC \type{$} \VL \type{\$} \NC \$ \NC\MR \NC \type{&} \NC \type{\type{&}} \NC \type{&} \VL \type{\&} \NC \& \NC\MR \NC \type{%} \NC \type{\type{%}} \NC \type{%} \VL \type{\%} \NC \% \NC\LR \HL \stoptable Other special characters have a meaning in typesetting mathematical expressions and some can be used in math mode only (see \in{chapter}[formulas]). \let\normalbar=| \placetable [here,force] [tab:special chars] {Special characters (2).} \starttable[|c|c|c|c|c|] \HL \NC \bf \LOW{Special character} \NC \use2 \bf Verbatim \NC \use2 \bf Text \NC\FR \NC \NC \bf Type \NC \bf To produce \NC \bf Type \NC \bf To produce \NC\LR \HL \NC \type{+} \NC \type{\type{+}} \NC \type{+} \VL \type{$+$} \NC $+$ \NC\FR \NC \type{-} \NC \type{\type{-}} \NC \type{-} \VL \type{$-$} \NC $-$ \NC\MR \NC \type{=} \NC \type{\type{=}} \NC \type{=} \VL \type{$=$} \NC $=$ \NC\MR \NC \type{<} \NC \type{\type{<}} \NC \type{<} \VL \type{$<$} \NC $<$ \NC\MR \NC \type{>} \NC \type{\type{>}} \NC \type{>} \VL \type{$>$} \NC $>$ \NC\LR \HL \stoptable \chapter{Defining a document} Every document is started with \type{\starttext} and closed with \type{\stoptext}. All textual input is placed between these two commands and \CONTEXT\ will only process that information. Setup information is placed in the set up area just before \type{\starttext}. \startbuffer \setupbody[12pt] \starttext This is a one line document. \stoptext \stopbuffer \typebuffer Within the \type{\starttext} $\cdots$ \type{\stoptext} a document can be divided into four main devisions: \startitemize[n,packed] \item front matter \item body matter \item back matter \item appendices \stopitemize The devisions are defined with: \starttyping \startfrontmatter ... \stopfrontmatter \startbodymatter ... \stopbodymatter \startbackmatter ... \stopbackmatter \startappendices ... \stopappendices \stoptyping In the front matter as well as back matter section the command \type{\chapter} produces an un-numbered header in the table of contents. This section is mostly used for the table of contents, the list of figures and tables, the preface, the acknowledgements etc. This section often has a roman page numbering. The appendices section is used for (indeed) appendices. Headers may be typeset in a different way; for example, \type{\chapter} may be numbered alphabetically. Section style can be set up with: \shortsetup{setupsectionblock} \chapter[headers]{Headers} \index{headers} \Command{\tex{chapter}} \Command{\tex{paragraph}} \Command{\tex{subparagraph}} \Command{\tex{title}} \Command{\tex{subject}} \Command{\tex{subsubject}} \Command{\tex{setuphead}} \Command{\tex{setupheads}} The structure of a document is determined by its headers. Headers are created with the commands shown in \in{table}[tab:headers]: \placetable[here][tab:headers]{Headers.} \starttable[|l|l|] \HL \NC \bf Numbered header \NC \bf Un-numbered header \NC\SR \HL \NC \type{\chapter} \NC \type{\title} \NC\FR \NC \type{\section} \NC \type{\subject} \NC\MR \NC \type{\subsection} \NC \type{\subsubject} \NC\MR \NC \type{\subsubsection} \NC \type{\subsubsubject} \NC\MR \NC $\cdots$ \NC $\cdots$ \NC\LR \HL \stoptable \shortsetup{chapter} \shortsetup{section} \shortsetup{subsection} \shortsetup{title} \shortsetup{subject} \shortsetup{subsubject} These commands will produce a header in a predefined fontsize and fonttype with some vertical spacing before and after the header. The heading commands can take several arguments, like in: \starttyping \title[hasselt-by-night]{Hasselt by night} \stoptyping and \starttyping \title{Hasselt by night} \stoptyping The bracket pair is optional and used for internal references. If you want to refer to this header you type for example \type{\on{page}[hasselt-by-night]}. Of course these headers can be set to your own preferences and you can even define your own headers. This is done by the command \type{\setuphead} and \type{\definehead}. \shortsetup{definehead} \shortsetup{setuphead} \SPQR{\setupindenting[0pc]} \startbuffer \definehead [myheader] [section] \setuphead [myheader] [numberstyle=bold, textstyle=capital, before=\hairline\blank, after=\nowhitespace\hairline] \myheader[myhead]{Hasselt makes headlines} \stopbuffer \typebuffer A new header \type{\myheader} is defined and it inherits the properties of \type{\section}. It would look something like this: \getbuffer \SPQR{\setupindenting[1pc]} There is one other command you should know now, and that is \type{\setupheads}. You can use this command to set up the numbering of the numbered headers. If you type: \startbuffer \setupheads [alternative=inmargin, separator=--] \stopbuffer \typebuffer all numbers will appear in the margin. Section 1.1 would look like 1--1. Commands like \type{\setupheads} are typed in the set up area of your input file. \shortsetup{setupheads} \chapter[itemize]{Itemize} \index{itemize} \index{columns in itemize} \Command{\tex{startitemize}} \Command{\tex{setupitemize}} \Command{\tex{definesymbol}} \Command{\tex{item}} \Command{\tex{head}} One way of structuring your information is by way of enumeration or summing up items. The itemize command looks like this: \shortsetup{startitemize} For example: \startbuffer \startitemize[R,packed,broad] \item Hasselt was founded in the 14th century. \item Hasselt is known as a Hanseatic League town. \item Hasselt's name stems from a tree. \stopitemize \stopbuffer \typebuffer Within the \type{\startitemize} $\cdots$ \type{\stopitemize} pair you start a new item with \type{\item}. The space after \type{\item} is required. In the example above \type{R} specifies Roman numbering and \type{packed} keeps line spacing to a minimum. The parameter \type{broad} takes care of vertical spacing after the item separator. The example would produce: \getbuffer Itemization is a two pass job. This means that you have to run your file twice for an optimal layout. The bracket pair contains information on item seperators and local set up variables. \placetable [here,force] [tab:itemsetup] {Item separators in itemize.} \starttable[|l|l|] \HL \NC \bf Argument \NC \bf Item separator \NC\SR \HL \NC 1 \NC $-$ \NC\FR \NC 2 \NC $\bullet$ \NC\MR \NC 3 \NC $\star$ \NC\MR \NC $\vdots$ \NC $\vdots$ \NC\MR \NC n \NC 1 2 3 4 $\cdots$ \NC\MR \NC a \NC a b c d $\cdots$ \NC\MR \NC A \NC A B C D $\cdots$ \NC\MR \NC r \NC i ii iii iv $\cdots$ \NC\MR \NC R \NC I II III IV $\cdots$ \NC\LR \HL \stoptable You can also define your own item separator by means of \type{\definesymbol}. For example if you try this: \startbuffer \definesymbol[5][$\clubsuit$] \startitemize[5,packed] \item Hasselt was built on a river dune. \item Hasselt lies at the crossing of two rivers. \stopitemize \stopbuffer \typebuffer You will get: \getbuffer Sometimes you would like to have headers within an enumeration. In that case you should use \type{\head} instead of \type{\item}. \startbuffer Hasselt lies in the province of Overijssel and there are a number of customs that are typical of this province. \startitemize \head kraamschudden \hfill (child welcoming) When a child is born the neighbours come to visit the new parents. The women come to admire the baby and the men come to judge the baby (if it is a boy) whether he will become a strong man. The neighbours will bring a {\em krentenwegge} along. A krentenwegge is a loaf of currant bread of about 1 \Meter\ long. Of course the birth is celebrated with {\em jenever}. \head nabuurschap (naberschop) \hfill (neighbourship) Smaller communities used to be very dependent on the cooperation among the members for their well being. Members of the {\em nabuurschap} helped each other in difficult times during harvest times, funerals or any hardship that fell upon the community. \head Abraham \& Sarah \hfill (identical) When people turn 50 in Hasselt it is said that they see Abraham or Sarah. The custom is to give these people a {\em speculaas} Abraham or a Sarah. Speculaas is a kind of hard spiced biscuit. \stopitemize \stopbuffer \typebuffer The \type{\head} can be set up with \type{\setupitemize}. In case of a page breaking a \type{\head} will appear on a new page. The example of old customs will look like this: \getbuffer You can use the set up parameters in \type{\startitemize}, but for reasons of consistency you can make them valid for the complete document with \type{\setupitemize}. \SPQRSTOPCOLUMNS The set up parameters are described in \in{table}[tab:tablesetup]. The parameter \type{columns} is used in conjunction with a number. If you type this: \startbuffer \startitemize[n,columns,four] \item Achter 't Werk . . . \item Justitiebastion \stopitemize \stopbuffer \typebuffer You will get: \startbuffer \startitemize[n,columns,four] \item Achter 't Werk \item Baangracht \item Brouwersgracht \item Eikenlaan \item Eiland \item Gasthuisstraat \item Heerengracht \item Hofstraat \item Hoogstraat \item Julianakade \item Justitiebastion \stopitemize \stopbuffer \getbuffer When you want to continue an enumeration after a short intermezzo, use \type{\startitemize[continue,columns,three,broad]}, and numbering will continue in a three column format. \startbuffer \startitemize[continue, columns, three, broad] \item Kaai \item Kalverstraat \item Kastanjelaan \item Keppelstraat \item Markt \item Meestersteeg \item Prinsengracht \item Raamstraat \item Ridderstraat \item Rosmolenstraat \item Royenplein \item Van Nahuijsweg \item Vicariehof \item Vissteeg \item Watersteeg \item Wilhelminalaan \item Ziekenhuisstraat \stopitemize \stopbuffer \getbuffer The parameter \type{broad} enlarges the horizontal space between item separator and itemtext. \shortsetup{setupitemize} \placetable [force] [tab:tablesetup] {Set up parameters in itemize.} \starttable[|l|l|] \HL \NC \bf Set up \NC \bf Meaning \NC\SR \HL \NC standard \NC standard (global) set up \NC\FR \NC packed \NC no vertical spacing between items \NC\MR \NC serried \NC no horizontal spacing between separator and text \NC\MR \NC joinedup \NC no vertical spacing before and after itemize \NC\MR \NC broad \NC horizontal spacing between separator and text \NC\MR \NC inmargin \NC place separator in margin \NC\MR \NC atmargin \NC place separator on margin \NC\MR \NC stopper \NC place full stop after separator \NC\MR \NC columns \NC put items in columns \NC\MR \NC intro \NC prevent page breaking after introduction line \NC\MR \NC continue \NC continue numbering or lettering \NC\LR \HL \stoptable \SPQRSTARTCOLUMNS An itemize within an itemize is automatically typeset in a correct way. For example if you type: \startbuffer In The Netherlands the cities can determine the size of a number of taxes. So the cost of living can differ from town to town. There are differences of up to 50\% in taxes such as: \setupitemize[2][width=5em] \startitemize[n] \item real estate tax The real estate tax is divided into two components: \startitemize[a,packed] \item the ownership tax \item the tenant tax \stopitemize If the real estate has no tenant the owner pays both components. \item dog licence fee The owner of one or more dogs pays a fee. When a dog has died or been sold the owner has to inform city hall. \stopitemize \stopbuffer \typebuffer then the horizontal space between item separator and text at the second level is set with \type{\setupitemize[2][width=6em]}. The example will look like this: \start \getbuffer \stop \chapter[formulas]{Formulae} \index{formula} \Command{\tex{placeformula}} \Command{\tex{startformula}} \Command{\tex{setupformulae}} You can typeset numbered formulas with: \shortsetup{placeformula} \shortsetup{startformula} Two examples: \startbuffer \placeformula[formula:aformula] \startformula y=x^2 \stopformula \placeformula \startformula \int_0^1 x^2 dx \stopformula \stopbuffer \typebuffer \getbuffer Between \type{\startformula} and \type{\stopformula} you are in math mode so you can define any formula you want by using \TEX\ commands. We advise you to do some further reading on typesetting formulae in \TEX. See for example: \startitemize[packed] \item {\em The \TeX Book} by D.E. Knuth \item {\em The Beginners Book of \TeX} by S. Levy and R. Seroul \stopitemize Math mode can occur in two modes: in text mode and display mode. Mathematic expressions in text mode are placed between \type{$} and \type{$}. \startbuffer The Hasselt community covers an area of 42,05 \Square \Kilo \Meter. Now if you consider a circular area of this size with the market place of Hasselt as the center point $M$ you can calculate its diameter with ${{1}\over{4}} \pi r^2$. \stopbuffer \typebuffer This will become: \getbuffer The many \type{{}} in ${{1}\over{4}} \pi r^2$ are essential for separating operations in the expression. If you omit the outer curly braces like this: \type{${1}\over{4} \pi r^2$}, you would not get the desired result: ${1}\over{4} \pi r^2$. Although display mode can also be entered and exit with \type {$$}, but only \type {\startformula} and friend get the spacing right. So if you type: \startbuffer $$ \int_0^1 x^2 dx $$ \stopbuffer \typebuffer you will get an expression that is {\em displayed} in the middle of a page, but not well as aligned as the previous examples. \getbuffer The command \type{\placeformula} handles spacing around the formulae and the numbering of the formula. The bracket pair is optional and is used for cross-references and switching numbering off. The curly braces are also optional and are used for text. \startbuffer \placeformula[first one] \startformula y=x^2 \stopformula \placeformula[middle one] \startformula y=x^3 \stopformula \placeformula[last one] \startformula y=x^4 \stopformula \stopbuffer \getbuffer \in{Formula}[middle one] was typed like this: \startbuffer \placeformula[middle one] \startformula y=x^3 \stopformula \stopbuffer \typebuffer The label \type{[middle one]} is used for referring to this formula. Such a reference is made with \type{\in{formula}[middle one]}. If no numbering is required you type: \type{\placeformula[-]} Numbering of formulae is set up with \type{\setupnumbering}. This manual is typeset with \type{\setupnumbering[way=bychapter]}. This means that the chapter number preceeds the formula number and numbering is reset with each new chapter. For reasons of consistency the tables, figures, intermezzi etc are numbered in the same way. Therefore you use \type{\setupnumbering} in the set up area of your input file. Formulae can be set up with: \shortsetup{setupformulae} \chapter{Legends} \index{legends} \Command{\tex{startlegend}} \Command{\tex{leg}} \Command{\tex{startfact}} \Command{\tex{fact}} The commands \type{\startlegend} $\cdots$ \type{\stoplegend} are used to explain the meaning of symbols in formulae. For example, if you want to display a formula and its legend: \startbuffer \placeformula$$ s = v t + {{1}\over{2}} a t^2 $$ \startlegend \leg s \\ displacement \\ m \\ \leg v \\ velocity \\ m/s \\ \leg t \\ time \\ s \\ \leg a \\ acceleration \\ m/s^2 \\ \stoplegend \stopbuffer \pagereference[pag:legend]\getbuffer You will have to type something like this: \typebuffer The command \type{\leg} starts a new row and \type{\\} is a column separator. The last \type{\\} in each row is essential. The spaces are optional and have no effect on the outcome. However, these commands are easily mistyped and misread while checking. So take some time to make a readable input file. \shortsetup{startlegend} The first column is used for symbols and is typeset in mathematical mode. The second column is used for explanations of the symbols and the third one for units and dimensions. Because of the necessity of sub- and superscript the third column is in mathematical mode, but the text is displayed in the normal font. Complementary to legends is a command that displays facts in a consistent way when formulae are used for calculations. Such a command looks like this: \startbuffer \startfact \fact velocity \\ v \\ 10~m/s \\ \fact accelaration \\ a \\ - 3~m/s^2 \\ \fact time \\ t \\ 3~s \\ \stopfact \stopbuffer \typebuffer The two last columns are in mathematical mode, the last column displays text in the normal font. The \type{~} is obligatory, because spaces are ignored in mathematical mode. \getbuffer \chapter[units]{Units} \index{units} \index[siunit]{\cap{SI}--unit} \Command{\tex{unit}} \Command{\tex{permille}} \Command{\tex{percent}} To force yourself to use dimensions and units consistently throughout the document you can make your own list with units. These are specified in the set up area of your input file. In \CONTEXT\ there is an external module available that contains almost all \SI||units. When this module is loaded with \type{\usemodule[units]} you can call units with: \startbuffer \Meter \Per \Square \Meter \Cubic \Meter \Per \Sec \Square \Milli \Meter \Per \Inch \Centi \Liter \Per \Sec \Meter \Inverse \Sec \Newton \Per \Square \Inch \Newton \Times \Meter \Per \Square \Sec \stopbuffer \typebuffer It looks like a lot of typing but it does guarantee a consistent use of units. The command \type{\unit} also prevents the separation of value and unit at line breaks. The units would come out as: \startnarrower \startlines \getbuffer \stoplines \stopnarrower You can define your own units with: \starttyping \unit[Ounce]{oz}{} \stoptyping \unit[Ounce]{oz}{} Later on in the document you can type \type{15.6 \Ounce} that will be displayed as 15.6 \Ounce. The legend on \at{page}[pag:legend] would be more consistent if you typed it like this: \startbuffer \startlegenda \leg s \\ place \\ \Meter \\ \leg v \\ velocity \\ \Meter \Per \Sec \\ \leg t \\ time \\ \Sec \\ \leg a \\ acceleration \\ \Meter \Per \Square \Sec \\ \stoplegenda \stopbuffer \typebuffer The command \type{\unit} is an application of synonyms. See \in{chapter}[synonyms] for more information on synonyms. In order to write \percent\ and \permille\ in a consistent way there are two specific commands: \type{\percent} \crlf \type{\permille} \chapter[figures]{Figures} \index{figure} %\zieindex{picture}{figure} \index{floating blocks} \Command{\tex{placefigure}} \Command{\tex{startfiguretext}} \Command{\tex{setupfigures}} \Command{\tex{useexternalfigures}} \Command{\tex{startcombination}} \Command{\tex{setupfloats}} \Command{\tex{setupcaptions}} \Command{\tex{externalfigure}} Photographs and pictures can be inserted in your document with the following command: \useexternalfigure [hasselt church][hass24g] [width=.4\textwidth] \startbuffer \placefigure [][fig:church] {Stephanus Church.} {\externalfigure[hasselt church]} \stopbuffer \typebuffer After processing this will come out as \in{figure}[fig:church] at the first available place. \getbuffer The command \type{\placefigure} handles numbering and vertical spacing before and after your figure. Furthermore this command initializes a float mechanism, which means that \CONTEXT\ looks whether there is enough space for your figure on the page. If not the figure will be placed at another location and the text carries on, while the figure floats in your document until the optimal location is found. You can influence this mechanism within the first bracket pair. The command \type{\placefigure} is a predefined example of: \shortsetup{\e!plaats<<\y!blok>>} The options are described in \in{table}[tab:placefigure]. \placetable [here] [tab:placefigure] {Options in \type{\placefigure}.} \starttable[|l|l|] \HL \NC \bf Option \NC \bf Meaning \NC\SR \HL \NC here \NC put figure at this location if possible \NC\FR \NC force \NC ignore float mechanism and place figure \NC\MR \NC page \NC put figure at top of the next page \NC\MR \NC top \NC put the caption above figure \NC\MR \NC bottom \NC put caption under figure \NC\MR \NC left \NC place figure at the left margin \NC\MR \NC right \NC place figure at the right margin \NC\LR \HL \stoptable The second bracket pair is used for cross-referencing. You can refer to this particular figure by typing: \starttyping \in{figure}[fig:church] \stoptyping The first brace pair is used for the caption. You can type any text you want. If you want no caption and no number, you can type \type{{none}}. The figure labels are set up with \type{\setupcaptions} and the numbering is (re)set by \type{\setupnumbering} (see \in{paragraph}[floatingblocks]). The second brace pair is used for defining the figure and addressing the file names of external figures. In the next example you see how \inframed[height=1em]{Hasselt} is defined within the last brace pair to show you the function of \type{\placefigure{}{}}. \startbuffer \placefigure {A framed Hasselt.} {\framed{\tfd Hasselt}} \stopbuffer \typebuffer This will produce: \getbuffer However, your pictures are often created using programs like Corel Draw or Illustrator and photos are --- after scanning --- improved in packages like PhotoShop. Then the figures are available as files. \CONTEXT, in conjunction with \TEXUTIL, supports \type {EPS}, \type {TIF}, \type {JPG}, \type {MPS}, \type {PDF}, and \type {PNG} files, although inclusion depends on the \DVI\ drivers used. Currently \PDFTEX\ supports the most formats. Users normally can trust \CONTEXT\ to find the best possible file type. In \in{figure}[fig:canal] you see a photo and a graphic combined into one figure. \startbuffer \useexternalfigure [Photo][hass03g] [width=.4\textwidth] \useexternalfigure [Graphic][gracht] [width=.4\textwidth] \placefigure [here,force] [fig:canal] {The Hasselt Canals.} \startcombination[2*1] {\externalfigure[Photo]} {a bitmap picture} {\externalfigure[Graphic]} {a vector graphic} \stopcombinatie \stopbuffer \getbuffer You can produce this figure by typing something like: \typebuffer \shortsetup{useexternalfigure} The command \type{\useexternalfigure} has three bracket pairs. The first pair contains a logical name of the figure. This is optional and used when one figure appears more than once in your document. The second pair contains the file name (without extension). The third pair leaves room for filetype definition and some set up parameters. In well structured documents you would type \type{\useexternalfigure} in the set up area of your input file. \shortsetup{startcombination} The \type{\startcombination} $\cdots$ \type{\stopcombination} pair is used for combining two pictures in one figure. You can type the number of pictures within the bracket pair. If you want to display one picture below the other you would have typed \type{[1*2]}. You can imagine what happens when you combine 6~pictures as \type{[3*2]} (\type{[h*v]}). The examples shown above are enough for creating illustrated documents. Sometimes however you want a more integrated layout of the picture and the text. For that purpose you can use: \shortsetup{\e!start<<\y!blok>>\e!tekst} Figure and table texts are already predefined: \startbuffer \startfiguretext [left] [fig:citizens] {none} {\externalfigure[hass07g] [width=.5\makeupwidth]} Hasselt has always had a varying number of citizens due to economic events. For example the Dedemsvaart was dug around 1810. This canal runs through Hasselt and therefore trade flourished. This led to a population growth of almost 40\% within 10~years. Nowadays the Dedemsvaart has no commercial value anymore and the canals have become a tourist attraction. \stopfiguretext \stopbuffer \typebuffer is shown in the figure below. \SPQRSTOPCOLUMNS \start \setuptolerance[verytolerant] \getbuffer \stop \shortsetup{externalfigure} \SPQRSTARTCOLUMNS The last curly brace pair encloses the command \type{\externalfigure}. This command gives you the freedom to do anything you want with a figure. \type{\externalfigure} has two bracket pairs. The first is used for the exact file name without extension, the second for file formats and dimensions. It is not difficult to guess what happens if you type:\footnote{See \op{page}[marginpicture]}. \startbuffer[marginpicture] \inmarge {\externalfigure [hass23g] [width=\marginwidth]} \stopbuffer \typebuffer[marginpicture] You can set up the layout of figures with: \shortsetup{setupfloats} You can set up the numbering and the labels with: \shortsetup{setupcaptions} These commands are typed in the set up area of your input file and have a global effect on all floating blocks. \startbuffer \setupfloats [location=right] \setupcaptions [location=top, height=.4\makeupheight, style=boldslanted] \placefigure {Just a picture.} {\externalfigure[hass18g][width=4cm]} \stopbuffer \typebuffer {\getbuffer} \chapter[tables]{Tables} \index{tables} \index{floating blocks} \Command{\tex{placetable}} \Command{\tex{setuptables}} \Command{\tex{starttable}} \Command{\tex{startcombination}} \Command{\tex{setupfloats}} \Command{\tex{setupcaptions}} \Command{\tex{NR}} \Command{\tex{FR}} \Command{\tex{LR}} \Command{\tex{MR}} \Command{\tex{SR}} \Command{\tex{VL}} \Command{\tex{NC}} \Command{\tex{HL}} \Command{\tex{DL}} \Command{\tex{DC}} \Command{\tex{DR}} \Command{\tex{LOW}} \Command{\tex{TWO}} \Command{\tex{THREE}} {\em In general, a table consists of columns which may be independently left adjusted, centered, right adjusted, or aligned on decimal points. Headings may be placed over single columns or groups of columns. Table entries may contain equations or several rows of text. Horizontal and vertical lines may be drawn wholly or partially across the table.} This is what Michael J. Wichura wrote in the preface of the manual of \TABLE\ (\TABLE\ manual, 1988). Michael Wichura % rf: spurious full stop after 1988 removed is also the author of the \TABLE\ macros \CONTEXT\ is relying on when processing tables. A few \CONTEXT\ macros were added to take care of consistent line spacing and to make the interface a little less cryptic.\footnote{\CONTEXT\ was developed for non||technical users in the \cap{WYSIWYG} era. Therefore a user friendly interface and easy file and command handling were needed, and cryptic commands, programming and logical reasoning had to be avoided.} For placing a table the command \type{\placetable} is used which is a predefined example of: \shortsetup{\e!plaats<<\y!blok>>} For defining the table you use: \shortsetup{starttable} The definition of a table could look something like this: \startbuffer \placetable[here][tab:ships]{Ships that moored at Hasselt.} \starttable[|c|c|] \HL \NC \bf Year \NC \bf Number of ships \NC\SR \HL \NC 1645 \NC 450 \NC\FR \NC 1671 \NC 480 \NC\MR \NC 1676 \NC 500 \NC\MR \NC 1695 \NC 930 \NC\LR \HL \stoptable \stopbuffer \typebuffer This table is typeset as \in{table}[tab:ships]. \getbuffer The first command \type{\placetable} has the same function as \type{\placefigure}. It takes care of spacing before and after the table and numbering. Furthermore the floating mechanism is initialized so the table will be placed at the most optimal location of the page. The table entries are placed between the \type{\starttable} $\cdots$ \type{\stoptable} pair. Between the bracket pair your can specify the table format with the column separators \type{|} and the format keys (see \in{table}[tab:formatkeys]). \placetable [] [tab:formatkeys] {Table format keys.} \starttable[|l|l|] \HL \NC \bf Key \NC \bf Meaning \NC\SR \HL \NC \type{|} \NC column separator \NC\FR \NC \type{c} \NC center \NC\MR \NC \type{l} \NC flush left \NC\MR \NC \type{r} \NC flush right \NC\MR \NC \type{s} \NC set intercolumn space at value $n = 0, 1,2$ \NC\MR \NC \type{w<>} \NC set minimum column width at specified value \NC\LR \HL \stoptable In addition to the format keys there are format commands. \in{Table}[tab:formatcommands] shows a few of the essential commands. \placetable [here] [tab:formatcommands] {Table format commands.} \starttable[|l|l|] \HL \NC \bf Command \NC \bf Meaning \NC\SR \HL \NC \type{\JustLeft} \NC flush left and suppress column format \NC\FR \NC \type{\JustRight} \NC flush right and suppress column format \NC\MR \NC \type{\JustCenter} \NC center and suppress column format \NC\MR % rf: space between suppress and column \NC \type{\SetTableToWidth{}} \NC specify exact table width \NC\MR \NC \type{\use{n}} \NC use the space of the next $n$ columns \NC\LR \HL \stoptable In the examples you have seen so far a number of \CONTEXT\ formatting commands were used. These commands are somewhat longer than the original and less cryptic but they also handle a lot of table typography. In \in{table}[tab:contextformatcommands] an overview of these commands is given. \placetable [here] [tab:contextformatcommands] {\CONTEXT\ table format commands.} {\setuptables[bodyfont=small] \starttable[s1|l|l|l|] \HL \NC \bf Command \NC \NC \bf Meaning \NC\SR \HL \NC \type{\NR} \NC next row \NC make row with no vertical space adjustment \NC\FR \NC \type{\FR} \NC first row \NC make row, adjust upper spacing \NC\MR \NC \type{\LR} \NC last row \NC make row, adjust lower spacing \NC\MR \NC \type{\MR} \NC mid row \NC make row, adjust upper and lower spacing \NC\MR \NC \type{\SR} \NC separate row \NC make row, adjust upper and lower spacing \NC\MR \NC \type{\VL} \NC vertical line \NC draw a vertical line, go to next column \NC\MR \NC \type{\NC} \NC next column \NC go to next column \NC\MR \NC \type{\HL} \NC horizontal line \NC draw a horizontal \NC\MR \NC \type{\DL} \NC division line$^\star$ \NC draw a division line over the next column \NC\MR \NC \type{\DL[n]} \NC division line$^\star$ \NC draw a division line over $n$ columns \NC\MR \NC \type{\DC} \NC division column$^\star$ \NC draw a space over the next column \NC\MR \NC \type{\DR} \NC division row$^\star$ \NC make row, adjust upper and lower spacing \NC\MR \NC \type{\LOW{text}} \NC --- \NC lower {\em text} \NC\MR \NC \type{\TWO}, \type{\THREE} etc. \NC --- \NC use the space of the next {\em two}, {\em three} columns \NC\LR \HL \NC \use3 \JustLeft{$^\star$ \type{\DL, \DC} and \type{\DR} are used in combination.} \NC\FR \stoptable} The tables below are shown with their sources. You can always read the \TABLE\ manual by M.J. Wichura for more sophisticated examples. \startbuffer \placetable [here,force] [tab:effects of commands] {Effect of formatting commands.} \startcombination[2*1] {\starttable[|c|c|] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable}{standard} {\starttable[|c|c|] \HL \VL \bf Year \VL \bf Citizens \VL\NR \HL \VL 1675 \VL ~428 \VL\NR \VL 1795 \VL 1124 \VL\NR \VL 1880 \VL 2405 \VL\NR \VL 1995 \VL 7408 \VL\NR \HL \stoptable}{only \type{\NR}} \stopcombination \stopbuffer \typebuffer In the example above the first table \type{\SR}, \type{\FR}, \type{\MR} and \type{\LR} are used. These commands take care of line spacing within a table. As you can see below the command \type{\NR} only starts a new row. \getbuffer In the example below column interspacing with the \type{s0} and \type{s1} keys is shown. \startbuffer \startbuffer[one] \starttable[|c|c|] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable \stopbuffer \startbuffer[two] \starttable[s0 | c | c |] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable \stopbuffer \startbuffer[three] \starttable[| s0 c | c |] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable \stopbuffer \startbuffer[four] \starttable[| c | s0 c |] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable \stopbuffer \startbuffer[five] \starttable[s1 | c | c |] \HL \VL \bf Year \VL \bf Citizens \VL\SR \HL \VL 1675 \VL ~428 \VL\FR \VL 1795 \VL 1124 \VL\MR \VL 1880 \VL 2405 \VL\MR \VL 1995 \VL 7408 \VL\LR \HL \stoptable \stopbuffer \placetable [here,force] [tab:formatcommands-2] {Effect of formatting commands.} \startcombination[3*2] {\getbuffer[one]} {standard} {\getbuffer[two]} {\type{s0}} {\getbuffer[three]} {\type{s0} in column~1} {\getbuffer[four]} {\type{s0} in column~2} {\getbuffer[five]} {\type{s1}} {} {} \stopcombination \stopbuffer \typebuffer After processing these tables come out as \in{table}[tab:formatcommands-2]. The default table % rf: appended `-2' to label to avoid repetition (also in \placetable % command immediately above this para) % rf: "has a" omitted at end line column interspacing is \type{s2}. \getbuffer Columns are often separated with a vertical line $|$ and rows by a horizontal line. \startbuffer \placetable [here,force] [tab:divisions] {Effect of options.} \starttable[|c|c|c|] \NC Steenwijk \NC Zwartsluis \NC Hasselt \NC\SR \DC \DL \DC \DR \NC Zwartsluis \VL Hasselt \VL Steenwijk \NC\SR \DC \DL \DC \DR \NC Hasselt \NC Steenwijk \NC Zwartsluis \NC\SR \stoptable \stopbuffer \typebuffer \getbuffer A more sensible example is given in the table below. \startbuffer \placetable [here,force] [tab:examplecontextcommands] {Effect of \CONTEXT\ formatting commands.} \starttable[|l|c|c|c|c|] \HL \VL \FIVE \JustCenter{City council elections in 1994} \VL\SR \HL \VL \LOW{Party} \VL \THREE{Districts} \VL \LOW{Total} \VL\SR \DC \DL[3] \DC \DR \VL \VL 1 \VL 2 \VL 3 \VL \VL\SR \HL \VL PvdA \VL 351 \VL 433 \VL 459 \VL 1243 \VL\FR \VL CDA \VL 346 \VL 350 \VL 285 \VL ~981 \VL\MR \VL VVD \VL 140 \VL 113 \VL 132 \VL ~385 \VL\MR \VL HKV/RPF/SGP \VL 348 \VL 261 \VL 158 \VL ~767 \VL\MR \VL GPV \VL 117 \VL 192 \VL 291 \VL ~600 \VL\LR \HL \stoptable \stopbuffer \typebuffer In the last column a \type{~} is used to pad numbers to the width of a four % rf: "simulate"->"pad numbers to the width of" digit number. The \type{~} has the width of a digit. \getbuffer Sometimes your tables get too big and you want to adjust, for example, the body font or the vertical and/or horizontal spacing around vertical and horizontal lines. This is done by: \shortsetup{setuptables} \startbuffer \placetable [here,force] [tab:setuptable] {Use of \type{\setuptables}.} \startcombination[1*3] {\setuptables[bodyfont=10pt] \starttable[|c|c|c|c|c|c|] \HL \VL \use6 \JustCenter{Decline of wealth in Dutch florins (Dfl)} \VL\SR \HL \VL Year \VL 1.000--2.000 \VL 2.000--3.000 \VL 3.000--5.000 \VL 5.000--10.000 \VL over 10.000 \VL\SR \HL \VL 1675 \VL 22 \VL 7 \VL 5 \VL 4 \VL 5 \VL\FR \VL 1724 \VL ~4 \VL 4 \VL -- \VL 4 \VL 3 \VL\MR \VL 1750 \VL 12 \VL 3 \VL 2 \VL 2 \VL -- \VL\MR \VL 1808 \VL ~9 \VL 2 \VL -- \VL -- \VL -- \VL\LR \HL \stoptable}{\tt bodyfont=10pt} {\setuptables[bodyfont=8pt] \starttable[|c|c|c|c|c|c|] \HL \VL \use6 \JustCenter{Decline of wealth in Dutch florins (Dfl)} \VL\SR \HL \VL Year \VL 1.000--2.000 \VL 2.000--3.000 \VL 3.000--5.000 \VL 5.000--10.000 \VL over 10.000 \VL\SR \HL \VL 1675 \VL 22 \VL 7 \VL 5 \VL 4 \VL 5 \VL\FR \VL 1724 \VL ~4 \VL 4 \VL -- \VL 4 \VL 3 \VL\MR \VL 1750 \VL 12 \VL 3 \VL 2 \VL 2 \VL -- \VL\MR \VL 1808 \VL ~9 \VL 2 \VL -- \VL -- \VL -- \VL\LR \HL \stoptable}{\tt bodyfont=8pt} {\setuptables[bodyfont=6pt,distance=small] \starttable[|c|c|c|c|c|c|] \HL \VL \use6 \JustCenter{Decline of wealth in Dutch florins (Dfl)} \VL\SR \HL \VL Year \VL 1.000--2.000 \VL 2.000--3.000 \VL 3.000--5.000 \VL 5.000--10.000 \VL over 10.000 \VL\SR \HL \VL 1675 \VL 22 \VL 7 \VL 5 \VL 4 \VL 5 \VL\FR \VL 1724 \VL ~4 \VL 4 \VL -- \VL 4 \VL 3 \VL\MR \VL 1750 \VL 12 \VL 3 \VL 2 \VL 2 \VL -- \VL\MR \VL 1808 \VL ~9 \VL 2 \VL -- \VL -- \VL -- \VL\LR \HL \stoptable}{\tt bodyfont=6pt,distance=small} \stopcombination \stopbuffer \typebuffer \getbuffer You can also set up the layout of tables with: \shortsetup{setupfloats} You can set up the numbering and the labels with: \shortsetup{setupcaptions} These commands are typed in the set up area of your input file and have a global effect on all floating blocks. \startbuffer \setupfloats[location=left] \setupcaption[style=boldslanted] \placetable{Library opening hours.} \starttable[|l|c|c|] \HL \VL \bf Day \VL \use2 \bf Opening hours \VL\SR \HL \VL Monday \VL 14.00 -- 17.30 \VL 18.30 -- 20.30 \VL\FR \VL Tuesday \VL \VL \VL\MR \VL Wednesday \VL 10.00 -- 12.00 \VL 14.00 -- 17.30 \VL\MR \VL Thursday \VL 14.00 -- 17.30 \VL 18.30 -- 20.30 \VL\MR \VL Friday \VL 14.00 -- 17.30 \VL \VL\MR \VL Saturday \VL 10.00 -- 12.30 \VL \VL\LR \HL \stoptable \stopbuffer \typebuffer \start \getbuffer \stop \chapter{Paragraph formatting} \index{columns} \Command{\tex{defineparagraphs}} \Command{\tex{setupparagraphs}} \Command{\tex{startchemical}} Sometimes you want to typeset paragraphs in a specially formatted way. This is done with: \shortsetup{defineparagraphs} \shortsetup{setupparagraphs} The example below shows how to typeset complete paragraphs in columns. \startbuffer \defineparagraphs [mypar][n=3,before={\blank},after={\blank}] \setupparagraphs [mypar][1][width=.08\textwidth,style=bold] \setupparagraphs [mypar][2][width=.4\textwidth] \startmypar 1252 \mypar Hasselt obtains its city charter from bishop Hendrik van Vianden. \mypar Hendrik van Vianden was pressed by other towns not to agree with the charter. It took Hasselt a long period of time to convince the Bishop. After supporting the Bishop in a small war against the Drents, the charter was released. \stopmypar \startmypar 1350 \mypar Hasselt joins the Hanseatic League to protect their international trade. \mypar The Hanseatic League was of great importance for merchants in Hasselt. In those days trading goods were taxed at every city, highway or rivercrossing. After joining the Hanseatic League \stopmypar \stopbuffer % rf: wrapped the above lines so they appear ok verbatim \typebuffer After defining a paragraph with \type{\defineparagraphs} you can format the paragraph with \type{\setupparagraphs}. Next you can start your paragraph with \type{\start...} and end it with \type{\stop...} A new paragraph starts with the name of your paragraph, in this case \type{\mypar}. {\switchtobodyfont[8pt]\getbuffer} Another example of paragraph formatting could look like this. \startbuffer \defineparagraphs [chempar] [n=3,before=,after=,distance=1em] \setupparagraphs [chempar] [1] [width=.12\textwidth] \setupparagraphs [chempar] [2] [width=.4\textwidth] \startchempar Lime kilns \chempar Hasselt has its own lime kilns. These were built in 1504 and produced quicklime up to 1956. Nowadays they are a tourist attraction. \chempar \chemical{CaCO_3,~,GIVES,~,CaO,~,+,~,CO_2} \stopchempar \stopbuffer \typebuffer And it would come out like this: {\switchtobodyfont[8pt]\getbuffer} By the way you could also type it in a more cryptic way: \startbuffer \chempar Lime kilns \\ Hasselt has its own lime kilns. They were built in 1504 and produced quicklime up to 1956. Nowadays they form a tourist attraction. \\ \chemical {CaCO_3,~,GIVES,~,CaO,~,+,~,CO_2} \\ \stopbuffer \typebuffer The \type{\\} are used as column separators and are essential. The chemical module is explained in another manual, because not everybody is interested in chemical stuff. However, since chemical structures always look impressive, we'll give another example. \startbuffer \placeformula[-] \startformula \startchemical [scale=small,width=fit,top=3000,bottom=3000] \chemical [SIX,SB2356,DB14,Z2346,SR3,RZ3,-SR6,+SR6, -RZ6,+RZ6] [C,N,C,C,H,H,H] \chemical [PB:Z1,ONE,Z0,DIR8,Z0,SB24,DB7,Z27,PE] [C,C,CH_3,O] \chemical [PB:Z5,ONE,Z0,DIR6,Z0,SB24,DB7,Z47,PE] [C,C,H_3C,O] \chemical[SR24,RZ24][CH_3,H_3C] \bottext{Compound A} \stopchemical \stopformula \stopbuffer \getbuffer \CONTEXT\ relies on the \PICTEX\ macros of M.J. Wichura to draw this kind of structure. Although the chemical module consists of only two or three commands, it takes some practice to get the right results. This is how the input looks: \typebuffer \chapter{Columns} \index{columns} \Command{\tex{startcolums}} \Command{\tex{setupcolumns}} \Command{\tex{column}} Simple documents can be typeset in columns. If you precede a text fragment by \type{\startcolumns} and close the text fragment by \type{\stopcolumns} everything in between will be set in columns. \shortsetup{startcolumns} \startbuffer \startcolumns[n=3,tolerance=verytolerant] Hasselt is an old Hanseatic City, situated 12~km north of Zwolle on the river Zwartewater. The city has a long history since obtaining the city charter around 1252. Part and parcel of this history can be traced back to a large number of monuments to be admired in the city centre. There you will find the St. Stephanus church, a late gothic church dating back to 1479 with a magnificent organ. The former Municipal Building is situated on The Market Place. Constituted between 1500 and 1550 it houses a large collection of weapons, amongst which one of the largest collection of black powder guns (haakhussen) in the whole world should be mentioned. Furthermore there is a corn windmill `The Swallow', dating back to 1748 as well as the `Stenendijk', a unique embankment and the last shell lime kiln in Europe still in full operation. The city center with the townmoat adorned by lime-trees, the Van Stolkspark and the hustle and bustle at the docks are ideally suited for a stroll. The area around Hasselt is also worth mentioning. In wintertime polder Mastenbroek harbours large numbers of geese. In summertime the hamlets Genne, Streukel and Celle\-mui\-den form, together with the very rare lapwing flowers (Lat. Fritillaria meleagris) found on the banks of the river Zwartewater, the ideal surroundings for walking or cycling trips. Hasselt also is a very important centre for watersports. The lakes of northwest Overijssel, the river IJssel, the Overijsselse Vecht and the Randmeren are within easy reach from the yacht harbour `De Molenwaard'. Sailing, fishing, swimming and canoeing can be fully enjoyed in Hasselt. Furthermore some events of special interest should be mentioned. Every year at the end of August Hasselt celebrates the `Eui Festival' (hay festival). \stopcolumns \stopbuffer \typebuffer The result will be a three column text. \SPQRSTOPCOLUMNS {\switchtobodyfont[9pt]\getbuffer} \SPQRSTARTCOLUMNS If possible a new column can be enforced with \type{\column}. You can set up columns with: \shortsetup{setupcolumns} \chapter{Footnotes} \index{footnote} \Command{\tex{footnote}} \Command{\tex{setupfootnotes}} If you want to annotate your text you can use \type{\footnote}. The command looks like this: \shortsetup{footnote} The bracket pair is optional and contains a logical name. The curly braces contain the text you want to display at the foot of the page. The same footnote number can be called with its logical name. \shortsetup{note} If your text goes like this: \startbuffer The Hanse was a late medieval commercial alliance of towns in the regions of the North and the Baltic Sea. The association was formed for the furtherance and protection of the commerce of its members.\footnote[war]{This was the source of jealousy and fear among other towns that caused a number of wars.} In the Hanse period there was a lively trade in all sorts of articles such as wood, wool, metal, cloth, salt, wine and beer.\note[war] The prosperous trade caused an enormous growth of welfare in the Hanseatic towns.\footnote{Hasselt is one of these towns.} \stopbuffer \typebuffer It would look like this: \getbuffer The footnote numbering is done automatically. The command \type{\setupfootnotes} enables you to influence the display of footnotes: \shortsetup{setupfootnotes} \chapter{Definitions} \index{definition} \Command{\tex{definedescription}} \Command{\tex{setupdescriptions}} If you want to display notions, concepts and ideas in a consistent manner you can use: \shortsetup{definedescription} For example: \startbuffer \definedescription [concept] [location=serried,headstyle=bold,width=broad] \concept{Hasselter juffer} A sort of biscuit made of puff pastry and covered with sugar. It tastes very sweet. \par \stopbuffer \typebuffer It would look like this: \getbuffer But you can also choose other layouts: \startbuffer \definedescription [concept] [location=top, headstyle=bold, width=broad, style=slanted] \concept{Hasselter bitter} A very strong alcoholic drink (up to 40\%) mixed with herbs to give it a special taste. It is sold in a stone flask and it should be served {\em ijskoud} (as cold as ice). \par \definedescription [concept] [location=inmargin,headstyle=bold,width=broad] \concept{Euifeest} A harvest home to celebrate the end of a period of hard work. The festivities take place in the third week of August. \par \stopbuffer \SPQRSTOPCOLUMNS \start \hbox to \hsize{\hfill\vbox{\hsize120mm\getbuffer}\hfill} \stop \SPQRSTARTCOLUMNS If you have more than one paragraph in such a definition you can use a \type{\start...}||\type{\stop...} pair. \startbuffer \definedescription [concept] [location=right, headstyle=bold, width=broad] \startconcept{Euifeest} A harvest home to celebrate the end of a period of hard work. This event takes place at the end of August and lasts one week. The city is completely illuminated and the streets are decorated. This feast week ends with a {\em Braderie}. \stopconcept \stopbuffer \typebuffer This would become: \getbuffer Layout is set up within the second bracket pair of\crlf \type{\definedescription[][]}. But you can also use: \shortsetup{setupdescriptions} \chapter{Numbered definitions} \index{numbered definition} \Command{\tex{defineenumeration}} \Command{\tex{setupenumerations}} With \type{\defineenumeration} you can number text elements like remarks or questions. If you want to make numbered remarks in your document you use: \shortsetup{defineenumeration} For example: \startbuffer[a] \defineenumeration [remark] [location=top, text=Remark, inbetween=\blank, after=\blank] \stopbuffer \typebuffer[a] Now the commands \type{\remark}, \type{\subremark}, \type{\resetremark} and \type{\nextremark} are available and you can type remarks like this: \startbuffer[b] \remark In the early medieval times Hasselt was a place of pilgrimage. The {\em Heilige Stede} (Holy Place) was torn down during the Reformation. In 1930, after 300 years the {\em Heilige Stede} was reopened. \subremark Nowadays the {\em Heilige Stede} is closed again but once a year an open air service is held at the same spot. \stopbuffer % rf: at the same (rather than on the same) last line \typebuffer[b] \start \getbuffer[a]\getbuffer[b] \par \stop You can reset numbering with \type{\resetremark} or\crlf \type{\resetsubremark}, or increment a number with \type{\nextremark} or \type{\nextsubremark}. This is normally done automatically per chapter, section or whatever. % rf: `of'->`or' (twice), and add a comma You can set up the layout of \type{\defineenumeration} with: \shortsetup{setupenumerations} You can also vary the layout of {\bf Remark} and {\bf Subremark} in the example above by: \starttyping \setupenumeration[remark][headstyle=bold] \setupenumeration[subremark][headstyle=slanted] \stoptyping If a number becomes obsolete you can type: \starttyping \remark[-] \stoptyping If the remark contains more than one paragraph you will have to use the command pair \type{\startremark} $\cdots$ \type{\stopremark} that becomes available after defining {\bf Remark} with \type{\defineenumeration[remark]}. So the example above would look like this: \startbuffer[c] \startremark In the early medieval times Hasselt was a place of pilgrimage. The {\em Heilige Stede} (Holy Place) was torn down during the Reformation. After 300 years in 1930 the {\em Heilige Stede} was reopened. Nowadays the {\em Heilige Stede} is closed again but once a year an open air service is held at the same spot. \stopremark \stopbuffer \typebuffer[c] \start \getbuffer[a]\getbuffer[c] \par \stop \chapter{Outlined text} \index{outline+text} \Command{\tex{framed}} \Command{\tex{setupframed}} \Command{\tex{inframed}} You can \inframed{outline} a text with \type{\framed}. The command looks like this: \shortsetup{framed} The bracket pair is optional and contains the set up parameters. The curly braces enclose the text. To be honest, the outlined text in the last paragraph was done with \type{\inframed}. This command takes care of the interline spacing. \startbuffer \framed [height=3em,width=fit] {This box is bigger} \stopbuffer \typebuffer This becomes: \startbaselinecorrection \getbuffer \stopbaselinecorrection Some other examples of \type{\framed} and its set up parameters are shown below. This time we use the in||line alternative \type{\inframed}. \startbuffer \leftaligned {\inframed [width=fit] {People in Hasselt}} \midaligned {\inframed [height=1.5cm,frame=off] {have a}} \rightaligned {\inframed [background=screen] {historic background}} \stopbuffer \typebuffer This leads to: \getbuffer The \type{\framed} command is very sophisticated and it is used in many macros. The command to set up frames is: \shortsetup{setupframed} \chapter{Outlined paragraphs} \index{outline+paragraph} \Command{\tex{startframedtext}} \Command{\tex{setupframedtext}} Complete paragraphs can be outlined with: \shortsetup{startframedtext} \startbuffer \definefloat[intermezzo] \placeintermezzo [here][block:bridge]{An intermezzo.} \startframedtext[width=.8\makeupwidth] It was essential for Hasselt to have a bridge across the river Zwarte Water. The bishop of Utrecht gave Hasselt his consent in 1486. \blank Other cities in the neighbourhood of Hasselt were afraid of the toll money to be paid when crossing this bridge so they prevented the construction. \stopframedtext \stopbuffer \typebuffer This example also illustrates the command \type{\definefloat}. You can find more information on this command in \in{paragraph}[textblocks]. The \type{\blank} is necessary to enforce a blank line. \getbuffer The outlining can be set up with: \shortsetup{setupframedtexts} \chapter{Margin texts} \index{margin text} \Command{\tex{inmargin}} \Command{\tex{inleft}} \Command{\tex{inright}} \Command{\tex{margintitle}} It is very easy to put text in the margin. You just use \type{\inmargin}. \shortsetup{inmargin} You may remember one of the earlier examples: \typebuffer[marginpicture] This would result in a figure in the \pagereference [marginpicture]\getbuffer [marginpicture]margin. You can imagine that it looks quite nice in some documents. But be careful. The margin is rather small so the figure could become very marginal. A few other examples are shown in the text below. \startbuffer The Ridderstraat (Street of knights \inmarge{Street of\\Knights} is an obvious name. In the 14th and 15th centuries, nobles and prominent citizens lived in this street. Some of their big houses were later turned into poorhouses \inright{poorhouse}and old people's homes. Up until \inleft[low]{\tfc 1940}1940 there was a synagogue in the Ridderstraat. Some 40 Jews gathered there to celebrate their sabbath. During the war all Jews were deported to Westerbork and then to the extermination camps in Germany and Poland. None of the Jewish families returned. The synagogue was knocked down in 1958. \stopbuffer \typebuffer The commands \type{\inmargin}, \type{\inleft} and \type{\inright} all have the same function. In a two sided document \type{\inmargin} puts the margin text in the correct margin. The \type{\\} is used for line breaking. The example above would look like this: \SPQRSTOPCOLUMNS \hbox to \hsize{\hfill\vbox{\hsize=130mm\getbuffer}\hfill} \SPQRSTARTCOLUMNS You can set up the margin text with: \starttyping \setupinmargin \stoptyping \chapter{Page breaking and page numbering} \index{page breaking} \index{page numbering} \Command{\tex{page}} \Command{\tex{setuppagenumbering}} \Command{\tex{startpostponing}} A page can be enforced or blocked by: \shortsetup{page} The options can be stated within the brackets. The options and their meaning are presented in \in{table}[tab:page options] \placetable [] [tab:page options] {Page options.} \starttable[|l|l|] \HL \NC \bf Option \NC \bf Meaning \NC\SR \HL \NC \type{yes} \NC enforce a page \NC\FR \NC \type{makeup} \NC enforce a page without filling \NC\MR \NC \type{no} \NC no page \NC\MR \NC \type{preference} \NC prefer a new page here \NC\MR \NC \type{bigpreference} \NC great preference for a new page here \NC\MR \NC \type{left} \NC next page is a left handside page \NC\MR \NC \type{right} \NC next page is a right handside page \NC\MR \NC \type{disable} \NC following commands have no effect \NC\MR \NC \type{reset} \NC following commands do have effect \NC\MR \NC \type{empty} \NC insert an empty page \NC\MR \NC \type{last} \NC add pages till even number is reached \NC\MR \NC \type{quadruple} \NC add pages till a multiple of four is reached \NC\LR \HL \stoptable Page numbering happens automatically but you can enforce a page number with: \starttyping \page[25] \stoptyping Sometimes it is better to state a relative page number like \type{[+2]} or \type{[-2]}. The position of the page numbers on a page depend on your own preferences and if it concerns a one sided or double sided document. Page numbering can be set up with: \shortsetup{setuppagenumbering} The preferences are placed within the brackets. Tables or figures may take up a lot of space. The placing of these text elements can be postponed till the next page break. This is done with: \shortsetup{startpostponing} \startbuffer \startpostponing \placefigure {A postponed figure.} {\externalfigure[hass16g][width=\textwidth]} \stoppostponing \stopbuffer \typebuffer The figure will be placed at the top of the next page and will cause minimal disruption of the running text. \getbuffer \chapter{Page headers and footers} \index{page header} \index{pagefooter} \Command{\tex{setupfootertexts}} \Command{\tex{setupheadertexts}} \Command{\tex{setupheader}} \Command{\tex{setupfooter}} \Command{\tex{noheaderandfooterlines}} In some cases you want to give your page a page header and footer. The commands to do this are: \shortsetup{setupfootertexts} \shortsetup{setupheadertexts} The first bracket pair is used for the location of the footer or header (\type{text}, \type{edge} etc). Footer and header are placed within the second and third bracket pairs. In a double sided document the fourth and fifth bracket pairs are used for footer and header on the left-hand side page and the right-hand page. In most cases you can omit the last two bracket pairs. \startbuffer \setupfootertexts[Manual][section] \stopbuffer \typebuffer In this case the text {\em Manual} will appear in the left-hand side corner and the title of the actual section on the right-hand side of the page. This footer will change with the beginning of a new section. You can set up the head- and footline with: \shortsetup{setupheader} \shortsetup{setupfooter} If you want to leave out the page header and footer you can type: \starttyping \noheaderandfooterlines \stoptyping \chapter{Table of contents (lists)} \index{table of contents} \index{list} \Command{\tex{completecontents}} \Command{\tex{placecontents}} \Command{\tex{definelist}} \Command{\tex{setuplist}} \Command{\tex{writetolist}} \Command{\tex{writebetweenlist}} \Command{\tex{definecombinedlist}} \Command{\tex{setupcombinedlist}} A table of contents contains chapter numbers, chapter titles and page numbers and can be extended with sections, sub sections, etc. A table of contents is generated automatically by typing: \starttyping \placecontents \stoptyping Which table of contents is produced depends on the location of this command in your document. At the start of the document it will generate a list of chapters, sections etc. But at the top of a chapter: \startbuffer \chapter{Hasselt in Summer} \placecontents \section{Hasselt in July} \section{Hasselt in August} \stopbuffer \typebuffer it will only produce a list of (sub) section titles with the corresponding section numbers and page numbers. The command \type{\placecontents} is available after definition with: \shortsetup{definecombinedlist} This command and \type{\definelist} allows you to define your own lists necessary for structuring your documents. The use of this command and its related commands is illustrated for the table of contents. \startbuffer \definelist[chapter] \setuplist [chapter] [before=\blank, after=\blank, style=bold] \definelist[section] \setuplist [section] [alternative=d] \stopbuffer \typebuffer Now there are two lists of chapters and sections and these will be combined in a table of contents with the command \type{\definecombinedlist}. \startbuffer \definecombinedlist [contents] [chapter,section] [level=subsection] \stopbuffer \typebuffer Now two commands are available: \type{\placecontents} and \type{\completecontents}. With the second command the title of the table of contents will be added to the table of contents itself. The layout of lists can be varied with the parameter \type{alternative}. \placetable [here,force] [tab:alternatives] {Alternatives for displaying lists.} \starttable[|c|l|] \HL \NC \bf Alternative \NC \bf Display \NC\SR \HL \NC \type{a} \NC number -- title -- page number \NC\FR \NC \type{b} \NC number -- title -- spaces -- page number \NC\MR \NC \type{c} \NC number -- title -- dots -- page number \NC\MR \NC \type{d} \NC number -- title -- page number (continuing) \NC\MR \NC \type{e}||\type{g} \NC some simple interactive ones \NC\LR \HL \stoptable Lists are set up with: \shortsetup{setuplist} \shortsetup{setupcombinedlist} If you want to change the layout of the generated table of contents you'll have to remember that it is a list. \startbuffer \setupcombinedlist [content] [alternative=c, aligntitle=no, width=2.5cm] \stopbuffer \typebuffer This will result in a somewhat different layout than the default one. Lists are called up and placed with: \shortsetup{placelist} So if you want a table of contents you type: \starttyping \placecontents[level=section] \stoptyping or \starttyping \completecontents[level=section] \stoptyping only the sections will be displayed. You might need this option when you have a well structured document that has sub sub sub sub sub sections and you don't want those in the table of contents. A long list or a long table of contents will use up more than one page. To be able to force page breaking you can type: \starttyping \completecontents[2.2,8.5,12.3.3] \stoptyping A page break will occur after section 2.2 and 8.5 and sub section~12.3.3. In some cases you want to be able to write your own text in an automatically generated list. This is done with \shortsetup{writetolist} \shortsetup{writebetweenlist} For example if you want to make a remark in your table of contents after a section titled {\em Hotels in Hasselt} you can type: \startbuffer \section{Hotels in Hasselt} \writebetweenlist[section]{\blank} \writetolist[section] {---under construction---} \writebetweenlist[section]{\blank} \stopbuffer \typebuffer \chapter{Registers} \index{register} \Command{\tex{index}} \Command{\tex{placeindex}} \Command{\tex{completeindex}} \Command{\tex{defineregister}} \Command{\tex{placeregister}} \Command{\tex{completeregister}} \Command{\tex{setupregister}} It is possible to generate one or more registers. By default the command \type{\index} is available. If you want to add a word to the index you type: \starttyping \index{town hall} \stoptyping The word {\em town hall} will appear as an index entry; the index is sorted into alphabetical order by an auxilliary program. Sometimes the index word does not appear in normal alphabetic order. For example, entries such as symbols have to provide extra sorting information in order to produce a correct alphabetical list: \starttyping \index[minus]{$-$} \stoptyping Sometimes you have sub- or sub sub entries. These can be defined as follows: \starttyping \index{town hall+location} \index{town hall+architecture} \stoptyping You can generate your indexlist with: \starttyping \placeindex \stoptyping or \starttyping \completeindex \stoptyping The command \type{\index} is a predefined \CONTEXT\ command, but of course you can also define your own registers. \shortsetup{defineregister} For example if you want to make a new register based on the streets in Hasselt you could type: \starttyping \defineregister[street][streets] \stoptyping Now a new register command \type{\street} is available. An new index entry could be \type{\street{Ridderstraat}}. To produce a list of entries you could now use: \starttyping \placestreets \completestreets \stoptyping You can alter the display of the registers with: \shortsetup{setupregister} \chapter[synonyms]{Synonyms} \index{synonyms} \Command{\tex{definesynonyms}} \Command{\tex{setupsynonyms}} \Command{\tex{abbreviation}} \Command{\tex{infull}} \Command{\tex{unit}} \Command{\tex{loadabbreviations}} \Command{\tex{placelistofabbreviations}} \Command{\tex{completelistofabbreviations}} In many documents people want to use specific words consistently throughout the document. To enforce consistency the command below is available. \shortsetup{definesynonyms} The first bracket pair contains the singular form of the synonym, and the second contains the plural form. The third bracket pair contains a command. For example the command \type{\abbreviation} is defined by: \starttyping \definesynonyms [abbreviation] [abbreviations] [\infull] \setupsynonyms [style=capital] \stoptyping Now the command \type{\abbreviation} is available and can be used to state your abbreviations: \starttyping \abbreviation {ANWB} {Dutch Automobile Association} \abbreviation {VVV} {Bureau of Tourist Information} \abbreviation {NS} {Dutch Railways} \stoptyping \abbreviation{VVV}{Bureau of Tourist Information} Now, if you type: \startbuffer The Dutch \VVV\ (\infull{VVV}) can provide you with tourist information about Hasselt. \stopbuffer \typebuffer You would obtain something like this: \getbuffer The list of synonyms or abbreviations is best defined in the set up area of your input file for maintenance purposes. You can also store this kind of information in an external file, and load the file (e.g. \type{abbrev.tex}) with: \starttyping \input abbrev.tex \stoptyping If you want to put a list of the abbreviations used in your document you can type: \starttyping \placelistofabbreviations \stoptyping or \starttyping \completelistofabbreviations \stoptyping A complete and sorted list with abbreviations and their meaning is produced. The typesetting of synonynms can be influenced with: \starttyping \setupsynonyms \stoptyping Look at \in{chapter}[units] for another application of synonyms. \chapter{Referring to text elements} \index{referring} \index{label} \Command{\tex{in}} \Command{\tex{at}} \Command{\tex{pagereference}} For referring to one location in a document from another you can use the command: \shortsetup{in} The curly braces contain text, the brackets contain a logical label. If you have written a chapter header like this: \starttyping \chapter[hotel]{Hotels in Hasselt} \stoptyping then you can refer to this chapter with: \starttyping \in{chapter}[hotel] \stoptyping After processing the chapter number is available and the reference could look something like: {\em chapter 23}. You can use \type{\in} for any references to text elements like chapters, sections, figures, tables, formulae etc. Another example: \startbuffer There are a number of things you can do in Hasselt: \startitemize[n,packed] \item swimming \item sailing \item[hiking] hiking \item biking \stopitemize Activities like \in{activity}[hiking] described on \at{page}[hiking] are very tiring. \stopbuffer \typebuffer This would look like this: \getbuffer As you can see, it is also possible to refer to pages. This is done with: \shortsetup{at} For example with: \starttyping \at{page}[hiking] \stoptyping This command can be used in combination with: \shortsetup{pagereference} and \shortsetup{textreference} If you want to refer to the chapter {\em Hotels in Hasselt} you could type: \startbuffer Look in \in{chapter}[hotel] on \at{page}[hotel] for a complete overview of accomodation in \pagereference[accomodation]Hasselt. \stopbuffer \typebuffer A chapter number and a page number will be generated when processing the input file. At another point in the document you can refer to \type{accomodation} with \type{\at{page}[accomodation]}. You can also define a set of labels separated by commas. \startbuffer \placefigure [here] [fig:canals,fig:boats] {A characteristic picture of Hasselt.} {\externalfigure[hass08g][width=5cm]} There are many canals in Hasselt (see \in{figure}[fig:canals]). . . . Boats can be moored in the canals of Hasselt (see \in{figure}[fig:boats]). \stopbuffer \typebuffer This might look like this: \getbuffer \chapter{Colour} \index{colour} \Command{\tex{setupcolors}} \Command{\tex{color}} \Command{\tex{definecolor}} Text can be set in colour. \shortsetup{setupcolor} The use of colours has to be activated by: \starttyping \setupcolor[state=start] \stoptyping Now the basic colours are available (red, green and blue). \startbuffer \startcolor[red] Hasselt is a very \color[green]{colourful} town. \stopcolor \stopbuffer \typebuffer \getbuffer On a black and white printer you will see only grey shades. In an electronic document these colours will be as expected. You can define your own colours with: \shortsetup{definecolor} For example: \startbuffer \definecolor[darkred] [r=.5,g=.0,b=.0] \definecolor[darkgreen] [r=.0,g=.5,b=.0] \stopbuffer \typebuffer Now the colours \type{darkred} and \type{darkgreen} are available. \chapter{Background text} \index{background+text} \Command{\tex{setupbackground}} \Command{\tex{startbackground}} To emphasize a section you can use backgrounds. A background is set with the command pair: \shortsetup{startbackground} An example can illustrate the use: \startbuffer \setupbackground [background=screen,corner=round] \startbackground Hasselt has produced a few well known people. Only recently it turned out that Kilian van Rensselaer played a prominent role in the foundation of the State of New York. \stopbackground \stopbuffer \typebuffer This would be displayed as: \getbuffer Backgrounds can span multiple pages. With: \shortsetup{setupbackground} you can vary the display of the backgrounds. \chapter{Page backgrounds} \index{page areas} \index{background+page areas} \Command{\tex{setupbackgrounds}} The page background can also be set, with: \shortsetup{setupbackgrounds} The first two bracket pairs are used to define the page areas. The last bracket pair is used for set up. \startbuffer \hbox {\framed[width=1.5cm,frame=off] {} \framed[width=2cm,frame=off] {left} \framed[width=2.5cm,frame=off] {left} \framed[width=3cm,frame=off] {text} \framed[width=2.5cm,frame=off] {right} \framed[width=2cm,frame=off] {right}} \hbox {\framed[width=1.5cm,frame=off] {} \framed[width=2cm,frame=off] {edge} \framed[width=2.5cm,frame=off] {margin} \framed[width=3cm,frame=off] {} \framed[width=2.5cm,frame=off] {margin} \framed[width=2cm,frame=off] {edge}} \hbox {\framed[width=1.5cm,frame=off] {top} \framed[width=2cm] {} \framed[width=2.5cm] {} \framed[width=3cm] {} \framed[width=2.5cm] {} \framed[width=2cm] {}} \hbox {\framed[width=1.5cm,frame=off] {header} \framed[width=2cm] {} \framed[width=2.5cm,background=screen] {} \framed[width=3cm,background=screen] {} \framed[width=2.5cm,background=screen] {} \framed[width=2cm] {}} \hbox {\framed[width=1.5cm,frame=off,height=3cm] {text} \framed[width=2cm,height=3cm] {} \framed[width=2.5cm,height=3cm,background=screen]{} \framed[width=3cm,height=3cm,background=screen] {} \framed[width=2.5cm,height=3cm,background=screen]{} \framed[width=2cm,height=3cm] {}} \hbox {\framed[width=1.5cm,frame=off] {footer} \framed[width=2cm] {} \framed[width=2.5cm,background=screen] {} \framed[width=3cm,background=screen] {} \framed[width=2.5cm,background=screen] {} \framed[width=2cm] {}} \hbox {\framed[width=1.5cm,frame=off] {bottom} \framed[width=2cm] {} \framed[width=2.5cm] {} \framed[width=3cm] {} \framed[width=2.5cm] {} \framed[width=2cm] {}} \stopbuffer \placefigure [here] [fig:pageareas] {The page areas defined in \type{\setupbackgrounds}.} {\tt\getbuffer} If you want to have backgrounds in the grey areas of the page layout of \in{figure}[fig:pageareas] you type: \startbuffer \setupbackgrounds [header,text,footer] [leftmargin,text,rightmargin] [background=screen] \stopbuffer \typebuffer \chapter{Alignment} \index{alignment} \Command{\tex{setupalign}} \Command{\tex{setup tolerance}} \Command{\tex{rightaligned}} \Command{\tex{leftlines}} \Command{\tex{midaligned}} Horizontal and vertical alignment can be set up with: \shortsetup{setupalign} Single lines can be aligned with: \starttyping \rightaligned{} \leftaligned{} \midaligned{} \stoptyping \startbuffer \leftaligned {Hasselt was built on a sandhill.} \midaligned {Hasselt was built on the crossing of two rivers.} \rightaligned {Hasselt's name stems from hazelwood.} \stopbuffer \typebuffer After processing this would look like: \getbuffer Alignment of section is done with: \shortsetup{startalignment} In case of alignment you can specify a tolerance and the direction (vertical or horizontal). Normally the tolerance is \type{verystrict}. In colums you could specify \type{verytolerant}. The tolerance in this manual is: \starttyping \setuptolerance[horizontal,verystrict] \stoptyping \chapter{Interactive mode in electronic documents} \section{Introduction} \index[reader]{\READER} \index[exchange]{\EXCHANGE} \index[distiller]{\DISTILLER} %Nowadays documents can be made electronically available for %consulting on a computer and displaying on a computer screen. Electronic documents can be displayed interactively on a computer screen; interaction means that you can click on `active' areas and jump to the indicated areas (hyper linking). For example if you consult an index you can click on a (active) page number and you will jump to the corresponding page. Interaction relates to: \startitemize[packed] \item active chapter numbers in table of content \item active page numbers in indexes \item active page numbers, chapter numbers and figure numbers in internal references to pages, chapters, figures etc. \item active titles, page numbers, and chapter numbers in external references to other interactive documents \item active menus as navigation tools \stopitemize The extent of interaction depends on the program you use to view the document. We assume that you will use \PDFTEX\ to produce a \PDF\ document directly or use \DISTILLER\ to convert a \POSTSCRIPT\ file into a \PDF\ one. You will then use \READER, \EXCHANGE, or \GHOSTVIEW\ for viewing. \CONTEXT\ is a very powerful system for producing electronic or interactive \PDF\ documents. However, only a few standard features are described in this chapter. The authors of this manual are planning to make all \CONTEXT\ related manuals available electronically, together with their sources. Examining these sources will allow the reader to become more acquainted with the possibilities of \CONTEXT. \section{Interactive mode} \index{interactive mode} \Command{\tex{setupinteraction}} The interactive mode is activated by: \shortsetup{setupinteraction} For example: \startbuffer \setupinteraction [state=start, color=green, style=bold] \stopbuffer \typebuffer The hyper links are now generated automatically and the active words are displayed in bold green. The interactive document is considerably bigger (in Megabytes) than its paper cousin because hyperlinks consume space. You %%this makes no kind of sense: how can you compare electrons %%and paper. clearly the electrons are much smaller! the english %%is so unweildy to express what he means. will also notice that processing time becomes longer. Therefore it is advisable to de-activate the interactive mode while your document is under construction. \section{Interaction within a document} \index{interaction+internal} \Command{\tex{in}} \Command{\tex{at}} \Command{\tex{goto}} Earlier you have seen how to make a reference with \type{\in} and \type{\at}. You may have wondered why you had to type \type{\in{chapter}[chap:introduction]}. Firstly {\em chapter} and its corresponding chapter number will not be separated at line breaking: secondly the word {\em chapter} and its number are typeset differently in the interactive mode. This gives the user a larger clickable area. In interactive mode there is one other command that has little meaning in the paper variant. \shortsetup{goto} The curly braces contain text, the brackets contain a reference (logical name, location). \startbuffer In \goto{Hasselt}[fig:cityplan] all streets are built in a circular way. \stopbuffer \typebuffer In the interactive document {\em Hasselt} will be green and active. You will jump to a map of Hasselt. \section{Interaction between \\ documents} \index{interaction+external} \Command{\tex{from}} \Command{\tex{useexternaldocument}} It is possible to link one document to another. First you have to state that you want to refer to another document. This is done by: \shortsetup{useexternaldocument} The first bracket pair must contain a logical name of the document, the second pair the file name of the other document and the third pair is used for the title of the document. For referring to these other documents you can use: \shortsetup{from} The curly braces contain text and the brackets contain the reference. Look at the example below. \startbuffer \useexternaldocument[hia][hasbook][Hasselt in August] Most tourist attractions are described in \from[hia]. A description of the Eui||feest is found in \from[hia::euifeest]. A description of the \goto{Eui||feest}[hia::euifeest] is found in \from[hia]. The eui||feest is described on \at{page}[hia::euifeest] in \from[hia]. See for more information \in{chapter}[hia::euifeest] in \from[hia]. \stopbuffer \typebuffer The \type{\useexternaldocument} is usually typed in the set up area of your input file. After processing your input file (at least two times to get the references right), and the file \type{hasbook.tex}, you will have two \PDF\ documents. The references above have the following meaning: \startitemize[packed] \item \type{\from[hia]} will produce the active title you gave in the third bracket pair of \type{\useexternaldocument} and is linked to the first page of \type{hasbook.pdf} \item \type{\from[hia::euifeest]} will produce an active title and is linked to the page where chapter Eui||feest begins \item \type{\goto{Eui||feest}[hia::euifeest]} will produce an active word {\em Eui||feest} and is linked to the page where chapter Eui||feest begins \item \type{\at{page}[hia::euifeest]} will produce an active word {\em page} and page number and is linked to that page \item \type{\in{chapter}[hia::euifeest]} will produce on active word {\em chapter} and chapter number and is linked to that chapter \stopitemize The \type{::} separates the (logical) file name and the destination in that file. \section{Menus} You can define navigation tools with: \shortsetup{defineinteractionmenu} The first bracket pair is used for a logical name that can be used to recall the menu. The second pair contains the location on the screen. The third pair is used for setting up the menu. A typical menu definition might look like this: \startbuffer \setupcolors [state=start] \setupinteraction [state=start, menu=on] \defineinteractionmenu [mymenu] [right] [state=start, align=middle, background=screen, frame=on, width=\marginwidth, style=smallbold, color=] \setupinteractionmenu [mymenu] [{Content[content]}, {Index[index]}, {\vfill}, {Stop[ExitViewer]}] \stopbuffer \typebuffer This will produce a menu on the right hand side of every screen. The menu buttons contain the text {\em Content}, {\em Index} and {\em Stop} with respectively the following functions: jump to the table of contents, jump to the index and leave the viewer. The labels to obvious destinations like \type{content} and \type{index} are predefined. Other predefined destinations are \type{FirstPage}, \type{LastPage}, \type{NextPage} and \type{PreviousPage}. An action like \type{ExitViewer} is necessary to make an electronic document self containing. Other predefined actions you can use are \type{PrintDocument}, \type{SearchDocument} and \type{PreviousJump}. The meaning of these actions is self-evident. Menus are set up with: \shortsetup{setupinteractionmenu} \chapter{Fonts and font switches} \section{Introduction} \index{Computer Modern Roman} \index{Lucida Bright} \index{AMS} \index{\cap{PS}--fonts} The default font in \CONTEXT\ is the {\em Computer Modern Roman} (\type{cmr}). You can also use Lucida Bright (\type{lbr}) as a full alternative and symbols of the {\em American Mathematical Society} (\type{ams}). Standard PostScript fonts (\type{pos}) are also available. \section{Fontstyle and size} \index{font+style} \index{font+size} \Command{\tex{setupbodyfont}} \Command{\tex{switchtobodyfont}} You select the font family, style and size for a document with: \shortsetup{setupbodyfont} If you typed \type{\setupbodyfont[sansserif,9pt]} {\switchtobodyfont[ss,9pt] in the setup area of the input file your text would look something like this.} For changes in mid-document and on section level you should use: \shortsetup{switchtobodyfont} \startbuffer On November 10th (one day before Saint Martensday) the youth of Hasselt go from door to door to sing a special song and they accompany themselves with a {\em foekepot}. And they won't go away until you give them some money or sweets. The song goes like this: \startnarrower \switchtobodyfont[small] \startlines Foekepotterij, foekepotterij, Geef mij een centje dan ga'k voorbij. Geef mij een alfje dan blijf ik staan, 'k Zak nog liever naar m'n arrenmoeder gaan. Hier woont zo'n rieke man, die zo vulle gŠven kan. GŠf wat, old wat, gŠf die arme stumpers wat, 'k Eb zo lange met de foekepot elopen. 'k Eb gien geld om brood te kopen. Foekepotterij, foekepotterij, Geef mij een centje dan ga'k voorbij. \stoplines \stopnarrower \stopbuffer \typebuffer Notice that \type{\startnarrower} $\cdots$ \type{\stopnarrower} is also used as a begin and end of the fontswitch. The function of \type{\startlines} and \type{\stoplines} in this example is obvious. \start \getbuffer \stop \SPQRSTOPCOLUMNS If you want an overview of the available font family you can type: \startbuffer \showbodyfont[cmr] \stopbuffer \typebuffer \getbuffer \SPQRSTARTCOLUMNS \section{Style and size switch in commands} In a number of commands one of the parameters is \type{character} to indicate the desired typestyle. For example: \startbuffer \setuphead[chapter][style=\tfd] \stopbuffer \typebuffer In this case the character size for chapters is indicated with a command \type{\tfd}. But instead of a command you could use the predefined options that are related to the actual typeface: \startbuffer normal bold slanted boldslanted type mediaeval small smallbold smallslanted smallboldslanted smalltype capital cap \stopbuffer \typebuffer \section{Local font style and size} \Command{\tex{rm}} \Command{\tex{ss}} \Command{\tex{tt}} \Command{\tex{sl}} \Command{\tex{bf}} \Command{\tex{tfa}} \Command{\tex{tfb}} \Command{\tex{tfc}} \Command{\tex{tfd}} In the running text (local) you can change the {\em typestyle} into roman, sans serif and typewriter with \type{\rm}, \type{\ss} and \type{\tt}. You can change the {\em typeface} like italic and boldface with \type{\sl} and \type{\bf}. The {\em typesize} is available from 4pt to 12pt and is changed with \type{\switchtobodyfont}. The actual style is indicated with \type{\tf}. If you want to change into a somewhat greater size you can type \type{\tfa}, \type{\tfb}, \type{\tfc} and \type{\tfd}. An addition of \type{a}, \type{b}, \type{c} and \type{d} to \type{\sl}, \type{\it} and \type{\bf} is also allowed. \startbuffer {\tfc Mintage} In the period from {\tt 1404} till {\tt 1585} Hasselt had its own {\sl right of coinage}. This right was challenged by other cities, but the {\switchtobodyfont[7pt] bishops of Utrecht} did not honour these {\slb protests}. \stopbuffer \typebuffer The curly braces indicate begin and end of style or size switches. \blank[small] \getbuffer \section{Redefining fontsize} \index{fontsize} \Command{\tex{definebodyfont}} For special purposes you can define your own fontsize. \shortsetup{definebodyfont} A definition could look like this: \startbuffer \definebodyfont[10pt][rm][tfe=hlhb7t at 36pt] {\tfe Hasselt!} \stopbuffer \typebuffer Now \type{\tfe} will produce 36pt characters saying: {\hbox{\getbuffer}} \section{Small caps} \index{small caps} \Command{\tex{cap}} Abbreviations like \PDF\ %(\infull{PDF}) are printed in pseudo small caps. A small capital is somewhat smaller than the capital of the actual typeface. Pseudo small caps are produced with: \shortsetup{capital} If you compare \type{PDF}, \type{\cap{PDF}} and \type{\sc PDF }: \midaligned{PDF and \cap{PDF} and \sc{PDF}} \noindenting you can see the difference. The command \type{\sc} shows the real small caps. The reason for using pseudo small caps instead of real small caps is just a matter of taste. %ugh %not if you talk to a typographer! \section{Emphasized} \index{emphasized} \Command{\tex{em}} To emphasize words consistently throughout your document you use: \starttyping \em \stoptyping Empasized words appear in a slanted style. \startbuffer If you walk through Hasselt you should {\bf \em watch out} for {\em Amsterdammers}. An {\em Amsterdammer} is {\bf \em not} a person from Amsterdam but a little stone pillar used to separate sidewalk and road. A pedestrian should be protected by these {\em Amsterdammers} against cars but more often people get hurt from tripping over them. \stopbuffer \typebuffer \getbuffer {\em An emphasize within an emphasize is {\em normal} again and a boldface emphasize looks like {\bf this or \em this}}. \section{Typewriter text / verbatim} \index{type} \index{verbatim} \Command{\tex{starttyping}} \Command{\tex{type}} \Command{\tex{setuptyping}} \Command{\tex{setuptype}} If you want to display typed text and want to keep your line breaking exactly as it is you use \shortsetup{starttyping} In the text you can use: \shortsetup{type} \noindenting The curly braces enclose the text you want in teletype. You have to be careful with \type{\type} because the line breaking mechanism does not work anymore. You can set up the `typing' with: \shortsetup{setuptyping} \shortsetup{setuptype} \chapter{Composite characters} \section{Introduction} In \in{chapter}[special chars] you have already seen that you have to type more than one token to obtain special characters like \# \$ \% \& \_ $\{$ and $\}$. Accented characters or foreign symbols have to be composed to produce the right typesetted character. It is not within the scope of this manual to go into accented characters in math mode. See the {\TEX Book by Donald E. Knuth} on that subject. \section{Accents} \index{accents} Accented characters have to be composed in \CONTEXT. \in{Table}[tab:accents] shows you how to do this. The character {\em u} is just an example here. \let\MySign=\= \placetable [here,force] [tab:accents] {Accents.} \starttable[|c|c|c|c|] \HL \NC \bf You type \NC \bf You get \VL \bf You type \NC \bf You get \NC\SR \HL \NC \type{\`{u}} \NC \`{u} \VL \type{\u{u}} \NC \u{u} \NC\FR \NC \type{\'{u}} \NC \'{u} \VL \type{\v{u}} \NC \v{u} \NC\MR \NC \type{\^{u}} \NC \^{u} \VL \type{\H{u}} \NC \H{u} \NC\MR \NC \type{\"{u}} \NC \"{u} \VL \type{\t{uu}} \NC \t{uu} \NC\MR \NC \type{\~{u}} \NC \~{u} \VL \type{\c{u}} \NC \c{u} \NC\MR \NC \type{\={u}} \NC \MySign{u} \VL \type{\d{u}} \NC \d{u} \NC\MR \NC \type{\.{u}} \NC \.{u} \VL \type{\b{u}} \NC \b{u} \NC\LR \HL \stoptable %should there also be a \o{u}? You don't want \`{i} or \'{j} so for an accented {\em i} and {\em j} you compose the characters as follows: \type{\"{\i}} ~~~ \"{\i} ~~~~~ \type{\^{\j}} ~~~ \^{\j} \section{Foreign symbols} \index{foreign symbols} The composition of characters that appear in foreign languages is shown in \in{table}[tab:foreign symbols]. % % beware of the spanish questionmark and exclamation % (and the frumious bandersnatch) \placetable [here,force] [tab:foreign symbols] {Foreign characters.} \starttable[|c|c|c|c|] \HL \NC \bf You type \NC \bf You get \VL \bf You type \NC \bf You get \NC\SR \HL \NC \type{\oe} \NC \oe \VL \type{\O} \NC \O \NC\FR \NC \type{\OE} \NC \OE \VL \type{\l} \NC \l \NC\MR \NC \type{\ae} \NC \ae \VL \type{\L} \NC \L \NC\MR \NC \type{\AE} \NC \AE \VL \type{\SS} \NC \SS \NC\MR \NC \type{\aa} \NC \aa \VL \type{?}\type{`} \NC ?` \NC\MR \NC \type{\AA} \NC \AA \VL \type{!}\type{`} \NC !` \NC\MR \NC \type{\o} \NC \o \VL \NC \NC\LR \HL \stoptable %should not \ss be here also? \chapter{Page layout} \index{layout} \index{page design} \Command{\tex{setuplayout}} \Command{\tex{adaptlayout}} \Command{\tex{showlayout}} \Command{\tex{showsetups}} \Command{\tex{showmakeup}} \Command{\tex{startlocal}} The page layout is defined by: \shortsetup{setuplayout} \noindenting This command is typed in the set up area of your input file. You have to familiarize yourself with the parameters that describe your page layout. A page is divided in a number of areas such as the text, margin, head, foot etc. The size of these areas can be set with \type{\setuplayout}. The different areas in the page layout are shown in \in{figure}[fig:pagelayout]. \placefigure [here] [fig:pagelayout] {The page layout.} {\hbox{\framed[width=1.5cm,frame=off]{} \framed[width=2cm,frame=off]{\tt left} \framed[width=2.5cm,frame=off]{\tt left} \framed[width=3cm,frame=off]{\tt text} \framed[width=2.5cm,frame=off]{\tt right} \framed[width=2cm,frame=off]{\tt right}} \hbox{\framed[width=1.5cm,frame=off]{} \framed[width=2cm,frame=off]{\tt edge} \framed[width=2.5cm,frame=off]{\tt margin} \framed[width=3cm,frame=off]{\tt text} \framed[width=2.5cm,frame=off]{\tt margin} \framed[width=2cm,frame=off]{\tt edge}} \hbox{\framed[width=1.5cm,frame=off]{\tt top} \framed[width=2cm]{} \framed[width=2.5cm]{} \framed[width=3cm]{} \framed[width=2.5cm]{} \framed[width=2cm]{}} \hbox{\framed[width=1.5cm,frame=off]{\tt header} \framed[width=2cm]{} \framed[width=2.5cm]{} \framed[width=3cm]{} \framed[width=2.5cm]{} \framed[width=2cm]{}} \hbox{\framed[width=1.5cm,frame=off,height=3cm]{\tt text} \framed[width=2cm,height=3cm]{} \framed[width=2.5cm,height=3cm]{} \framed[width=3cm,height=3cm]{} \framed[width=2.5cm,height=3cm]{} \framed[width=2cm,height=3cm]{}} \hbox{\framed[width=1.5cm,frame=off]{\tt footer} \framed[width=2cm]{} \framed[width=2.5cm]{} \framed[width=3cm]{} \framed[width=2.5cm]{} \framed[width=2cm]{}} \hbox{\framed[width=1.5cm,frame=off]{\tt bottom} \framed[width=2cm]{} \framed[width=2.5cm]{} \framed[width=3cm]{} \framed[width=2.5cm]{} \framed[width=2cm]{}}} If you want to look at your page layout you can type the command \type{\showframe} and process one page or the whole file. The areas are shown in a number of frames. The command \type{\showsetups} shows the values of the parameters. A combination of both commands is \type{\showlayout}. The values of the layout parameters are available as commands (see \in{table}[tab:parameters]). This enables you to work more accurately when defining measures of columns, figures and tables. A few of these parameters are explained in \in{table}[tab:fewparameters]. \placetable [here,force] [tab:fewparameters] {A few parameters as commands.} \starttable[|l|l|] \HL \NC \bf Commands \NC \bf Meaning \NC\SR \HL \NC \type{\makeupwidth} \NC width of the typing area \NC\FR \NC \type{\makeupheight} \NC height of the typing area \NC\MR \NC \type{\textwidth} \NC width of the text area \NC\MR \NC \type{\textheight} \NC height of the text area \NC\LR \HL \stoptable If you want to define the width of a column or the height of a figure you can do it relative to the \type{\makeupwidth} or \type{\makeupheight}. Changes in page width or page height will alter columns and figures proportionally. \startbuffer \placefigure [here] [fig:stepgable] {A stepgable.} {\externalfigure[hass19g] [width=.45\textwidth]} \stopbuffer \typebuffer After processing this is \in{figure}[fig:stepgable]. \getbuffer The other distances and measures are shown in \in{table}[tab:parameters]. The command \type{\setuplayout} is defined in the set up area of your input file, before the \type{\starttext} command. This means that the values of the parameters have a global effect and are default throughout the document. Nevertheless you might want to make slight changes in the page design for a number of pages. \startbuffer \adaptlayout[21,38][height=+.5cm] \stopbuffer \typebuffer In this case page 21 and 38 have a height of .5~cm plus the default height. For local changes in the page layout you can use: \shortsetup{startlocal} For example: \startbuffer \start \startlocal \setuplayout[height=+.5cm] \stoplocal Hasselt has a completely different layout to most other cities because of its fortifications and moats. \stop \stopbuffer \typebuffer It is advisable not to use these local changes too often. It is always better to alter the text than to change the page layout. %but not always possible \startbuffer \starttablehead \HL \NC \bf Parameter \NC \bf Available command \NC\SR \HL \stoptablehead \starttabletail \HL \stoptabletail \starttables[|l|l|] \NC topdistance \NC \type{\topheight} \NC\FR \NC topheight \NC \type{\topheight} \NC\MR \NC headerdistance \NC \type{\headerdistance} \NC\MR \NC headerheight \NC \type{\headerheight} \NC\MR \NC topspace \NC \type{\topspace} \NC\MR \NC headlevel \NC \type{\headerlevel} \NC\MR \NC backspace \NC \type{\backspace} \NC\MR \NC margindistance \NC \type{\margindistance} \NC\MR \NC marginwidth \NC \type{\marginwidth} \NC\MR \NC leftmarginwidth \NC \type{\leftmarginwidth} \NC\MR \NC rightmarginwidth \NC \type{\rightmarginwidth} \NC\MR \NC edgedistance \NC \type{\edgedistance} \NC\MR \NC edgewidth \NC \type{\edgewidth} \NC\MR \NC leftedgewidth \NC \type{\leftedgewidth} \NC\MR \NC rightedgewidth \NC \type{\rightedgewidth} \NC\MR \NC paperheight \NC \type{\paperheight} \NC\MR \NC paperwidth \NC \type{\paperwidth} \NC\MR \NC makeupheight \NC \type{\makeupheight} \NC\MR \NC makeupwidth \NC \type{\makeupwidth} \NC\MR \NC textheight \NC \type{\textheight} \NC\MR \NC textwidth \NC \type{\textwidth} \NC\MR \NC footerdistance \NC \type{\footerdistance} \NC\MR \NC footerheight \NC \type{\footerheight} \NC\MR \NC bottomdistance \NC \type{\bottomdistance} \NC\MR \NC bottomheight \NC \type{\bottomheight} \NC\LR \stoptables \stopbuffer \splitfloat[lines=1] {\placetable [here][tab:parameters] {Parameters for page design.}} {\getbuffer} \chapter{Paragraph spacing} \section{Introduction} \index{paragraph} \Command{\tex{par}} \Command{\tex{paragraph}} In \TEX\ and \CONTEXT\ the most important unit of text is the paragraph. You can start a new paragraph by: \startitemize[packed] \item an empty line \item the \TEX\ command \type{\par} \stopitemize In your \ASCII\ input file you should use empty lines as paragraph separators. This will lead to a clearly structured and well organized file and will prevent mistakes. In situations where a command has to be closed explicitly you should use \type{\par}. \startbuffer During one of the wars Hasselt lay under siege. After some time the city was famine stricken, everything edible was eaten. Except for one cow. The cow was kept alive and treated very well. \par Once a day the citizens of Hasselt took the cow for a walk on theramparts. The besiegers saw the well fed cow and became very discouraged. They broke up their camps and Hasselt was saved. \par In the Hoogstraat in Hasselt there is a stone tablet with a representation of the cow that commemorates the siege and the wisdom of the citizens of Hasselt. \stopbuffer \typebuffer This could also be typed without \type{\par}s and a few empty lines. \startbuffer During one of the wars Hasselt lay under siege. After some time the city was famine stricken, everything edible was eaten. Except for one cow. The cow was kept alive and treated very well. Once a day the citizens of Hasselt took the cow for a walk on the ramparts. The besiegers saw the well fed cow and became very discouraged. They broke up their camps and Hasselt was saved. In the Hoogstraat in Hasselt there is a stone tablet with a representation of the cow that commemorates the siege and the wisdom of the citizens of Hasselt. \stopbuffer \typebuffer \section{Inter paragraph spacing} \index{inter paragraph spacing} \Command{\tex{setupwhitespace}} \Command{\tex{nowhitespace}} \Command{\tex{whitespace}} \Command{\tex{setuplinecorrection}} \Command{\tex{blank}} \Command{\tex{setupblank}} \Command{\tex{startpacked}} \Command{\tex{startunpacked}} The vertical spacing between paragraphs can be specified by: \shortsetup{setupwhitespace} This document is produced with \crlf \type{\setupwhitespace[middle]}. When inter paragraph spacing is specified there are two commands available that are seldom needed: \starttyping \nowhitespace \whitespace \stoptyping When a paragraph consists of a horizontal line or a table like this one: \startbuffer \starttable[|l|c|] \HL \NC \bf City \NC \bf Area code \NC\SR \HL \NC Hasselt \NC 8060 -- 8061 \NC\SR \HL \stoptable \stopbuffer \getbuffer Sometimes spacing is suboptimal. For that purpose you could carry out a correction with: \shortsetup{startlinecorrection} So if you would type: \startbuffer \startlinecorrection \framed{something framed} \stoplinecorrection \stopbuffer \typebuffer you will get a better output. Only use these commands if really needed! \getbuffer Another command to deal with vertical spacing is: \shortsetup{blank} The bracket pair is optional and within the bracket pair you can type the amount of spacing. Keywords like \type{small}, \type{middle} and \type{big} are related to the fontsize. \startbuffer In official writings Hasselt always has the suffix Ov. This is an abbrevation for the province of {\em Overijssel}. \blank[2*big] The funny thing is that there is no other Hasselt in the Netherlands. So it is redundant. \blank The suffix is a leftover from the time that the Netherlands and Belgium were one country under King Philip II of Spain. \blank[2*big] Hasselt in Belgium lies in the province of Limburg. One wonders if Belgian people write Hasselt (Li) on their letters. \stopbuffer \typebuffer The command \type{\blank} without the bracket pair is the default space. The example would become: \getbuffer The default spacing can be set up with: \shortsetup{setupblank} If you want to surpress vertical spacing you can use: \shortsetup{startpacked} \startbuffer \defineparagraphs[city][n=2,before=,after=] \city Hasselt (Ov) \\ Overijssel \\ \city Hasselt (Li) \\ Limburg \\ \startpacked \city Hasselt (Ov) \\ The Netherlands \\ \city Hasselt (Li) \\ Belgium \\ \stoppacked \stopbuffer \typebuffer \getbuffer It is not hard to imagine why there is also: \shortsetup{startunpacked} You can force vertical space with \type{\godown}. The distance is specified within the brackets. \shortsetup{godown} \section{Indentation} \index{indentation} \index{paragraph+indentation} \Command{\tex{indenting}} \Command{\tex{noindenting}} \Command{\tex{setupindenting}} If you want the paragraph to start with an indentation you can type: \shortsetup{indenting} in the set up area of your input file. Between the brackets you can type the preferences; by default the preference is \type{never}. If you choose to use indentations you will have to say explicitly when you {\em do not} want to indent. This is done with: \starttyping \noindenting \stoptyping You can set up the value of the indentation with: \shortsetup{setupindenting} \SPQR{\setupindenting[1pc]} \chapter{Setup commands} \index{set up} \index{layout} Global commands are placed in the setup area of your input file, before \type{\starttext}. In \in{appendix}[comdefs] there is a complete overview of the available commands and their parameters. The set up commands all have the same structure. They look something like: \startbuffer \setup{setupparagraphs} \stopbuffer \getbuffer A set up command consist of a more or less logical name and a number of bracket pairs. Bracket pairs may be optional and in that case the \type{[]} are typeset slanted {\tt \sl []}. In the definition the bracket pairs may contain: \starttyping \setupacommand[.1.][.2.][..,..=..,..] \stoptyping The commas indicate that a list of parameters can be enclosed. In the options list following the definition, the \type{.1.} and \type{.2.} show the possible options that can be set in the first and second bracket pair respectively. The parameters and their possible values are placed in the third bracket pair. The default options and parameter values are underlined. Furthermore you will notice that some values are typeset in a slanted way: {\sl section}, {\sl name}, {\sl dimension}, {\sl number}, {\sl command} and {\sl text}. This indicates that you can set the value yourself. \start \defineparagraphs[parameter][n=2] \setupparagraphs[parameter][1][width=.15\textwidth] \startpacked \parameter {\sl section} \\ a section name like chapter, paragraph etc. \\ \parameter {\sl name} \\ an identifier (logical name) \\ \parameter {\sl dimension} \\ an dimension with a unit in \type{cm}, \type{pt}, \type{em}, \type{ex}, \type{sp} or \type{in} \\ \parameter {\sl number} \\ an integer \\ \parameter {\sl command} \\ a command \\ \parameter {\sl text} \\ text \\ \stoppacked \stop \chapter{Defining commands (or macros)} \CONTEXT\ is a set of macros based on \TEX. \TEX\ is a programming language as well as a typographical system. This means that you can do the programming yourself if you need that kind of flexibility. You can define a new command with: \shortsetup{define} Without any further explanation this command is used in the following example. You may have a well illustrated document and you are tired of typing: \startbuffer \placefigure [here,force] [fig:logical name] {Caption.} {\externalfigure[filename][width=5cm]} \stopbuffer \typebuffer You could define your own command with a few variables like: \startitemize[packed] \item logical name \item caption \item file name \stopitemize Your command definition and call could look something like this: \startbuffer \define[3]\myputfigure {\placefigure [here,force][fig:#1] {#2}{\externalfigure[#3][width=5cm]}} \myputfigure{lion}{The Dutch lion is a sentry.}{hass13g} \stopbuffer \typebuffer The value in the first set of square brackets, \type{[3]} indicates that you want to use three variables \type{#1}, \type{#2} and \type{#3}. In the command call \type{\myputfigure} you have to input these variables between curly braces. The result is shown in \in{fig}[fig:lion]. \getbuffer Very sophisticated commands can be programmed but this is left to your own inventiveness. In addition to defining commands you can also define \type{\start} $\cdots$ \type{\stop} command pairs. \shortsetup{definestartstop} For example: \startbuffer \definestartstop [stars] [commands={\inleft{\hbox to \leftmarginwidth {\leaders\hbox{$\star$}\hfill}}}, before=\blank, after=\blank] \startstars {\em Hasselter Juffers} are sweet cookies but the name is no accident. On July 21 in 1233 the {\em Zwartewaterklooster} (Blackwater Monastery) was founded. The monastery was meant for unmarried girls and women belonging to the nobility of Hasselt. These girls and women were called {\em juffers}. \stopstars \stopbuffer \typebuffer This will result in: \getbuffer \chapter[]{Miscellaneous} \section[floatingblocks]{Floating blocks} \index{floating blocks} \Command{\tex{definefloat}} \Command{\tex{setupfloat}} \Command{\tex{setupfloats}} \Command{\tex{setupcaptions}} \Command{\tex{placeintermezzo}} A block in \CONTEXT\ is a text element, for example a table or a figure that you can process in a special way. You have already seen the use of \type{\placefigure} and \type{\placetable}. These are both examples of floating blocks. The floating mechanism is described in \in{chapter}[figures] and \in[tables]. You can define these kind of blocks yourself with: \shortsetup{definefloat} The bracket pairs are used for the name in singular and plural form. For example: \starttyping \definefloat[intermezzo][intermezzi] \stoptyping Now the following commands are available: \starttyping \placeintermezzo[][]{}{} \startintermezzotext ... \stopintermezzotext \placelistofintermezzi \completelistofintermezzi \stoptyping The newly defined floating block can be set up with: \shortsetup{setupfloat} You can set up the layout of floating blocks with: \shortsetup{setupfloats} You can set up the numbering and the labels with: \shortsetup{setupcaption} These commands are typed in the set up area of your input file and will have a global effect on all floating blocks. \startbuffer \setupfloats[location=middle] \setupcaption[location=bottom, headstyle=boldslanted] \placeintermezzo{An intermezzo.} \startframedtext At the beginning of this century there was a tramline from Zwolle to Blokzijl via Hasselt. Other means of transport became more important and just before the second world war the tramline was stopped. Nowadays such a tramline would have been very profitable. \stopframedtext \stopbuffer \typebuffer \start \getbuffer \stop \section[textblocks]{Text blocks} \index{text blocks} \Command{\tex{defineblock}} \Command{\tex{useblocks}} \Command{\tex{hideblocks}} \Command{\tex{setupblock}} Another type of block is a text block. A text block for example is one or more paragraphs you want to use several times. You have to define a text block with: \shortsetup{defineblock} You give the name of text blocks between brackets; you can also type a list of names if you separate them by commas. For example you can define: \starttyping \defineblock[dutch] \stoptyping After defining the text block the following command is available: \starttyping \begindutch ... \enddutch \stoptyping Text blocks are manipulated with: \shortsetup{hideblocks} \shortsetup{useblocks} \shortsetup{keepblocks} \shortsetup{selectblocks} An example shows the possibilities of text blocks. \startbuffer \defineblock[dutch,english] \hideblocks[dutch,english] \beginenglish[dedemsvaart-e] After 1810 the Dedemsvaart brought some prosperity to Hasselt. All ships went through the canals of Hasselt and the shops on both sides of the canals prospered. \endenglish \begindutch[dedemsvaart-d] Sinds 1810 veroorzaakte de Dedemsvaart enige welvaart in Hasselt. Alle schepen voeren door de grachten en de winkels aan weerszijden van de gracht floreerden. \enddutch \useblocks[english][dedemsvaart-e] \stopbuffer \typebuffer \getbuffer If you continue defining these blocks you could make a bilingual manual. For that purpose it is also possible to store the text blocks in an external file. This would look something like this: \startbuffer \setupblock[dutch][file=store-d] \stopbuffer \typebuffer The Dutch text blocks are stored in \type{store-d.tex} and the text fragments can be called upon by their logical names. \section{Storing text for later use} \index{storing text} \Command{\tex{startbuffer}} \Command{\tex{getbuffer}} \Command{\tex{typebuffer}} \Command{\tex{setupbuffer}} You can store information temporarily for future use in your document with: \shortsetup{startbuffer} For example: \starttyping \startbuffer[visit] If you want to see what Hasselt has in store you should come and visit it some time. \stopbuffer \getbuffer[visit] \stoptyping With \type{\getbuffer[visit]} you recall the stored text. The logical name is optional. With \type{\typebuffer[visit]} you get back the typeset version of the content of the buffer. Buffers are set up with: \shortsetup{setupbuffer} \section{Hiding text} \index{hiding text} \Command{\tex{starthiding}} Text can be hidden with: \shortsetup{starthiding} The text in between will not be processed. \section{Lines} \index{lines} \Command{\tex{hairline}} \Command{\tex{starttextrule}} \Command{\tex{thinrule}} \Command{\tex{thinrules}} \Command{\tex{setupthinrules}} There are many comands to draw lines. For a single line you type: \shortsetup{hairline} or: \shortsetup{thinrule} For more lines you type: \shortsetup{thinrules} Text in combination with lines is also possible: \startbuffer \starttextrule{Hasselt -- Amsterdam} If you draw a straight line from Hasselt to Amsterdam you would have to cover a distance of almost 145 \Kilo \Meter. \stoptextrule If you draw two straight lines from Hasselt to Amsterdam you would have to cover a distance of almost 290 \Kilo \Meter. Amsterdam \thinrules[n=3] Hasselt \stopbuffer \getbuffer \typebuffer You always have to be careful in drawing lines. Empty lines around \type{\thinrules} must not be forgotten and the vertical spacing is always a point of concern. You can set up line spacing with: \shortsetup{setupthinrules} There are a few complementary commands that might be very useful. \shortsetup{setupfillinrules} \shortsetup{setupfillinlines} These commands are introduced in the examples below: \startbuffer \setupfillinrules[width=2cm] \setupfillinlines[width=3cm] \fillinrules[n=1]{\bf name} \fillinrules[n=3]{\bf adress} \fillinline{Can you please state the \underbar{number} of cars used in your family.} \par Strike out any word \overstrikes{in this text}\periods[18] \stopbuffer \typebuffer This will become: \getbuffer These commands are used in questionaires. Text that is struck out or underlined will not be hyphenated. \section{Super- and subscript in text} \index{subscript} \index{superscript} \Command{\tex{low}} \Command{\tex{high}} \Command{\tex{lohi}} \startbuffer It is very easy to put \high{superscript} and \low{subscript} in your text. What would you call this version \lohi{subscript}{superscript}? It looks strange! \stopbuffer \getbuffer This ugly text was made with \type{\low{}}, \type{\high{}} and \type{\lohi{}{}}. The text was placed between the curly braces. \section{Date} \index{date} \Command{\tex{currentdate}} You can introduce the system date in your text with: \starttyping \currentdate \stoptyping \section{Positioning} \index{positioning} \Command{\tex{position}} \Command{\tex{setupositioning}} Sometimes you feel the need to position text on a page or within a text element. You can position text with: \shortsetup{position} The parenthesis enclose the $x,y$ coordinates, the curly braces enclose the text you want to position. You can set up the $x,y$ axes with: \shortsetup{setuppositioning} You can use units and scaling factors. An example will illustrate \type{\position}. \startbuffer \def\dicefive% {\framed [width=42pt,height=42pt,offset=0pt] {\setuppositioning [unit=pt,factor=12,xoffset=-11pt, yoffset=-8pt]% \startpositioning \position(1,1){$\bullet$}% \position(1,3){$\bullet$}% \position(2,2){$\bullet$}% \position(3,1){$\bullet$}% \position(3,3){$\bullet$}% \stoppositioning}} \placefigure{This is five.}{\dicefive} \stopbuffer \typebuffer This is a rather complex example but it would look something like this. \getbuffer \section{Rotating text, figures and tables} \index{rotating} \Command{\tex{rotate}} In a number of cases you would like to rotate text or figures. You can rotate text and objects with: \shortsetup{rotate} The first bracket pair is optional. Within that bracket pair you specify the rotation: \type{rotation=90}. The curly braces contain the text or object you want to rotate. \startbuffer Hasselt got its municipal rights in 1252. From that time on it had the \rotate[rotation=90]{right} to use its own seal on official documents. This seal showed Holy Stephanus known as one of the first Christian martyrs, and was the \rotate[rotation=270]{patron} of Hasselt. After the Reformation the seal was redesigned and Stephanus lost his `holiness' and was from that time on depicted without his aureole. \stopbuffer \typebuffer This results in a very ugly paragraph: \getbuffer You can rotate a figure just as easily: \startbuffer \placefigure {The 180 \Degrees\ rotated fishing port (de Vispoort).} \rotate[rotation=180]{\externalfigure% [hass15g][width=4cm]} \stopbuffer \typebuffer It is not always clear what you get when you rotate. \getbuffer You can set up rotation with: \shortsetup{setuprotate} \section{Carriage return} \index{carriage return} \Command{\tex{crlf}} \Command{\tex{startlines}} A new line can be enforced with: \shortsetup{crlf} When a number of lines should be followed by {\em carriage return and line feed} you can use: \shortsetup{startlines} \starttyping \startlines . . . \stoplines \stoptyping \startbuffer On a wooden panel in the town hall of Hasselt you can read: \startlines Heimelijcken haet eigen baet jongen raet Door diese drie wilt verstaen is het Roomsche Rijck vergaen. \stoplines This little rhyme contains a warning for the magistrates of Hasselt: don't allow personal benefits or feelings to influence your wisdom in decision making. \stopbuffer \typebuffer \getbuffer In a few commands new lines are generated by \type{\\}. For example if you type \type{\inmargin{in the\\margin}} then the text will be divided over two lines. \section{Hyphenation} \index{hyphenation} \index{language} \Command{\tex{language}} \Command{\tex{nl}} \Command{\tex{en}} \Command{\tex{fr}} \Command{\tex{sp}} \Command{\tex{de}} When writing multi-lingual texts you have to be aware that hyphenation may differ from one language to another. To activate a language you type: \shortsetup{language} Between the brackets you fill in \type{nl}, \type{fr}, \type{en}, \type{de} and \type{sp}. To change from one language to another you can use the shorthand versions: \starttyping \nl \en \de \fr \sp \stoptyping \startbuffer If you want to know more about Hasselt, the best book to read is probably {\nl \em Uit de geschiedenis van Hasselt} by F.~Peereboom. \stopbuffer \typebuffer \getbuffer If a word is wrongly hyphenated you can define points of hyphenation yourself. This is done in the set up area of your input file: \startbuffer \hyphenation{his-to-ry} \stopbuffer \typebuffer \section{Comment in input file} \index{comment} \index[percent]{\% in input file} All text between \type{\starttext} and \type{\stoptext} will be processed while running \CONTEXT. Sometimes however you may have text fragments you don't want to be processed or you want to comment on your \CONTEXT\ commands. If you preceed your text with the percentage sign \type{%} it will not be processed. \startbuffer % In very big documents you can use % the command input for different files. % % For example: % % \input hass01.tex % chapter 1 on Hasselt % \input hass02.tex % chapter 2 on Hasselt % \input hass03.tex % chapter 3 on Hasselt \stopbuffer \typebuffer When you delete the \type{%} before \type{\input} the three files will be processed. The comment describing the contents of the files will not be processed. \section{Input of another {\tt tex} file} \index{input other \TEX--files} \Command{\tex{input}} In a number of situations you may want to insert other \TEX\ files in your input file. For example, sometimes it is more efficient to specify \CONTEXT\ sources in more than one file in order to be able to partially process your files. Another file (with the name \type{another.tex}) can be inserted by: \starttyping \input another.tex \stoptyping The extension is optional so this will work too: %on a mac? e.g. textures? \starttyping \input another \stoptyping The command \type{\input} is a \TEX\ command. \chapter{Using modules} For reasons of efficiency the author decided to implement some functionality of \CONTEXT\ by means of external modules. At this moment you can load the following modules: \startitemize[packed] \item \type{chemic} for typesetting chemical structures \item \type{units} for using \cap{SI} units \item \type{pictex} for drawing pictures (is used in conjunction with module \type{chemic}) \stopitemize Loading is done in the set up area of your input file and done by means of: \shortsetup{usemodule} \SPQR{\stopcolumns} \stopbodymatter \page \startappendices \SPQR{\startcolumns[n=2,lijn=on]} \chapter{User specifications} \index{\tt cont-sys.tex} When \CONTEXT\ is run a number of predefined parameters is loaded. These parameters are set up in the file \type{cont-sys.tex}. Users can define their own preferences (housestyle) in this file. Be aware of the fact that \CONTEXT\ has to be able to find this file. The readme file that goes with the distribution tells some more about site specific setups. The most important addition to this file probbably concerns the output: \starttyping \setupoutput[pdftex] \stoptyping tells \CONTEXT\ to produce \PDF\ output instead of \DVI, while \starttyping \setupoutput[dvipsone,dviwindo] \stoptyping sets things up for those programs. By default \DVIPS\ output is set up. \chapter{Processing steps} \index[texutil]{\TEXUTIL} \index[tuo]{{\tt tuo}--file} During processing \CONTEXT\ writes information in the file \type{myfile.tui}. This information is used in the next pass. Part of this information is processed by the program \TEXUTIL. Information on registers and lists are written in the file \type{myfile.tuo}. The information in this file is filtered and used (when necessary) by \CONTEXT. \starttyping texutil --references filename \stoptyping When \CONTEXT\ cannot find a figure, you can generate an figure auxilliary file by saying: \starttyping texutil --figures *.* \stoptyping or whatever specification suits. When one wants to convert \EPS\ illustrations to \PDF\ one, there is: \starttyping texutil --figures --epspage --epspdf \stoptyping One can use \TEXEXEC\ to run \CONTEXT: \starttyping texexec filename \stoptyping runs as many times as needed to get the references straight. One can also specify specific needs on the command line, for instance if two up formatting is needed or pdf code is output. When in doubt, say \type{--help} and you get all the information needed to proceed. \chapter{Auxilliary files} \index[tui]{{\tt tui}--file} \index[tuo]{{\tt tuo}--file} \index[tub]{{\tt tub}--file} \index[tuf]{{\tt tuf}--file} \index{auxilliary files} \CONTEXT\ will produce a number of auxilliary files during processing. If your input file is called \type{myfile.tex} the following files may appear on your working directory. \starttable[|l|l|l|] \HL \NC \bf File \NC \bf Content \NC \bf State \NC\SR \HL \NC \tt myfile.tex \NC text \NC do not remove \NC\SR \HL \NC \tt myfile.tui \NC input information \NC can be removed \NC\FR \NC \tt myfile.tuo \NC output information \NC do not remove \NC\MR \NC \tt myfile.tub \NC block information \NC do not remove \NC\MR \NC \tt myfile.tmp \NC buffer information \NC can be removed \NC\LR \HL \NC \tt texutil.tuf \NC figure information \NC generate if needed \NC\SR \HL \NC \tt myfile.dvi \NC typeset text \NC can be removed \NC\FR \NC \tt myfile.ps \NC printable text \NC can be removed \NC\MR \NC \tt myfile.pdf \NC printable text \NC can be removed \NC\LR \HL \stoptable \SPQR{\stopcolumns} \CommandList {Command definitions} \SPQR{\startcolumns[n=2,lijn=on]} \CommandIndex {Command Index} \NormalIndex {Subject Index} \SPQR{\stopcolumns} \stopappendices \vskip24pt \SPQR{\startcolumns[n=2,lijn=on]} \Colofon \SPQR{\stopcolumns} \BackPage \stoptext