aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-22 21:26:49 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-22 21:26:49 +0200
commit92ab79cc00be5fb01a07f3381efdc3fc9bdc2348 (patch)
tree1532122453b29abea1bc37aecaae2dbab2abf78e
parenta85c6cc8b1f445883389fc65fa170b538291b7d6 (diff)
downloadmk-92ab79cc00be5fb01a07f3381efdc3fc9bdc2348.tar.gz
example.t: Add table of contents
-rw-r--r--Makefile4
-rw-r--r--example.pdfbin85083 -> 85294 bytes
-rw-r--r--example.t34
-rw-r--r--t/Makefile2
4 files changed, 27 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index cc656ae..da50c12 100644
--- a/Makefile
+++ b/Makefile
@@ -4,5 +4,5 @@ hacking.pdf: hacking.t g.tmac
perl -pe '$$_=`$$_` if s/^\!//' hacking.t |\
groff -Tps | ps2pdf - > hacking.pdf
-example.pdf: hacking.pdf g.tmac
- groff -Tps example.t | ps2pdf - > example.pdf
+example.pdf: example.t g.tmac
+ toc/groc example.t | ps2pdf - > example.pdf
diff --git a/example.pdf b/example.pdf
index 3c62d7d..95c2bb4 100644
--- a/example.pdf
+++ b/example.pdf
Binary files differ
diff --git a/example.t b/example.t
index 8a1033c..d2b9f1c 100644
--- a/example.t
+++ b/example.t
@@ -1,4 +1,5 @@
.so g.tmac
+.so toc/toc.tmac
.
.\" configure header and footer
.eo
@@ -28,6 +29,22 @@
.
.\" define macros
.eo
+.de he
+. h
+\$*
+. tm .the \n% \$*
+..
+.
+.de the
+. nr _ \$1
+. shift
+. ta 0 \n(.luR
+. tc .
+\$* \n_
+. tc
+. br
+..
+.
.de n
. if !'\$1'' \{\
. nr ni \$1-1
@@ -52,9 +69,10 @@ a simple macro package for troff
John Ankarstr\(:om
.d e
.
+.p
+.to
.
-.h
-Introduction
+.he Introduction
.p
.i Mg
is a simple macro package for troff with the following features:
@@ -98,8 +116,7 @@ The reader is encouraged to inspect the document's source code
in order to see how the macro package is used in practice.
.
.
-.h
-Environments
+.he Environments
.p
.i Mg
makes heavy use of named environments,
@@ -173,8 +190,7 @@ which are treated specially
and do not support these registers.
.
.
-.h
-External macros
+.he External macros
.p
.i Mg
defines a number of macros.
@@ -381,8 +397,7 @@ For example:
\&.w ss p \\" a subheading of two lines + a paragraph of one line
.
.
-.h
-Internal macros
+.he Internal macros
.p
.i Mg 's
internal macros are generally not meant to be used outside of
@@ -464,8 +479,7 @@ special environment variables
above).
.
.
-.h
-Frequently anticipated questions
+.he Frequently anticipated questions
.
.s
How do I customize the default appearance of a document?
diff --git a/t/Makefile b/t/Makefile
index 58e5d3d..122da6d 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -9,7 +9,7 @@ g.tmac: ../g.tmac
.t.T: g.tmac t.tmac
@echo -- $< -----------------------
- @groff -Tps $< >/dev/null
+ @groff -z $<
.t.pdf: g.tmac t.tmac
groff -Tps $< | ps2pdf - > $@