Changes

Jump to navigation Jump to search
1,663 bytes removed ,  00:42, 16 January 2018
Added empty line after paragraph delimited descriptions.
== LaTeX ==
LaTeX provides a <tt>description</tt> environment, which works just like an itemized or enumerated list except that the item labels are specified by an (optional) argument to the <tt>\{{cmd|item</tt> }} command, rather than being automatically generated. This is useful for making lists of definitions and other sorts of descriptions that are headed by a keyword.
<texcode>
\begin{document}
\begin{description}
\item[Short] This is a shorter item label, and some text that talks about it.The text is wrapped into a paragraph, with successive lines indented. \item[Rather longer label] This is a longer item label. As you can see, thetext is not started a specified distance in -- unlike with other lists -- butis spaced a fixed distance from the end of the label.
\end{description}
\end{document}
== ConTeXt ==
ConTeXt provides a similar mechanism. Unlike the LaTeX version, ConTeXt's description mechanism does not enclose the items in an environment, but instead formats them independently according to formats given in <{{cmd>|setupdescriptions</cmd> }} or <{{cmd>|definedescription</cmd>}}. The <{{cmd>|definedescription</cmd> }} latter command is used to define a named description class, which can later be called using its name. This example defines a <tt>latexdesc</tt> description, with parameters that roughly approximate the LaTeX defaults.
<texcodecontext source=yes>
\definedescription[latexdesc][
headstyle=bold,style=normal,align=leftflushleft,locationalternative=hanging, width=broad,margin=1cm] \starttext\latexdesc{Short} This is a shorter item label, and some text that talks about it.The text is wrapped into a paragraph, with successive lines indented.
\latexdesc{Rather longer labelShort} This is a longer shorter item label. As you can see, theand some text that talks about it. The text is not started wrapped into a specified distance in -- unlike paragraph, with other lists -- butis spaced a fixed distance from the end of the label successive lines indented.
\stoptextlatexdesc{Rather longer label} This is a longer item label. As you </texcode> can see, the text is not started a specified distance in -- unlike with other lists -- but is spaced a fixed distance from the end of the label.
<context>
\setuplayout[width=13cm]
\definedescription[latexdesc][
headstyle=bold,style=normal,align=left,location=hanging,
width=broad,margin=1cm]
 
\starttext
\latexdesc{Short} This is a shorter item label, and some text that talks about it.
The text is wrapped into a paragraph, with successive lines indented.
 
\latexdesc{Rather longer label} This is a longer item label. As you can see, the
text is not started a specified distance in -- unlike with other lists -- but
is spaced a fixed distance from the end of the label.
 
\stoptext
</context>
The empty lines (or <{{cmd>|par</cmd>}}) after each description (here, <tt>\latexdesc</tt>) line are required.
The <tt>margin=<i>dimension</i></tt> key specifies the hanging indentation for lines after the first line. In addition, the separation between the label and the text can be specified using a <tt>distance=<i>dimension</i></tt> key.
 
= Multi-Paragraph Descriptions =
Multiple paragraphs (without first line indenting) can be created as follows:
<texcodecontext source=yes>
\definedescription[descr][
headstyle=bold,style=normal,align=leftflushleft,locationalternative=hanging, width=broad,margin=1cm]
\starttext
\startdescr{Para}
This is a shorter item label, and some text that talks about it.
This is another paragraph under the "Para" item.
\startdescr{Sub Item}
This is a description of an item which is within the "Para" item. \stopdescr \startdescr{Sub Item} Another Sub Item \stopdescr\stopdescr\startdescr{Short} A short item that's not part of that really long "Para" item.\stopdescr \stoptext</texcode> <context>\setuplayout[width=13cm]\definedescription[descr][ headstyle=bold,style=normal,align=left,location=hanging, width=broad,margin=1cm] \starttext\startdescr{Para} This is a shorter item label, and some text that talks about it. The text is wrapped into a paragraph, with successive lines indented.  This is another paragraph under the "Para" item. \startdescr{Sub Item} This is a description of an item which is within the "Para" item.
\stopdescr
\startdescr{Sub Item}
A short item that's not part of that really long "Para" item.
\stopdescr
</context>
\stoptext
</context>
= Descriptions with Fixed Label Width =
\begin{basedescript}{\desclabelstyle{\pushlabel}\desclabelwidth{6em}}
\item[Short] This is a shorter item label, and some text that talks about it.
The text is wrapped into a paragraph, with successive lines indented.
\item[Rather longer label] This is a longer item label. As you can see, the
text is not started a specified distance paragraph simply starts 6em in -- unlike with other lists -- but is spaced a fixed distance from the end of the label.
\end{basedescript}
\end{document}
</texcode>
 
== ConTeXt ==
sets the label to 5em:
<texcode>\definedescription[notation][ headstyle=bold,style=normal,align=left,locationcontext source=hanging, width=5em]</texcode> <contextyes>
\definedescription[notation][
headstyle=bold,style=normal,align=leftflushleft,locationalternative=hanging,
width=5em]
\starttext\notation{Short} This is a shorter item label, and some text that talks about it.The text is wrapped into a paragraph, with successive lines indented.
\notation{Rather longer label} This is a longer item label. As you can see, thetext is not started a specified distance in -- unlike with other lists -- butis spaced a fixed distance from the end of paragraph simply pretends the labelis 5em wide.
\stoptext
</context>
Another example:
<texcode>
\definedescription
[Desc]
[location=top,hang=20,
headstyle={\bf\color[blue]},
command=\hskip-1cm,margin=1cm]
</texcode>
Gives the result: <contextsource=yes>
\setupcolors[state=start]
\definedescription[Desc][locationalternative=top,hang=20, headstyle={\bf\color[bold, headcolor=blue]}, command=\hskip-1cm,margin=1cm]
\starttext\Desc{Short} This is a shorter item 's short label, and some text that talks about itis set above the paragraph.TheThe text is wrapped into a paragraph, with successive lines indentedstarts 1cm in.
\Desc{Rather longer label} This is a item's rather longer item label. As you can see, thetext is not started a specified distance in -- unlike with other lists -- butalso setis spaced a fixed distance from above the end of the labelparagraph. The paragraph starts 1cm in.
\stoptext
</context>
 
== See also ==
* {{cmd|definedescription}}
* {{cmd|startdescription}}
gardener
110

edits

Navigation menu