em dashes in mdoc (was Re: Hello fdclose)

Bruce Evans brde at optusnet.com.au
Wed Mar 19 23:09:40 UTC 2014


On Wed, 19 Mar 2014, Benjamin Kaduk wrote:

> [changing cc list dramatically]
>
> On Wed, 19 Mar 2014, Bruce Evans wrote:
>
>> On Tue, 18 Mar 2014, John Baldwin wrote:
>> 
>>> @@ -84,7 +130,9 @@
>>> .Sh NOTES
>>> The
>>> .Fn fclose
>>> -function
>>> +and
>>> +.Fn fdclose
>>> +functions
>>> does not handle NULL arguments; they will result in a segmentation
>>> violation.
>>> This is intentional - it makes it easier to make sure programs written
>> 
>> In the old version:
>> 
>> Em-dash seems to be handled poorly by mdoc.  It seems to be necessary
>> to hard code it.  It shouldn't be hard coded as a hyphen.
>
> I seem to remember looking into mdoc's handling of em dashes a month or two 
> ago, and concluding that mdoc did not handle em dashes at all.  That is, I 
> did not see any macros that attempted to render as a dash of any type, so 
> that the man page author is required to hard code a dash as either one or two 
> (or three, I suppose) hyphens.
>
> A scan of the prior art suggested that most existing instances use a single 
> hyphen, and the double hyphen is quite rare.

I thought the double hyphen was used more.  A single hyphen is especially
bad for em-dash in C and math ASCII text since it normally means a minus
sign.

> Warren did note that it is probably best to write in a style that avoids the 
> need for the em dash, which I cannot really argue against.
>
> Bruce, do you have any details you can add about mdoc's interaction with em 
> (or en) dashes?

I just noticed that old gnu man pages use double dashes more, and ones that
haven't been fully translated to mdoc even have a macro for it.  E.g., from
patch.1:

%%%
'\"
'\"     Set up \*(-- to give an unbreakable dash;
'\"     string Tr holds user defined translation string.
'\"     Bell System Logo is used as a dummy character.
'\"
.if !d Tr .ds Tr
.ie n \{\
.tr \(*W-\*(Tr
.ds -- \(*W-
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br \}
.el \{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
%%%

I don't understand the syntax for this.  patch.1 actually uses double
dashes (not em-dashes) a lot for gnu-style options.  In the old version,
the source code for the -c option is:

.B "\-c, \-\-context"

Lots of hard-coding there, in a way that disguises the double dashes
(I missed this at first by grepping for "\--").

In the current version, the corresponding source code is:

.It Fl c, Fl Fl context

Bruce


More information about the freebsd-doc mailing list