I would like to produce comma-separated lists, like "a, b, c, d" or "a, b, c, and d".
Requirements:
In the Latex source code, each line of the source code should contain one list element, and as little additional markup as possible.
It should be easy to re-order the entries by changing the order of source code lines.
For example, I could simply write the list elements like this:
a,
b,
c, and
d.
This would (almost) satisfy the first requirement, but it would fail on the second requirement. I would have to remember to fix the punctuation whenever I re-order the entries (or simply add a new entry). It sounds trivial, but it is surprisingly easy to forget to replace the full stop with a comma, and not that easy to spot the mistake. And I have a longish Latex document that mixes other content and such lists, so it would not be convenient to use an external script to generate the appropriate Latex code – I am really looking for something that is as easy as possible to maintain in the long term.
I do not really know what would be an appropriate interface; hence this can also be seen as an interface-design challenge. Perhaps something like this:
xxx\begin{commasep}[and]
\item a
\item b
\item c
\item d
\end{commasep}yyy
would produce:
xxxa, b, c, and dyyy
(Note: no whitespace after "d", so that I can add appropriate punctuation right after the list.)
I wonder if, e.g., paralist
can be tweaked to produce what I want?
paralist
, have a look at the alpha version ofenumitem
3.0 (announcement), which (finally) includes run-in lists.