Changes

Jump to navigation Jump to search
1,383 bytes added ,  18:35, 12 February 2006
m
< [[From LaTeX to ConTeXt]] | [[Document Titles]] >
 
{{todo|This is sort of a stub article which I sketched out to remind myself what I wanted to write later. If anyone else wants to work on it, feel free!}}
== LaTeX ==
Much as with [[Document Titles]], the standard LaTeX document article and report classes define an <code>\abstract</code> command environment to typeset an abstract in a way that distinguishes it from the rest of the text. In a single-column article, it is set somewhat narrower than the main text, with the word "Abstract" centered above it.
<texcode>
% Note: this is the old Document Title example, as filler.
 
\documentclass{article}
\title{How to do this in Context}
\author{The author}
\date{July 26, 2005}
\begin{document}
\maketitlebegin{abstract} This is the abstract of the paper. \end{abstract}
\end{document}
</texcode>
 
{{todo|Replace the above with a proper example.}}
== ConTeXt: A simple solution ==
The simplest way of producing an abstract in a ConTeXt document is to specify the formatting directly. The following version is a close approximation of the version produced by the code from LaTeX's <code>\abstractclasses.dtx</code> command is nearly trivial, and is quite easy to replicate in LaTeX's startard article classConTeXt idioms.
<texcode>
% Again\starttext\midaligned{\bf Abstract}\startnarrower[2*middle]This is the document's abstract. It contains enough text for two lines, this but no more.\stopnarrower\blank[big] This is filler from the Document Titles pagemain text of the document. Like the abstract, it contains enough textfor two lines, to show the margins.\stoptext</texcode>
<context>
\starttext
\startalignment[center] \blank[2*big] midaligned{\tfd How to do this in Contextbf Abstract} \blankstartnarrower[32*mediummiddle] {\tfa The author}This is the document's abstract. It contains enough text for two lines, but no more. \blank[2*medium]stopnarrower {\tfa July 26, 2005} \blank[3*mediumbig]\stopalignment
Then, This is the actual main text of the document starts here. We'll put in Like the abstract, it contains enough text for two lines, tofill out show the line and start to make a paragraphmargins.
\stoptext
</context>
 
In the two-column document classes, LaTeX's <code>abstract</code> environment does nothing beyond putting a <code>\section*{Abstract}</code> in front of the abstract's text. This can be easily replicated in ConTeXt with <code>\subject{Abstract}</code>. (See [[Unnumbered Sections]].)
 
== ConTeXt: A more reusable solution ==
 
As with [[Document Titles]], to replicate the spirit of the LaTeX environment, we might want to separate the document formatting commands from the actual text of the abstract.
The low-level Context command <cmd>definestartstop</cmd> defines a pair of
<cmd>start</cmd> - <cmd>stop</cmd> commands, so we can define an
<code>abstract</code> environment using the following commands:
 
<texcode>
\definestartstop
[abstract]
[before={\midaligned{\bf Abstract}
\startnarrower[2*middle]},
after={\stopnarrower
\blank[big]}]
</texcode>
{{todo|Find This code can be placed in the code document header, or can be placed in a module file to be loaded in LaTeX's a number of documents. It could also be enhanced by <cmd>if<tt/cmd>classesstatements to distinguish between the one-column and two-column cases, as LaTeX does. In any case, once these commands are defined, they can be used in the obvious manner.dtx </tttexcode> \starttext\startabstractThis is the document's abstract. It contains enough text for setting abstractstwo lines, translate into ConTeXtbut no more.\stopabstract This is the main text of the document. Like the abstract, and put in it contains enough textfor two lines, to show the above examplemargins.}}\stoptext</texcode>
== ConTeXt: A more reusable solution ==This, of course, produces exactly the same result as the previous illustration.
{{todo|Write this whole section, along the lines of the parallel section in [[Document TitlesCategory:From LaTeX]].}}

Navigation menu