Changes

Jump to navigation Jump to search
Created the page with initial edit.
<cd:commandgroup name="commalistsentence" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc><!-- a short command summary goes here -->
The command <tt>\commalistsentence</tt> is used to present a comma separated list of values (like an author list, for example) in a single line, with the option of changing the separator of the items and have a distinct separator for the last item of the list.


</cd:shortdesc>
<cd:variants>
<cd:command category="language" file="lang-lab.mkiv" interfacedate="2020-07-14T09:24" interfacefile="i-language.xml" level="document" name="commalistsentence" variantnumber="1">
<cd:arguments>
<cd:keywords list="yes" ordinal="1">
<cd:keywordsdoc>A comma separated list of items. Use <tt>{}</tt> to group items that contain commas, spaces or other special characters. </cd:keywordsdoc>
<cd:constant type="cd:text"><tt>a,b,c,d,e,{f, g, h},i,j</tt></cd:constant>
</cd:keywords>
<cd:keywords list="yes" optional="yes" ordinal="2">
<cd:keywordsdoc>An array with two (2) items, describing the separator for each item, and the separator between the last element and the one preceding it. This item is optional. </cd:keywordsdoc>
<cd:constant type="cd:text"><tt>[{ \&amp; },{ and }] % result: a &amp; b &amp; c &amp; d &amp; e &amp; f, g, h &amp; i and j </tt></cd:constant>
</cd:keywords>
</cd:arguments>
</cd:command>
</cd:variants>
<cd:description>This is a useful command for creating lists where you want to treat the last item differently than the rest, for example, on a list of authors, or publishers.

If you want you can setup labels for the default behavior, using <tt>\setuplabeltext</tt>. </cd:description>
<cd:examples><cd:example title="Some simple lists"><context source="yes" text="Result:">
\commalistsentence[aap,noot,mies]

\commalistsentence[aap,noot]

\commalistsentence[aap]

\commalistsentence[a,b,c]

\commalistsentence[a,b,c][{ \& },{ and }]

\commalistsentence[a,b,c][+,-]
</context>
</cd:example><cd:example title="A list of authors"><context source="yes" text="Result:">
\def\Authors{%
{John Smith, Ph.~D.},
{Michel Witggenstein, M.~Sc.},
{Zoraya Montoya-Velásquez, M.~Sc.},
{Satoshi Ota, Ph.~D.},
{Oba Odumo, M.~Sc.},
{Ivan Ilich, Ph.~D}%
}
\starttext
\commalistsentence[\Authors][{;\space},{\space\letterampersand\space}]: authors.
\stoptext
</context>
</cd:example></cd:examples>
<cd:notes></cd:notes>
<cd:seealso>
<cd:source file="lang-lab.mkiv" originator="system"></cd:source>
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage></cd:seealso>
</cd:commandgroup>
18

edits

Navigation menu