diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-24 16:25:32 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-24 16:25:32 +0200 |
commit | b8fb8ad8ab2e5cbb245b35f20d050d50be2842d3 (patch) | |
tree | e8e2ca0bf6a0667da8ae690247d73ab9dd7a491f | |
parent | 5f1752fa417f32956827825d4cc4f09941d029b6 (diff) | |
download | mk-b8fb8ad8ab2e5cbb245b35f20d050d50be2842d3.tar.gz |
Change name to mu
It turns out that Heirloom troff includes an (m)g macro set for
groff compatibility.
I liked the name mg, because of the association with milligram,
but mu is pretty good too.
(And mu is the symbol for the SI micro prefix, which is even smaller
than milli!)
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README.pdf | bin | 59049 -> 59334 bytes | |||
-rw-r--r-- | README.t | 70 | ||||
-rw-r--r-- | hacking.pdf | bin | 24436 -> 24683 bytes | |||
-rw-r--r-- | hacking.t | 30 | ||||
-rw-r--r-- | t/Makefile | 10 | ||||
-rw-r--r-- | t/ne.t | 2 | ||||
-rw-r--r-- | toc/README.t | 4 | ||||
-rw-r--r-- | u.tmac (renamed from g.tmac) | 6 | ||||
-rw-r--r-- | ux.tmac (renamed from gx.tmac) | 2 |
10 files changed, 66 insertions, 62 deletions
@@ -3,10 +3,10 @@ PDFROFF ?= troff | dpost | ps2pdf - all: README.pdf hacking.pdf -hacking.pdf: hacking.t g.tmac +hacking.pdf: hacking.t u.tmac perl -pe '$$_=`$$_` if s/^\!//' hacking.t |\ $(PDFROFF) > hacking.pdf -README.pdf: README.t g.tmac +README.pdf: README.t u.tmac TROFFONTS=/usr/pkg/share/fonts/X11/TTF/ \ <README.t toc/toc $(PDFROFF) > README.pdf Binary files differ@@ -1,5 +1,5 @@ -.so g.tmac -.so gx.tmac +.so u.tmac +.so ux.tmac .so toc/toc.tmac .mediasize letter .fp 0 M DejaVuSansMono ttf @@ -69,7 +69,7 @@ . .\" start document .t -.x Mg , +.x µ , a simple macro package for troff .d John Ankarström @@ -87,7 +87,9 @@ John Ankarström . .he Introduction .p -.i Mg +.i µ +or +.i mu is a simple macro package for troff with the following features: .n 1 It is designed to be easy to understand and to customize @@ -100,13 +102,13 @@ It is designed to be practically easy to use. Macros consist of a single lowercase letter. .p While -.i mg +.i µ 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 +.i µ are encouraged to .n 1 a ) modify the source code @@ -116,19 +118,19 @@ use built-in troff requests for some things that other packages might provide custom macros for. .p All in all, -.i mg +.i µ aspires to abstract as little as possible from the underlying troff requests and registers. In its author's humble opinion, it is the ideal macro package for learning troff. .p In this document, the fundamental concepts of -.i mg +.i µ are explained. The document itself also serves as a demonstration of -.i mg . +.i µ . With a couple of exceptions, it uses -.i mg 's +.i µ 's default settings. The reader is encouraged to inspect the document's source code in order to see how the macro package is used in practice. @@ -137,7 +139,7 @@ in order to see how the macro package is used in practice. .he Environments .te .nr &env \n% .p -.i Mg +.i µ makes heavy use of named environments, supported by implementations such as GNU troff, Heirloom troff and Neatroff. Environments obliviate the need for many special registers @@ -149,7 +151,7 @@ keeps track of the document's font size in the register. For the font size of headings, it has yet another register. -.i Mg +.i µ has no such registers. If the user wishes to modify the default font size, he or she can simply switch to the relevant environment @@ -174,7 +176,7 @@ the default environment (0) is copied, meaning that all environment-relevant settings defined before the first macro call are applied to all -.i mg +.i µ environments. It is thus remarkably simple and intuitive to set, for example, the default font of a document: @@ -186,7 +188,7 @@ Document title First paragraph. .p In addition to the normal environment-relevant settings, -.i mg +.i µ manually associates a few special registers with the current environment: .n 1 .c sp , @@ -211,17 +213,17 @@ and do not support these registers. . .he External macros .p -.i Mg +.i µ defines a number of macros. Some of them are used internally by -.i mg +.i µ itself; these carry an at .c @ ) ( prefix and are going to be explored later. For now, we will focus on the external macros provided by -.i mg . +.i µ . .se Inline macros .p There is a group of macros that provide @@ -245,9 +247,9 @@ italic font bold italic font .p For example, the following request outputs -.i mg .\(rq: \(lq +.i µ .\(rq: \(lq .l -\&.i mg . +\&.i µ . . .p Note that @@ -372,7 +374,7 @@ and .c ) are called at such a position that the collected footnotes cannot fit on the current page, -.i mg +.i µ will print the footnotes on the next page instead. .p The @@ -403,7 +405,7 @@ which takes an exact amount of space as its argument, takes a declarative specification describing the amount of desired space in terms of -.i mg +.i µ environments. For example: .l @@ -415,9 +417,9 @@ For example: . .he Internal macros .p -.i Mg 's +.i µ 's internal macros are generally not meant to be used outside of -.i g.tmac . +.i u.tmac . Documented in this section are the exceptions to this rule. For examples of how these macros are used in practice, see the FAQ section on page \n[&faq]. @@ -433,7 +435,7 @@ and macros control the page header and footer. .p At document initialization, -.i mg +.i µ automatically creates traps for .c @th and @@ -448,7 +450,7 @@ and .c @t , which control the text and spacing of the header and footer. .p -.i Mg +.i µ will avoid creating a trap for .c @tf if any trap has already been set before document initialization. @@ -486,7 +488,7 @@ are equivalent to troff's and .c evc , but perform some extra work to keep track of -.i mg 's +.i µ 's special environment variables (see .i Environments , @@ -512,11 +514,11 @@ in the full GNU troff manual are configured with the standard troff requests. If you set the point size at the beginning of the document, before any -.i mg +.i µ macros have been called, it will be correctly set for the entire document. This works because -.i mg 's +.i µ 's environments initially copy all their settings from 0, the default environment. .p @@ -526,7 +528,7 @@ at 9 points and a vertical spacing of 12 points, you would start the document like this (before you call any -.i mg +.i µ macros): .l \&.fam N @@ -605,7 +607,7 @@ To change the contents of the footer: Some macro packages have a concept of .q keeps , sections that are kept together across page breaks. -.i Mg +.i µ does not (at least yet) define any such macros by default. The simplest solution is to use troff's .c ne @@ -616,7 +618,7 @@ request: .p If you want to keep text of various styles together, you can use -.i mg 's +.i µ 's own .c w macro: @@ -641,7 +643,7 @@ Environments are a feature built into troff, accessed via the .c ev request, but because -.i mg +.i µ extends environments with additional functionality, it provides special macros to be used instead of .c ev : @@ -661,7 +663,7 @@ The .c @e macro can be used to activate any environment that supports -.i mg 's +.i µ 's extensions (see .i Environments , p. \n[&env]). @@ -683,7 +685,7 @@ and defines a corresponding macro: .se How do I include a table of contents in my document? .p Included with the -.i mg +.i µ distribution is a package called .i toc , which includes the following files: diff --git a/hacking.pdf b/hacking.pdf Binary files differindex b4c3f34..6e88531 100644 --- a/hacking.pdf +++ b/hacking.pdf @@ -1,4 +1,4 @@ -.so g.tmac +.so u.tmac . .de @h . sp |36p @@ -12,7 +12,7 @@ . .t Hacking on the -.x mg +.x µ macro package .d John Ankarström @@ -20,9 +20,11 @@ John Ankarström . .h What is -.x mg ? +.x µ ? .p -.i Mg +.i µ +or +.i mu is a simple macro package for troff designed to abstract as little as possible from troff itself, while still providing a powerful framework for @@ -31,23 +33,23 @@ writing advanced documents. . .h How is the source code of -.x mg +.x µ organized? .p If you run .c "grep -n [-]-" on the -.i g.tmac +.i u.tmac source file, you are presented with an overview of -.i mg 's +.i µ 's macros: .l .eo -!grep -n [-]- g.tmac +!grep -n [-]- u.tmac .ec .p This is a sufficient summary of the entire -.i mg +.i µ source code, as nothing is performed outside of these macros. All initialization is performed in the .c @a @@ -55,12 +57,12 @@ macro, which is automatically called at the first invocation of any other macro. .p The above summary reflects a categorization in the macros defined by -.i mg . +.i µ . There are internal and external macros. The former are to be used within -.i g.tmac +.i u.tmac itself, while the latter are to be used in -.i mg +.i µ documents. Among the external macros, there are inline, environment (or block-level), hybrid and other macros. @@ -90,7 +92,7 @@ Where is document state stored? .p Most state is stored by troff itself within the different environments. In addition, -.i mg +.i µ associates three extra registers with each environment: .c sp , the amount of space to be added by @@ -158,5 +160,5 @@ contains the total number of collected footnotes. .p Note that none of these registers and strings should be directly accessed or modified by -.i mg +.i µ documents. @@ -6,13 +6,13 @@ PDFROFF ?= troff | dpost | ps2pdf - all: $(TEST) -g.tmac: ../g.tmac - cp g.tmac g.tmac.orig - grep -v '^\. *w ' ../g.tmac > g.tmac +u.tmac: ../u.tmac + cp u.tmac u.tmac.orig + grep -v '^\. *w ' ../u.tmac > u.tmac -.t.T: g.tmac t.tmac +.t.T: u.tmac t.tmac @echo -- $< ----------------------- @<$< $(TROFF) >/dev/null -.t.pdf: g.tmac t.tmac +.t.pdf: u.tmac t.tmac <$< $(PDFROFF) > $@ @@ -1,4 +1,4 @@ -.so g.tmac +.so u.tmac .so t.tmac . .nr mb 1i diff --git a/toc/README.t b/toc/README.t index b561486..62cebaa 100644 --- a/toc/README.t +++ b/toc/README.t @@ -1,5 +1,5 @@ -.so ../g.tmac -.so ../gx.tmac +.so ../u.tmac +.so ../ux.tmac .so toc.tmac . .t @@ -1,5 +1,5 @@ .\" "/. -.\" mg macro package for troff "/. +.\" mu macro package for troff "/. .\" created by John Ankarström "/. .\" "/. .\" Permission to use, copy, modify and/or "/. @@ -7,9 +7,9 @@ .\" with or without fee is hereby granted. "/. .\" "/. .\" For an index of the macros defined in "/. -.\" this file, issue `grep -n [-]- g.tmac'. "/. +.\" this file, issue `grep -n [-]- u.tmac'. "/. .\" "/. -.\" When editing the source of mg, keep the "/. +.\" When editing the source of mu, keep the "/. .\" following rules in mind: "/. .\" "/. .\" * Prefix temporary strings and registers "/. @@ -1,5 +1,5 @@ .\" "/. -.\" extra stuff for mg "/. +.\" extra stuff for mu "/. .\" "/. .\" Permission to use, copy, modify and/or "/. .\" distribute this software for any purpose "/. |