From 2b13496ba345d8db134b39ebf77c0c4270cbd9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 20 Jun 2021 10:53:13 +0200 Subject: example.t: Add FAQ --- example.t | 94 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/example.t b/example.t index 8546f4a..63db743 100644 --- a/example.t +++ b/example.t @@ -1,5 +1,18 @@ .so g.tmac . +. \" configure environments +._e p +. nr sq \n(sp +. nr sp 0 +._e l +. fam M +. vs +1p +._e e +. _ec p +. ta 3n +3n +3n +3n +._e +. +. \" define macros .eo .de e . if !'\$1'' \{\ @@ -17,22 +30,12 @@ .. .ec . -._e p -._e l -. fam M -. vs +1p -._e e -. _ec p -. nr sq \n(sp -. nr sp 0 -. ta 3n +3n +3n +3n -._e . +. \" start document .t .x Mg , a simple macro package for troff -.n -John Ankarstr\[u00F6]m +.d "John Ankarstr\[u00F6]m" .d . . @@ -80,6 +83,7 @@ are explained. The reader is encouraged to inspect the document's source code in order to see how the macro package is used in practice. . +. .h Environments .p @@ -87,27 +91,30 @@ Environments makes heavy use of named environments, supported by implementations such as GNU troff and Neatroff. Environments obliviate the need for many special registers -that a macro package (and its user) would need to keep track of. +that a macro package (and its user) would otherwise need to keep track of. For example, .i ms keeps track of the document's font size in the .c PS register. -.i Mg , -on the other hand, -simply sets the font size inside the environment named -.c p -(for paragraph). +For the font size of headings, +it has yet another register. +.i Mg +has no such registers. If the user wishes to modify the default font size, -he or she can simply switch to the -.c p -environment and set the font size as desired: +he or she can simply switch to the relevant environment +and set the font size as desired +using regular troff requests: .l \&.\\" set heading font \&.h \&.fam H \&.ps +1p .p +Troff saves the font settings in the environment, +so that the next time the environment is invoked, +the desired font family and point size are automatically restored. +.p The environments are initialized as soon as the first .q block-level @@ -165,9 +172,9 @@ the margin at the top of the page .c mb , the margin at the bottom of the page . +. .h External macros -. .p .i Mg defines a number of macros. @@ -228,9 +235,6 @@ heading .c l , literal display (for source code) .e -.c n , -centered name of author -.e .c p , paragraph .e @@ -296,6 +300,7 @@ In such cases, the reference will simply appear on the page following the footnote. When this happens, the user must account for it manually. . +. .h Internal macros .p @@ -310,3 +315,42 @@ and which are a group of macros controlling the environment, as it may be desirable to define custom environments for advanced documents. +. +. +.h +Frequently anticipated questions +. +.s +How do I set the default font family, point size, indentation etc. +of a document? +.p +All environment settings\c +.( +For a complete list of settings that are associated with the environment, +see 5.26\ Environments in the full GNU troff manual +.nh +.c "info '(groff.\:info)Environments'" ). ( +.hy +.) +such as these +are configured with the standard troff requests. +If you set the point size at the beginning of the document, +before any +.i mg +macros have been called, +it will be correctly set for the entire document. +This works because +.i mg 's +environments initially copy all their settings from 0, +the default environment. +.p +For example, if you wanted to write a document +with the New Century Schoolbook font +at 9 points +and a vertical spacing of 12 points, +you would start the document like this: +.l +\&.so g.tmac \\" include mg +\&.fam N +\&.ps 9p +\&.vs 12p -- cgit v1.2.3