doc/Guidebook.mn: Use idiomatic *roff features
Stop trying to deduce whether the document is being formatted for a typesetter (a device that can use proportional fonts) or a terminal (a device that generally can't) by asking the formatter to measure formatted texts. Instead, use the built-in `n` and `t` conditions that nroff and troff have supported for this purpose since 1976 at the latest. All known troff implementations support these. https://www.gnu.org/software/groff/manual/groff.html.node/Operators-in-Conditionals.html
This commit is contained in:
+10
-18
@@ -27,14 +27,11 @@
|
|||||||
.
|
.
|
||||||
.so tmac.nh \" extra macros which aren't in tmac.n
|
.so tmac.nh \" extra macros which aren't in tmac.n
|
||||||
.
|
.
|
||||||
.\" \n(fF=1: fixed-width font (Guidebook.txt), =0: proportional-width font
|
|
||||||
.nr fF (\w'f'p)=(\w'F'p) \" compare width of 'f' to that of 'F'
|
|
||||||
.
|
|
||||||
.\" building Guidebook.txt doesn't have CR font available; groff 1.23 issues
|
.\" building Guidebook.txt doesn't have CR font available; groff 1.23 issues
|
||||||
.\" a warning each time any font can't be loaded; earlier versions silently
|
.\" a warning each time any font can't be loaded; earlier versions silently
|
||||||
.\" proceeded so lack of CR (fixed-width, moot for plain text) didn't matter
|
.\" proceeded so lack of CR (fixed-width, moot for plain text) didn't matter
|
||||||
.if \n(fF .do ftr CR R \" if using fixed-width, substitute R for CR
|
.if n .do ftr CR R \" if formatting for a terminal, substitute R for CR
|
||||||
. \" (the substitution affects both '\f' and '.ft')
|
. \" (the substitution affects both '\f' and '.ft')
|
||||||
.
|
.
|
||||||
.ds h0 "NetHack Guidebook
|
.ds h0 "NetHack Guidebook
|
||||||
.ds h1
|
.ds h1
|
||||||
@@ -3315,7 +3312,7 @@ and to limit the number of questions during disclosure.
|
|||||||
Listed here roughly in order of difficulty and not necessarily in the order
|
Listed here roughly in order of difficulty and not necessarily in the order
|
||||||
in which you might accomplish them.
|
in which you might accomplish them.
|
||||||
.\" Vary the output between Guidebook.txt and Guidebook.{ps,pdf}
|
.\" Vary the output between Guidebook.txt and Guidebook.{ps,pdf}
|
||||||
.ie \n(fF \{\
|
.ie n \{\
|
||||||
.\" fixed-width font: default key width is fine;
|
.\" fixed-width font: default key width is fine;
|
||||||
.\" display longest entries (below) across two lines for Guidebook.txt
|
.\" display longest entries (below) across two lines for Guidebook.txt
|
||||||
.PS "Mines'\~End"
|
.PS "Mines'\~End"
|
||||||
@@ -3345,7 +3342,7 @@ Read a passage from a Discworld Novel.
|
|||||||
Entered Sokoban.
|
Entered Sokoban.
|
||||||
.PL "Big\~Room"
|
.PL "Big\~Room"
|
||||||
Entered the Big Room.
|
Entered the Big Room.
|
||||||
.ie \n(fF \{\
|
.ie n \{\
|
||||||
.PL "Soko-Prize"
|
.PL "Soko-Prize"
|
||||||
Explored to the top of Sokoban
|
Explored to the top of Sokoban
|
||||||
.br
|
.br
|
||||||
@@ -3392,7 +3389,7 @@ Never wore any armor.
|
|||||||
.PL Ascended
|
.PL Ascended
|
||||||
Delivered the Amulet to its final destination.
|
Delivered the Amulet to its final destination.
|
||||||
.PE
|
.PE
|
||||||
.if !\n(fF .in -5n \" undo proportional-width font-specific indentation
|
.if t .in -5n \" undo proportional-width font-specific indentation
|
||||||
.sp
|
.sp
|
||||||
.lp "Notes: "
|
.lp "Notes: "
|
||||||
.pg
|
.pg
|
||||||
@@ -3630,13 +3627,12 @@ Example:
|
|||||||
.pg
|
.pg
|
||||||
\ \" dummy paragraph to force some separation [.BR isn't working as intended]
|
\ \" dummy paragraph to force some separation [.BR isn't working as intended]
|
||||||
.pg
|
.pg
|
||||||
.SD n \" suppress indentation
|
.SD n \" begin display without indentation
|
||||||
Here is an example of configuration file contents:
|
Here is an example of configuration file contents:
|
||||||
.ED
|
.ED
|
||||||
.\" [conditional indentation; see description of NETHACKOPTIONS below]
|
.\" [conditional indentation; see description of NETHACKOPTIONS below]
|
||||||
.ds sD i \" assume proportional, indentation acceptable and preferred
|
.ds sD i \" typesetter; display indentation acceptable and preferred
|
||||||
.\" Check for fixed-width font; fF set up at top of file
|
.if n .ds sD n \" terminal; suppress indentation
|
||||||
.if \n(fF .ds sD n \" if same width, suppress indentation
|
|
||||||
.SD \*(sD \" string variable sD will expand to either 'i' or 'n'
|
.SD \*(sD \" string variable sD will expand to either 'i' or 'n'
|
||||||
.ft CR \" set font to constant-width Roman
|
.ft CR \" set font to constant-width Roman
|
||||||
# Set your character's role, race, gender, and alignment.
|
# Set your character's role, race, gender, and alignment.
|
||||||
@@ -3682,12 +3678,8 @@ you would enter the command
|
|||||||
.\" but the 'setenv' example is too wide for Guidebook.txt unless the
|
.\" but the 'setenv' example is too wide for Guidebook.txt unless the
|
||||||
.\" indentation is suppressed (.SD n). Even though the second example
|
.\" indentation is suppressed (.SD n). Even though the second example
|
||||||
.\" can be indented, it should match the first or they'll both look odd.
|
.\" can be indented, it should match the first or they'll both look odd.
|
||||||
.\" groff has a built-in register allowing recognition of '-T', but we
|
.ds sD i \" typesetter; display indentation acceptable and preferred
|
||||||
.\" can't rely on that. Assume Guidebook.ps uses a proportional font
|
.if n .ds sD n \" terminal; suppress indentation
|
||||||
.\" and Guidebook.txt a fixed-width one and test which sort we're using.
|
|
||||||
.ds sD i \" assume proportional, indentation acceptable and preferred
|
|
||||||
.\" Check for fixed-width font; fF set up at top of file
|
|
||||||
.if \n(fF .ds sD n \" if same width, suppress indentation
|
|
||||||
.SD \*(sD
|
.SD \*(sD
|
||||||
\f(CR% setenv NETHACKOPTIONS "color,\\!leg,name:Blue Meanie,fruit:lime"\fP
|
\f(CR% setenv NETHACKOPTIONS "color,\\!leg,name:Blue Meanie,fruit:lime"\fP
|
||||||
.ED
|
.ED
|
||||||
|
|||||||
Reference in New Issue
Block a user