aboutsummaryrefslogtreecommitdiff
path: root/example.t
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-18 08:45:15 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-18 08:45:15 +0200
commit782815777b64d40b71a1d8109fd1779ec71a23ef (patch)
tree13a4a34682095d8fad32ac02c428d8e00abd99dd /example.t
parentfed6c0da38983ac985b5fbac59edde8e9517623f (diff)
downloadmk-782815777b64d40b71a1d8109fd1779ec71a23ef.tar.gz
g.tmac: Re-organize code, implement h (heading) macro
Diffstat (limited to 'example.t')
-rw-r--r--example.t55
1 files changed, 55 insertions, 0 deletions
diff --git a/example.t b/example.t
new file mode 100644
index 0000000..3ca19bb
--- /dev/null
+++ b/example.t
@@ -0,0 +1,55 @@
+.so g.tmac
+.s
+.t
+.x Mg ,
+a simple macro package for troff
+.n
+John Ankarstr\[u00F6]m
+.d
+.p
+.i Mg
+is a simple macro package for troff with the following features:
+.p
+1.
+It is designed to be easy to understand and to customize
+by editing the source code.
+.p
+2.
+It makes use of the extended support for environments
+offered by many modern troff implementations
+(but it can be made compatible with the original troff if need be).
+.p
+3.
+It is designed to be practically easy to use.
+Macros are consistently one letter long and written in lowercase.
+.p
+While
+.i mg
+does provide macros for many common tasks,
+including footnotes,
+it is at the end of the day an idiosyncratic macro package,
+written to serve the author's personal needs.
+Users of
+.i mg
+are encouraged to modify the source code
+according to their own needs.
+.h
+Internal design
+.p
+.i Mg
+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 would need to keep track of.
+For example,
+.i ms
+keeps track of the document's font size in the PS register.
+.i Mg ,
+on the other hand,
+simply sets the font size inside the environment named
+.i p
+(for paragraph).
+If the user wishes to modify the default font size,
+he or she can simply switch to the
+.i p
+environment and set the font size as desired.