aboutsummaryrefslogtreecommitdiff
path: root/example.t
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-22 15:00:53 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-22 15:00:53 +0200
commitd5c03c9d88143bb1fd803f25198b48f42ab9d9a7 (patch)
tree0c66c9b455b96f04ef009c82dde10ce3db75d2ef /example.t
parent9dcab3a30d499f6fed5db56e34636610366cff37 (diff)
downloadmk-d5c03c9d88143bb1fd803f25198b48f42ab9d9a7.tar.gz
Remove all configuration registers (mt, mb, tt, tb)
Diffstat (limited to 'example.t')
-rw-r--r--example.t155
1 files changed, 102 insertions, 53 deletions
diff --git a/example.t b/example.t
index 2fc9bd1..87f6bd0 100644
--- a/example.t
+++ b/example.t
@@ -1,5 +1,16 @@
.so g.tmac
.
+.de @h
+. sp |36p
+. tl ''-%-''
+. sp |1i
+..
+.
+.de @f
+. sp |\\n(.pu-48p
+. tl ''\\*(%e''
+..
+.
. \" configure environments
.@e p
. nr sq \n(sp
@@ -160,42 +171,6 @@ and do not support these registers.
.
.
.h
-Global settings
-.p
-Thanks to the reliance on environments,
-there are only four global string values
-controlling the state of
-.i mg :
-.n 1
-.c mt ,
-the margin at the top of the page
-.n
-.c mb ,
-the margin at the bottom of the page
-.n
-.c tt ,
-the text in the top margin
-.n
-.c tb ,
-the text in the bottom margin
-.p
-The
-.c tt
-and
-.c tb
-registers are passed to troff's
-.c tl
-request and should be formatted accordingly.
-By default,
-.c tt
-is empty and
-.c tb
-is set to
-.c ''%'' ,
-displaying the page number in the center.
-.
-.
-.h
External macros
.p
.i Mg
@@ -298,6 +273,14 @@ international date, like
.c e :
English date, like
.q "21 June 2021"
+.p
+The date formats are defined in strings prefixed with a percent sign
+.c % ): (
+.c %i
+and
+.c %e
+are provided by default,
+but more may be added by the user.
.
.s
Other macros
@@ -337,6 +320,7 @@ For example, the following code
\&.q
This is a quotation\\c
\&.(
+.ne 1
This is a footnote.
\&.) .
.p
@@ -347,12 +331,14 @@ This is a quotation\c
This is a footnote.
.) .
.p
-.i Mg
-does not account for cases where a footnote, because of its height,
-pushes the place where it is referenced to the next page.
-In such cases, the reference will simply appear on the page
-following the footnote.
-When this happens, the user must account for it manually.
+If
+.c (
+and
+.c )
+are called at such a position that the collected footnotes
+cannot fit on the current page,
+.i mg
+will print the footnotes on the next page instead.
.p
The
.c q
@@ -398,14 +384,59 @@ Internal macros
.i Mg 's
internal macros are generally not meant to be used outside of
.i g.tmac .
+Documented in this section are the exceptions to this rule.
+For examples of how these macros are used in practice,
+see the FAQ section below.
+.
+.s
+Margin macros
+.p
+The
+.c @h ,
+.c @f ,
+.c @th
+and
+.c @tf
+macros control the page header and footer.
+.p
+At document initialization,
+.i mg
+automatically creates traps for
+.c @th
+and
+.c @tf .
+When sprung,
+.c @th
+and
+.c @tf
+call
+.c @h
+and
+.c @t ,
+which control the text and spacing of the header and footer.
+.p
+.i Mg
+will avoid creating a trap for
+.c @tf
+if any trap has already been set before document initialization.
+This means that users can override the position of the
+.c @tf
+trap by setting it themselves.
+Likewise, users can redefine
+.c @h
+and
+.c @f
+to change the content of the header and footer.
+.
+.s
+Environment macros
+.p
The environment-related macros
.c (e ,
.c @e
and
.c @c
-are, however, excepted from this rule,
-as it may be desirable to define custom environments
-for advanced documents.
+may be used in advanced documents to define custom environments.
.p
At the present,
.c (e
@@ -428,14 +459,6 @@ special environment variables
(see
.i Environments
above).
-.p
-For examples of how
-.c (e ,
-.c @e
-and
-.c @c
-are used in practice,
-see the FAQ section below.
.
.
.h
@@ -509,6 +532,32 @@ How do I customize the default appearance of footnotes?
\&.ps +1p
.
.s
+How do I redefine the page header?
+.l
+\&.de @h
+\&. \\" set position of header text
+\&. sp |36p
+\&. \\" set header text
+\&. tl 'left'center'right'
+\&. \\" set position of page text
+\&. sp |1i
+\&..
+.
+.s
+How do I redefine the page footer?
+.l
+\&.\\" set position of footer trap
+\&.\\" (must be done before any macros have been called)
+\&.wh -1i @tf
+\&.
+\&.de @f
+\&. \\" set position of footer text
+\&. \\" (must be below the footer trap)
+\&. sp |\\\\n(.pu-48p
+\&. tl 'left'center'right'
+\&..
+.
+.s
How do I prevent a section from being broken up by a page break?
.p
Some macro packages have a concept of