aboutsummaryrefslogtreecommitdiff
path: root/example.t
blob: 5f9789f9ec05bb04e587fc43c6f8dc5900b7ef52 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
.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.	\c
It is designed to be easy to understand and to customize
by editing the source code.
.p
2.	\c
It makes use of the extended support for environments
offered by many modern troff implementations.
.p
3.	\c
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 (and its user) would need to keep track of.
For example,
.i ms
keeps track of the document's font size in the
.i 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:
.l
.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:
.l
.cc ,
.fam N
.t
Document title
.p
First paragraph.
,cc
.p
In addition to the normal environment-relevant settings,
.i mg
manually associates a few special registers with the current environment:
.p
1.	\c
.c sp ,
the amount of vertical space to add before environment.
.p
2.	\c
.c ti ,
the indentation of the first line in the environment.
.p
These can be set inside a given environment
to control its behavior when invoked.