Difference between revisions of "Command/defineenumeration"

From Wiki
Jump to navigation Jump to search
(simplify example)
(Condense page to one-third of its length without loss of information or clarity.)
Line 25: Line 25:
  
 
== Description ==  
 
== Description ==  
With <code>\defineenumeration</code> you can number text elements like remarks or questions.
+
With <code>\defineenumeration</code> you can define the commands for a numbered text element, like remarks or questions. For example, if you want numbered remarks in your document you can define the environment as follows:
  
For example, if you want to make numbered remarks in your document you use:
 
 
== setup ==
 
 
<texcode>
 
<texcode>
 
\defineenumeration
 
\defineenumeration
 
[remark]
 
[remark]
 
[location=top,
 
[location=top,
text=Remark,
+
text=Remark,       % Display header as "Remark 1"
inbetween=\blank,
+
headstyle=bold,    % Bold remark headers
after=\blank]
+
inbetween={\blank[nowhite]},   % No blank line between remark header and remark
 +
after=\blank]       % Blank line after the remark.
 
</texcode>
 
</texcode>
  
You can also vary the layout of Remark and Subremark in the example above by:
+
This creates the new commands <code>\remark</code>, <code>\resetremark</code>, <code>\nextremark</code>, and <code>\startremark</code> ... <code>\stopremark</code>, as well as the same commands for <code>subremark</code> and <code>subsubremark</code>.
  
<texcode>
+
== Example ==
\setupenumeration[remark][headstyle=bold]
 
\setupenumeration[subremark][headstyle=slanted]
 
</texcode>
 
  
Now the new commands \remark, \subremark, \resetremark and \nextremark are available.  If the remark contains more than one paragraph you will have to use the command
 
pair \startremark ... \stopremark that becomes available after defining Remark with;
 
 
<texcode>\defineenumeration[remark]</texcode>
 
 
=== multiple paragraph ===
 
So the example above would look like this:
 
 
<texcode>
 
\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 on the same spot.
 
\stopremark
 
</texcode>
 
 
== input ==
 
<texcode>
 
\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 on the same spot.
 
</texcode>
 
 
== output ==
 
<pre>
 
<b>Remark 1</b>
 
In the early medieval times Hasselt was a place of pilgrimage. The Heilige Stede (Holy
 
Place) was torn down during the Reformation. In 1930, after 300 years the Heilige Stede
 
was reopened.
 
<b>Remark 1.1</b>
 
Nowadays the Heilige Stede is closed again but once a year an open air service is held on
 
the same spot.
 
</pre>
 
 
 
== Example ==
 
<!-- Please fill in an example if you can -->
 
 
<context source="yes" text="Gives:">
 
<context source="yes" text="Gives:">
  
\setupindenting[yes,medium,first]
+
\setupindenting[yes,small,first]
  
 
\defineenumeration
 
\defineenumeration
 
   [remark]
 
   [remark]
   [location=top,text=Remark,inbetween=\blank,after=\blank,headstyle=bold,margin=1in]
+
   [location=top,text=Remark,inbetween={\blank[nowhite]},after=\blank,headstyle=bold,margin=1in]
  
 
\starttext
 
\starttext
   \remark % One paragraph
+
   \remark
     In the early medieval times Hasselt was a place of pilgrimage.
+
     An enumeration (\tex{remark}, in this case) takes the paragraph that follows
    The {\em Heilige Stede} (Holy Place) was torn down during the Reformation.
+
     it as its argument.
     In 1930, after 300 years the {\em Heilige Stede} was reopened.
 
  
   \remark % The second paragraph IS NOT part of the remark
+
   \remark
    In the early medieval times Hasselt was a place of pilgrimage.
+
    This is the first paragraph after \tex{remark}. It is part of the remark.
  
     The {\em Heilige Stede} (Holy Place) was torn down during the Reformation.
+
     This is the second paragraph after \tex{remark}. It is not part of the remark.
    In 1930, after 300 years the {\em Heilige Stede} was reopened.
 
  
   \startremark[title={Title},head={Head}] % The second paragraph IS part of the remark
+
   \startremark
    % "title=" and "head=" seem to be meaningless
+
    This is the first paragraph inside \tex{startremark}. It is part of the remark.
    In the early medieval times Hasselt was a place of pilgrimage.
 
  
     The {\em Heilige Stede} (Holy Place) was torn down during the Reformation.
+
     This is the second paragraph inside \tex{startremark}. It is part of the remark.  
    In 1930, after 300 years the {\em Heilige Stede} was reopened.
 
 
   \stopremark
 
   \stopremark
 +
 +
  \subsubremark Presto!
  
 
\stoptext
 
\stoptext

Revision as of 13:35, 24 April 2012

\defineenumeration

Syntax

\defineenumeration[...,...,...][...][...,...=...,...]
[...,...,...] name
[...] name
[...,...=...,...] see \setupenumerations


Description

With \defineenumeration you can define the commands for a numbered text element, like remarks or questions. For example, if you want numbered remarks in your document you can define the environment as follows:

\defineenumeration
[remark]
[location=top,
text=Remark,        % Display header as "Remark 1"
headstyle=bold,     % Bold remark headers
inbetween={\blank[nowhite]},   % No blank line between remark header and remark
after=\blank]       % Blank line after the remark.

This creates the new commands \remark, \resetremark, \nextremark, and \startremark ... \stopremark, as well as the same commands for subremark and subsubremark.

Example


\setupindenting[yes,small,first]

\defineenumeration
  [remark]
  [location=top,text=Remark,inbetween={\blank[nowhite]},after=\blank,headstyle=bold,margin=1in]

\starttext
  \remark
    An enumeration (\tex{remark}, in this case) takes the paragraph that follows 
    it as its argument.

  \remark
    This is the first paragraph after \tex{remark}. It is part of the remark.

    This is the second paragraph after \tex{remark}. It is not part of the remark.

  \startremark
    This is the first paragraph inside \tex{startremark}. It is part of the remark.

    This is the second paragraph inside \tex{startremark}. It is part of the remark.   
  \stopremark

  \subsubremark Presto!

\stoptext

Gives:

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: