aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example.t9
-rw-r--r--g.tmac45
2 files changed, 43 insertions, 11 deletions
diff --git a/example.t b/example.t
index bee06da..5f9789f 100644
--- a/example.t
+++ b/example.t
@@ -42,10 +42,12 @@ Internal design
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.
+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 PS register.
+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
@@ -98,3 +100,6 @@ the amount of vertical space to add before environment.
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.
diff --git a/g.tmac b/g.tmac
index 3b5bbd6..6e69316 100644
--- a/g.tmac
+++ b/g.tmac
@@ -1,3 +1,9 @@
+.\"----------------------------"/.
+.\" MG MACRO PACKAGE FOR TROFF "/.
+.\" created by JOHN ANKARSTRÖM "/.
+.\" released under MIT LICENSE "/.
+.\"----------------------------"/.
+.
.eo \" disable backslash escapes
.
.\" Internal macros
@@ -50,11 +56,18 @@
. l \" literal display
. evc 0
. nr sp 0.3v
-. nr in 0.5c
. nf
. in 0.5c
. fam C
. ps -1p
+. vs -1p
+. q \" quotation
+. evc 0
+. nr sp 0.3v
+. nr ti 1c
+. in 0.5c
+. ps -1p
+. vs -1p
. _e
..
.
@@ -94,7 +107,6 @@
. \" save special environment variables
. if !'\n[.ev]'0' \{\
. nr \n[.ev]_sp \n(sp
-. nr \n[.ev]_in \n(in
. nr \n[.ev]_ti \n(ti
. ev
. \}
@@ -107,10 +119,8 @@
. if !'\$1'' \{\
. ev \$1
. nr sp \n[\n[.ev]_sp]
-. nr in \n[\n[.ev]_in]
. nr ti \n[\n[.ev]_ti]
. sp \n(spu
-. in \n(inu
. \}
.
. \" perform post-environment operations
@@ -138,17 +148,22 @@
.\" Inline macros
.\" -------------
.
-.\" i -- italic
+.\" b -- bold font
+.de b
+\$3\fB\$1\fP\$2
+..
+.
+.\" i -- italic font
.de i
\$3\fI\$1\fP\$2
..
.
-.\" x -- bold italic
+.\" x -- bold italic font
.de x
\$3\f(BI\$1\fP\$2
..
.
-.\" c -- constant-width
+.\" c -- constant-width font
.de c
\$3\c
. fam \*[cfam]
@@ -159,9 +174,21 @@
\$2
..
.
-.\" q -- quote
+.
+.\" Hybrid macros
+.\" -------------
+.
+.\" q -- quotation
.de q
-\$3\(lq\$1\(rq\$2
+.
+. \" inline quotation
+. ie !'\$1'' \$3\(lq\$1\(rq\$2
+.
+. \" block quotation
+. el \{\
+. _e q
+. ti \n(tiu
+. \}
..
.
.