By escaping an apostrophe (single quotation mark) you create a right sngle quotation mark `, not an apostrophe '. IMO the only way to correctly replace an apostrophe (a plain ' also prints as a right single quotation mark accordingly to groff_char(7)) is to replace it with
\[aq]
The patch is attached.
The issue has been sbumitted to the Debian BTS:
http://bugs.debian.org/507673
proposed patch
Do you know if this works as expected with AT&T troff (on Solaris or whatever)?
I just tested on a Solaris box, and \[aq] does not produce an apostrophe with the troff there. I think the two-letter bracketed escape syntax maybe doesn't work at all with AT&T troff or its non-groff descendants.
So \[aq] is not a portable solution. There must be some way that's been used forever, since troff began, to represent an apostrophe -- some way other than \[aq]
Note that \(aq does not work as expected on Solaris either (it prints nothing).
I also note that groff_char(7) does not say that \[aq] is an apostrophe -- it says it is a "quote single - apostrophe quote". But I guess that actually does mean a straight single apostrophe -- decimal 39. That is what we actually want, right?
Anyway, I can't see that the groff docs provide any information on how to generate that in a portable way.
Any ideas?
No idea sorry. But if you take a look at the source of groff_char I find:
.\" groff
.if \n(.g
.\" non-groff
.if !\n(.g
Is this some kind of switch one can use? If yes, maybe this can be useful too for the other TROFF vs. GROFF issues/differences you were working on.
Seems so:
`\n[.g]'
Always 1. Macros should use this to determine whether they are
running under GNU `troff'.
I e-mailed the groff list to try to get some help with this. As far as I can see, \(aq should work as expected with the troff on OpenSolaris/SunOS. But it doesn't actually seem to.
Even if there is some alternative way that I can use to represent apostrophe on non-groff systems, the \n(.g conditional request thing is not going to help -- because I would need to do the condtional switching inline. That's one of the biggest deficiences in groff -- it has caused me problems in the past as well.
According to <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=458157>:
“With groff, what you want is \(aq. Unfortunately, that's groff-specific
and won't work with, for example, Solaris man.
Pod::Man adds:
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
to the preamble of the man page and then uses \*(Aq as the escape for
apostrophes in the man page.”
Is this a sufficiently portable solution? I’ve tested it on GNU and Solaris.
The Debian maintainer Daniel Leidert has added a patch to docbook-xsl 1.75.2+dfsg-3 that implements the same solution as Pod::Man. I have successfully tested a resulting manpage on both GNU and Solaris systems.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507673
Here’s the patch by itself. I believe it is now suitable for inclusion upstream:
http://web.mit.edu/andersk/Public/docbook-portable-apostrophe-fix.dpatch
A fix for this issue has been added to the current codebase.
Please test the fix with the latest snapshot from:
http://docbook.sourceforge.net/snapshots/
Thanks for the patch.
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).