Commit Graph

21 Commits

Author SHA1 Message Date
G. Branden Robinson
46fbe4cd00 tmac/tmac.an*: work around formatter bug
...when rendering some man pages, such as those of ncurses.

I did not manage (nor seriously attempt) to identify the root cause of
this bug.  ncurses's use of `SH` and `SS` man(7) macros is
unremarkable.[1]  I cannot account for why the less(1) man page renders
fine and ncurses pages like insstr(3) do not.  But render badly they do,
emitting *roff logic as formatted output.

```
$ 9 nroff -man $(man -w insstr) | grep -F .ss | cat -v
     "'''if^GNAME^GSYNOPSIS^G .ss 18 NAME
     "'''if^GSYNOPSIS^GSYNOPSIS^G .ss 18 SYNOPSIS
     "'''if^GDESCRIPTION^GSYNOPSIS^G .ss 18 DESCRIPTION
     "'''if^GRETURN^GSYNOPSIS^G .ss 18 RETURN VALUE
     "'''if^GNOTES^GSYNOPSIS^G .ss 18 NOTES
     "'''if^GEXTENSIONS^GSYNOPSIS^G .ss 18 EXTENSIONS
     "'''if^GPORTABILITY^GSYNOPSIS^G .ss 18 PORTABILITY
     "'''if^GHISTORY^GSYNOPSIS^G .ss 18 HISTORY
     "'''if^GSEE^GSYNOPSIS^G .ss 18 SEE ALSO
```

With this patch:

```
$ 9 nroff -man $(man -w insstr) | grep -F .ss | cat -v | grep . || echo NO OUTPUT
NO OUTPUT
```

I do observe that the problem seems to correspond to the only use in the
package of the old-fashioned `'''` commenting convention _within a macro
definition_.  I have a notion of how GNU troff works, but little about
AT&T troff.  That said, if I were to try to get to the bottom of this
problem, I'd look into if and how the no-break command character is
handled differently in copy mode.  I see nothing in CSTR #54 to suggest
that the command characters have different meanings in copy mode and its
complement.[2]

My solution is to use idiomatic comment syntax inside macro definitions.

[1] d5dc8a4a7c/man/curs_insstr.3x (L47)

[2] unnamed in AT&T documentation but which I term "interpretation mode"
    in groff
2025-10-26 19:03:55 -04:00
G. Branden Robinson
e5b5757e64 tmac/tmac.an*: support lq, rq strings
The `lq` and `rq` strings are not a groffism, but _almost_ universally
portable to man(7) renderers.

They originate in 4BSD (1980).[1]  They entered Unix System V with SVR4
(1988 or 1989).[2]  mandoc(1) has supported them since its inception.[3]

* tmac/tmac.an:
* tmac/tmac.antimes: Do it.  Use U+201C and U+201D if the output device
  is "utf", otherwise define them as `` and ''.  Don't define them as
  `"` because that breaks when interpolating the strings in macro
  arguments.[4]

[1] https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/lib/tmac/tmac.an.new
[2]
e68293af91/sysvr4/svr4/ucbcmd/troff/troff.d/tmac.d/an (L46)
[3] https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mandoc/predefs.in?rev=1.1&content-type=text/x-cvsweb-markup
[4] https://www.gnu.org/software/groff/manual/groff.html.node/Calling-Macros.html

   "For the (neutral) double quote, you have recourse to an obscure
   syntactical feature of AT&T troff. ..."
2025-10-10 13:44:47 -04:00
Dmitri Vereshchagin
10564b1175 tmac/tmac.an: define .MR in a groff compatible way
groff 1.23.0 added .MR to its -man macro package.  The NEWS file states
that the inclusion of the macro "was prompted by its introduction to
Plan 9 from User Space's troff in August 2020."  From d32deab it seems
that the name for Plan 9 from User Space's implementation was suggested
by groff maintainer G. Brandon Robinson.

Not sure if the intention was to make these definitions compatible, but
it would be nice if they were.

Currently, Plan 9 from User Space's .MR expects its second argument to
be parenthesized.  groff's .MR does not.  This results in extra
parentheses appearing in manual references when viewing Plan 9 from User
Space's manual pages on a system using groff.
2025-07-27 09:58:50 -04:00
Anthony Sorace
a5d6857a3b man: don't paginate when using nroff
This tells bin/man to set the register L to very high to avoid pagination
and updates tmac/tmac.an to use that value, if it's set, to set the page
length. This is per Plan 9's rc/bin/man and sys/lib/tmac/tmac.an.
2025-01-29 15:55:23 -05:00
Russ Cox
d32deab17b tmac: rename IM (italic manual) to MR (manual reference)
Suggested by G. Brandon Robinson.
2020-08-15 20:09:40 -04:00
Russ Cox
977b25a76a tmac: introduce real manual reference macro instead of overloading IR
The overloading of IR emits magic \X'...' sequences that turn into HTML manual links.
But not all such IR invocations should be manual links;
those had to be written to avoid the IR macro before.
Worse, the \X'...' ending the IR causes troff to emit only a single space after a period.

Defining a new IM macro for manual references fixes both problems.

Fixes #441.
2020-08-13 23:43:43 -04:00
Russ Cox
9962d916e8 tmac: fix troff -ms .KS after .1C
Fixes #233.
2020-01-13 18:26:15 -05:00
Russ Cox
fa580e2116 tmac.an: insert spaces after .?? request names 2008-11-11 11:01:03 -08:00
rsc
e861a5bd32 new from plan 9 2006-05-06 22:51:12 +00:00
rsc
dc4f9bcdd0 new fonts 2006-03-19 06:03:19 +00:00
rsc
c42a1d3d61 add 2006-02-21 18:37:05 +00:00
rsc
9847210bcb Add tmac.pm. 2005-09-13 00:17:07 +00:00
rsc
6dfc49d2a8 set HT to 1 in html mode 2005-03-18 19:34:37 +00:00
rsc
0215fd56db better HR 2005-01-16 21:31:47 +00:00
rsc
5940cb844b better href 2005-01-14 20:14:08 +00:00
rsc
78e51a8c66 checkpoint 2005-01-14 03:45:44 +00:00
rsc
c8b6342d3c Many small edits. 2005-01-13 04:49:19 +00:00
rsc
530d001641 add \*9 string 2005-01-11 17:39:45 +00:00
wkj
218dae2733 Patch paths. 2004-05-17 02:20:47 +00:00
wkj
6cc703dc9a For mpm. 2004-05-16 08:06:20 +00:00
rsc
13f7391e4a More files! 2004-05-15 23:45:13 +00:00