diff options
Diffstat (limited to 'example.t')
-rw-r--r-- | example.t | 182 |
1 files changed, 166 insertions, 16 deletions
@@ -1,27 +1,43 @@ .so g.tmac -.p -.ta 3n +3n +3n +3n +. +. _e p +. nr sq \n(sp +. nr sp 0 +. _e +. +._e e +. _ec p +. ta 3n +3n +3n +3n +._e +. +.de e +. nr ei \\$1+1 +. br +. _e e +. ti \n(tiu +\\n(ei. \c +.. +. .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 +.e 0 It is designed to be easy to understand and to customize by editing the source code. -.p -2. \c +.e It makes use of the extended support for environments offered by many modern troff implementations. -.p -3. \c +.e It is designed to be practically easy to use. Macros are consistently one letter long and written in lowercase. .p @@ -35,8 +51,9 @@ Users of .i mg are encouraged to modify the source code according to their own needs. -.s -Internal design +. +.h +Environments .p .i Mg makes heavy use of named environments, @@ -92,14 +109,147 @@ First paragraph. In addition to the normal environment-relevant settings, .i mg manually associates a few special registers with the current environment: -.p -1. \c +.e 0 .c sp , -the amount of vertical space to add before environment. -.p -2. \c +the amount of vertical space to add before an environment +.e +.c sq , +the amount of vertical space to add before a different type of environment +.e .c ti , -the indentation of the first line in the environment. +the indentation of the first line in some environments +(currently only +.c p ) .p These can be set inside a given environment to control its behavior when invoked. +The only exception is the footnote environment +.c _f ), ( +which is treated specially +and does not support these registers. +. +. +.h +Macros +. +.p +.i Mg +defines a number of macros. +Some of them are used internally by +.i mg +itself; +these carry an underscore prefix +and are not explained here. +The rest provide useful features, +like headings, subheadings and paragraphs. +.s +Inline macros +.p +There is a group of macros that provide +convenient inline formatting. +All take three arguments: +the text to be formatted, +the text to be placed immediately after +and the text to be placed immediately before. +The inline macros are the following: +.e 0 +.c b , +bold font +.e +.c c , +constant-width font +.e +.c i , +italic font +.e +.c i , +bold italic font +.p +For example, the following request outputs +.i mg .\(rq: \(lq +.l +\&.i mg . +. +.p +Note that +.c c +uses the font family and point size +set in the +.c l +environment (see below). +.s +Block-level macros +.p +There is a large group of macros that provide +block-level formatting: +.e 0 +.c d , +centered date (or given string) +.e +.c h , +heading +.e +.c l , +literal display (for source code) +.e +.c n , +centered name of author +.e +.c p , +paragraph +.e +.c s , +subheading +.e +.c t , +centered title of document +. +.s +Other macros +.p +Finally, there are a few macros +that belong to neither category. +.e 0 +.c q , +quotation +.e +.c ( , +begin footnote +.e +.c ) , +end footnote +.p +By default, +.c q +behaves like an inline macro, +surrounding text in quotation marks, +but if no arguments are given to it, +it starts an indented block quotation instead. +.p +The footnote macros are used like this\c +.( +Note that +.c ( +and +.c ) +take an optional argument, +which is output immediately before or after +the footnote number. +.) : +.l +.eo +.cc , +a line of text\c +.( +a footnote +.) . +,cc +.ec +.p +Note that +.i mg +does not account for cases where a footnote, because of its height, +pushes the place where it is referenced to the next page. +In such cases, the reference will simply appear on the page +following the footnote. +When this happens, the user must account for it manually. |