List Format
In the field:
{
expression
Format
format
} where
expression
is a list of texts, the format
is interpreted as a punctuation text. Lists of texts are formatted by inserting punctuation symbols after each member of the list, and then concatenating the resulting list into a single text.
Punctuation symbols
There are 4 punctuation symbols referred to as the first and following symbol, the penultimate symbol, the last symbol and the symbol for two members only. If there are fewer than 4 punctuation symbols in the double-quoted format text then the missing symbols are inferred.
Format Text | First and Following Symbol | Penultimate Symbol | Last Symbol | Symbol for Two Members |
|---|---|---|---|---|
", |, and |.| and " | ", " | ", and " | "." | " and " |
", |, and |." | ", " | ", and " | "." | "" |
", |; and " | ", " | "; and " | "" | "" |
", " | "," | "" | "" | "" |
"" | "" | "" | "" | "" |
In addition, certain escaped characters (not case sensitive) in the punctuation symbol are interpreted as MS Word controls:
Escaped Character | MS Word Control |
|---|---|
^T | tab |
^L | paragraph (Return) or manual line-break (Shift-Return) |
^M | manual page-break |
^N | manual column-break |
^| | vertical bar character |
^^ | hat character |
note
If the expression field occupies a complete paragraph in the generated document, then each ^L becomes an MS Word paragraph, otherwise each ^L becomes an MS Word line-break within the paragraph.
Punctuation algorithm
The punctuation algorithm depends upon the length of the list.
Number of Marks | Punctuation |
|---|---|
0 | No punctuation. |
1 | The last symbol is inserted after the only member. |
2 | The symbol for two members is inserted after the first member, if specified. If the symbol for two members is not specified, the penultimate symbol is inserted after the first member. The last symbol is inserted after the second member. |
3+ | The last symbol is inserted after the last member, the penultimate symbol is inserted after the last-but-one member, and the first and following symbol is inserted after every other member of the list. |
Example 1
Consider a variable
ChildrenNames
having the value: List( "John", "Mary", "Peter", "Paul" )
The expression:
ChildrenNames Format ", |, and |."
evaluates to the text:
"John, Mary, Peter, and Paul."
whereas the expression:
ChildrenNames Format ",^L|, and^L|."
will appear in a generated document as multi-line text:
John,
Mary,
Peter, and
Paul.
Example 2
It is also possible to specify the use of separators depending on the number of items in the list to support Oxford comma. For example, use the format ", |, and |.| and " to get:
- "Anna and John." for two items in the list
- "Anna, John, and Lisa." for three items in the list