Changes

Jump to navigation Jump to search
2,352 bytes added ,  23:14, 3 September 2005
Finished the answer, including a proper solution as well as the simple one.
== In ConTeXt: A simple solution ==
The ConTeXt philosophy is for the author to specify the formatting, rather than selecting from existing formats. A simple solution is thus to write the title block directly; the following version is a close duplicate of the version produced by the <code>\maketitle</code> command in LaTeX's startard article class. Obviously, the fine details of spacing and font sizes can be adjusted as desired.
<texcode>
== In ConTeXt: A more flexible solution ==
The simple solution replicates the appearance of the LaTeX original, but it doesn't replicate the spirit of it, which is to separate the formatting from the content. We can do this by creating the following definitions, and putting them in a module file. The <code>\title</code> and similar commands are copied nearly directly from the LaTeX kernel, and the formatting command the same as the previous version. <texcode>\unprotect\def\title#1{\gdef\@title{howto#1}}\def\author#1{\gdef\@author{#1}}\def\date#1{\gdef\@date{#1}}\date{\today} % Default to today unless specified otherwise. \def\maketitle{% \startalignment[center] \blank[2*big] {\tfd \@title} \blank[3*medium] {\tfa \@author} \blank[2*medium] {\tfa \@date} \blank[3*medium] \stopalignment}\protect</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>usepackage</cmd><tt>[title]</tt> command in place of <code>\documentclass{article}</code>. <texcode>\usepackage[title] \title{How to do this in Context} \author{The author} \date{July 26, 2005} \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> The 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.  <context>\unprotect\def\title#1{\gdef\@title{#1}}\def\author#1{\gdef\@author{#1}}\def\date#1{\gdef\@date{#1}}\date{\today} % Default to today unless specified otherwise. \def\maketitle{% \startalignment[center] \blank[2*big] {\tfd \@title} \blank[3*medium] {\tfa \@author} \blank[2*medium] {\tfa \@date} \blank[3*medium] \stopalignment}\protect \title{How to do this in Context}\author{The author}\date{July 26, 2005} \starttext\maketitleThen, the actual text of the document starts here. We'll put in enough text tofill out the line and start to make a paragraph.\stoptext</context>

Navigation menu