The mdoc language, in descending from the type-setting language roff, has significant type-setting capabilities. Punctuation is treated specially in all mdoc documents, both in terms of macro and text lines.
The following characters are considered punctuation:
! | ending sentence |
" | ending enclosure |
( | opening enclosure |
) | ending enclosure |
, | ending |
. | ending sentence |
: | ending |
; | ending |
? | ending sentence |
[ | opening enclosure |
] | ending enclosure |
| | intervening |
These are treated specially by the formatter when used in macro lines and at the end of text lines.
End of Sentence, End of Line.
The end of a sentence should always be at the end of a line. This way, the formatter can recognise a sentence by the
punctuation used and insert the correct amount of spaces. If supported by the output media (HTML, for example, does not), all modern mdoc
formatters use English spacing to mark sentence boundaries.
The ending sentence
punctuation in the punctuation table marks an end of sentence.
In text lines, sentence punctuation should always occur at the end of the line.
Note, in the last sentence, that the formatter will recognise sentence punctuation even when followed by ending
enclosure
punctuation as noted in the punctuation table.
However, take care that non-sentence punctuation, such as for abbreviations, does not happen to fall at the line boundary.
In this case, the formatter will interpret Dr. as ending a sentence. In this event, you can either restructure your line or add a zero-width escape following the period.
Macro lines are slightly more complicated. The same rules apply, but punctuation marks must be separated by spaces. The formatter will understand the role of the punctuation and remove the spaces accordingly, or reorder sentence and closing punctuation.
The punctuation may be escaped by either a trailing escape, as in the text case, or a preceding escape. In this case it is not considered punctuation, but regular text. Note that this will also cause an intervening space to be printed.
Non-sentential text line punctuation — commas, parenthesis, quotes, etc.— is a matter of literal printing.
The rules for macro lines are the same but for in-line macros, which might decorate individual terms with text. In this case, punctuation as a standalone argument is specially treated in that it is not decorated, and whitespace removed according to the punctuation type (opening, closing).
In the second example, (All and end-of-sentence.) are considered arguments, and thus not accommodated for in terms of punctuation. In the third, the period is escaped and thus considered regular text.
Contents | Next | Home | History |
Last edited by $Author: kristaps $ on $Date: 2011/12/25 14:44:21 $. Copyright © 2011, Kristaps Dzonsons. CC BY-SA.