Changes

Jump to navigation Jump to search
949 bytes added ,  07:00, 4 September 2005
\usemodule instead of \usepackage, and an extra section about marking
</texcode>
Suppose that we save this in the file <code>t-title.tex</code>. Then, we can use this in our main ConTeXt document with the following syntax, which is quite similar to the LaTeX version aside from the addition of the <cmd>usepackageusemodule</cmd><tt>[title]</tt> command in place of <code>\documentclass{article}</code>.
<texcode>
\usepackageusemodule[title]
\doctitle{How to do this in Context}
\author{The author}
</texcode>
The typeset result is, of course, identical to the previous version. Now, the <code>t-title.tex</code> macros can be shared between any number of documents, and changes will affect all of the documents that use this file.  == Adding markings to headers and footers == With just a few extra lines and two redefined definitions in this module, like so: <texcode>\unprotect\definemarking[Author]\definemarking[Doctitle] \def\doctitle#1{\gdef\@title{#1}\marking[Doctitle]{#1}}\def\author#1{\gdef\@author{#1}\marking[Author]{#1}} % rest of the file as above</texcode> allow you to use the document title and author in your headers and footers: <texcode>\usemodule[title] \doctitle{How to do this in Context}\author{The author}\date{July 26, 2005} \setupheadertexts[{\getmarking[Doctitle]}][{\getmarking[Author]}] \starttext \maketitle Then, the actual text of the document starts here. We'll put in enough text to fill out the line and start to make a paragraph.\stoptext</texcode> 
<context>
\unprotect
\definemarking[Author]\definemarking[Doctitle] \def\doctitle#1{\gdef\@title{#1}\marking[Doctitle]{#1}}\def\author#1{\gdef\@author{#1}\marking[Author]{#1}}
\def\date#1{\gdef\@date{#1}}
\date{\today} % Default to today unless specified otherwise.
\author{The author}
\date{July 26, 2005}
 
\setupheadertexts[{\getmarking[Doctitle]}][{\getmarking[Author]}]
\starttext

Navigation menu