Changes

Jump to navigation Jump to search
2,984 bytes added ,  00:42, 16 January 2018
Added empty line after paragraph delimited descriptions.
< [[From LaTeX to ConTeXt]] | [[Structurals]] >
== A Basic Description Environment Lists = == 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 {{cmd|item}} 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.
=== LaTeX ===
<texcode>
\documentclass{article}
\begin{document}
\begin{description}
\item[Short ] This is a shorter item label] bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla, and some text that talks about it. The text is wrapped into a paragraph, with successive bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla lines indented. \item[Very long Rather longer label] bla bla bla bla bla bla bla bla bla bla bla bla blaThis 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 bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla of the label.
\end{description}
\end{document}
</texcode>
==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}} or {{cmd|definedescription}}. The {{cmd|definedescription}} 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. <context source=yes>\definedescription[latexdesc][ headstyle=bold, style=normal, align=flushleft, alternative=hanging, width=broad, margin=1cm] \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. </context> The empty lines (or {{cmd|par}}) 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.
<tt>\setupdescription</tt> with some special parameters(<tt>location=hanging</tt>, <tt>widthMulti-Paragraph Descriptions =broad</tt>,<tt>margin==</tt><i>indentation</i>)LaTeX == Because the LaTeX description mechanism is an environment, it is simple to include multiple paragraphs in a description environment, or even to embed sub-lists. For instance, consider the following example:
<texcode>
\definedescriptiondocumentclass{article}\begin{document}\begin{description}\item[notationPara][ headstyle=bold,style=normal,align=left,location=hangingThis is a shorter item label,and some text that talks about it. width=broad The text is wrapped into a paragraph,margin=1cm]with successive lines indented.
\starttext\notation{A very very very very long This is another paragraph under the "Para" item} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
\notationbegin{idescription} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla \item[Sub-Item] This is a description of an item which is within the bla bla bla bla "Para" item.
\stoptextitem[Sub-Item] Another sub-item. \end{description}\item[Short] A short item that's not part of that really long "Para" item.\end{description}\end{document}
</texcode>
The empty lines (or In this example, the code indentation has been used to illustrate the alignment of the typeset output. Everything between <code>\item[Para]</code> and <ttcode>\paritem[Short]</ttcode>) after each is part of the "Para" item, and is indented by the same amount. The embedded description(here notation) are necessarythen embeds any following lines on the "Sub-Item"s by an additional indentation, as one would expect.
The result looks like this:<context>\definedescription[notation][ headstyle=bold,style=normal,alignConTeXt =left,location=hanging, width=broad,margin=1cm]Multiple paragraphs (without first line indenting) can be created as follows:
\starttext<context source=yes>\notation{A very very very very long item} bla bla bla bla bla bla bla bla bla bla bla bla bla bla bladefinedescription[descr][ bla bla bla bla bla bla bla bla bla bla bla bla bla bla blaheadstyle=bold, style=normal, align=flushleft, alternative=hanging, bla bla bla blawidth=broad, margin=1cm]
\notationstartdescr{iPara} bla bla bla bla bla bla bla bla bla bla bla bla bla bla blaThis is a shorter item label, and some text that talks about it. bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla blaThe text is wrapped into a paragraph, with successive lines indented.
This is another paragraph under the "Para" item. \stoptextstartdescr{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
</context>
<b>Hint:</b> This solution uses the <tt>distance=</tt><i>dimension</i>
distance for separation of label and text.
= Descriptions with Fixed Label Width =
 
== LaTeX ==
== Description with minimal In LaTeX, the <tt>mdwlist</tt> package can be used to set a fixed label width: ==.
=== LaTeX ===
<texcode>
\documentclass{article}
\begin{document}
\begin{basedescript}{\desclabelstyle{\pushlabel}\desclabelwidth{6em}}
\item[LabelShort] bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla This is a shorter item label, and some text that talks about it. bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla The text is wrapped into a paragraph, with successive lines indented.\item[Very long Rather longer label] bla bla bla bla bla bla bla bla bla bla bla bla bla blaThis is a longer item label. As you can see, the bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla paragraph simply starts 6em in.
\end{basedescript}
\end{document}
</texcode>
=== ConTeXt ===
This Using an explicit dimension as argument for the 'width' parametersets the label width to 6em5em:
<contextsource=yes>
\definedescription[notation][
headstyle=bold,style=normal,align=leftflushleft,locationalternative=hanging, width=6em5em] \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, the paragraph simply pretends the label is 5em wide. </context> Another example: <context source=yes>\setupcolors[state=start]\definedescription[Desc][alternative=top, hang=20, headstyle=bold, headcolor=blue command=\hskip-1cm, margin=1cm]
\starttext\notationDesc{LabelShort}This item's short label is set above the paragraph. The bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla paragraph starts 1cm in.
\notationDesc{Very long Rather longer label}This item's rather longer label is also set bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla above the paragraph. The paragraph starts 1cm in.
\stoptext
</context>
== See also ==* {{Howtocmd|definedescription}}* {{cmd|startdescription}}
gardener
110

edits

Navigation menu