From d94ad4fa110662b6d6f3b72f47173830864f46df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 17 Jun 2021 21:07:22 +0200 Subject: Improve --- example.mg | 29 +++++++++++++++++++++++------ g.tmac | 43 +++++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/example.mg b/example.mg index 25cf934..5e8d505 100644 --- a/example.mg +++ b/example.mg @@ -1,21 +1,38 @@ .so g.tmac -.t 2 -.x mg , +.t +.x Mg , a simple macro package for troff .n John Ankarström .d .p -.e mg -is a simple macro package for troff. +.i Mg +is a simple macro package for troff with the following features: +.p +1. It is designed to be easy to understand and to customize by editing the source code. +.p +2. It makes use of the extended support for environments offered by many modern troff implementations (but it can be made compatible with the original troff if need be). .p -It is also designed to be practically easy to use. -Macros are consistently one letter long and written in lowercase. +3. +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. .p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/g.tmac b/g.tmac index eb17536..f9707ef 100644 --- a/g.tmac +++ b/g.tmac @@ -2,31 +2,30 @@ .\" _s -- setup document (configurable) .de _s . sp 1i -. _d t \" title +. ns +. _e t \" title . ps +4p . vs +2p . ft B . ad c -. _d n \" name (of author) +. _e n \" name (of author) +. nr n_mt 0.9v . ad c -. _d d \" date +. _e d \" date +. nr d_mt 0.4v . ad c -. _d p \" paragraph +. _e p \" paragraph +. nr p_mt 0.3v . ad b -. _d +. _e .. -.\" _d -- define environment -.de _d -. if !'\n[.ev]'0' .ev -. if !'\$1'' .ev \$1 -.. -.\" _e -- enter environment +.\" _e -- set environment .de _e -.br +. br . if !'\n[.ev]'0' .ev . ds penv \*[env] . ds env \$1 -. ev \$1 +. if !'\$1'' .ev \$1 .. .\" t -- title .de t @@ -36,13 +35,13 @@ .de n . br . _e n -. sp 0.3v +. sp \n[n_mt]u .. .\" d -- date .de d . br . _e d -. sp 0.3v +. sp \n[d_mt]u . af mo 00 . af dy 00 . ie '\$1'' \n[year]-\n(mo-\n(dy @@ -54,17 +53,17 @@ .de p . br . _e p -. sp 0.3v -. if '\*[penv]'t' .sp 0.5v -. if '\*[penv]'n' .sp 0.5v -. if '\*[penv]'d' .sp 0.5v +. ie '\*[penv]'t' .sp 1v +. el .ie '\*[penv]'n' .sp 1v +. el .ie '\*[penv]'d' .sp 1v +. el .sp \n[p_mt]u . if '\*[penv]'p' \h'0.5c' .. -.\" e -- emphasis -.de e +.\" i -- italic +.de i \$3\fI\$1\fP\$2 .. -.\" x -- extra emphasis +.\" x -- bold italic .de x \$3\f(BI\$1\fP\$2 .. -- cgit v1.2.3