aboutsummaryrefslogtreecommitdiff
path: root/example.t
blob: 1ea01b19d78d31dba201e65771c7d2b2ae2fe18f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.so g.tmac
.p
.ta 3n +3n +3n +3n
.t
.x Mg ,
a simple macro package for troff
.n
John Ankarstr\[u00F6]m
.d
.h
Introduction
.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.
.s
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:
.c
.eo
.cc ,
.\" set heading font
.h
.fam H
.ps +1p
,cc
.ec
.p
The environments are initialized
as soon as the first
.q block-level
macro is called.
At the initialization of each environment,
the default environment (0) is copied,
meaning that all environment-relevant settings
defined before the first macro call
are applied to all
.i mg
environments.
It is thus remarkably simple and intuitive to set,
for example, the default font of a document:
.c
.cc ,
.fam N
.t
Document title
.p
First paragraph.
,cc
.p
\&...