Added Cyg-Win

This commit is contained in:
Frank Harris 2026-06-06 18:46:40 -04:00
parent 82cbc206eb
commit 413c315806
10586 changed files with 3806249 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

View file

@ -0,0 +1,901 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Appendices</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
</tr>
</table>
<h1 id="appendices" class="docs">Appendices</h1>
<div style="width: 68%; margin: auto;">
<ul class="no-enumerator">
<li><a href="#fonts">Adding fonts to groff</a>
<ul style="margin-left: -.5em; list-style-type: disc">
<li><a href="#extending">Extending groff families / adding new families and fonts</a>
<ul style="margin-left: -.5em; list-style-type: circle">
<li><a href="#traditional">The traditional approach</a></li>
<li><a href="#simpler">The simpler way with mom</a></li>
</ul></li>
<li><a href="#steps">Step-by-step instructions</a></li>
<li><a href="#install-font">Automate the whole process &ndash; the install-font script</a></li>
</ul></li>
<li><a href="#codenotes">Some reflections on mom</a></li>
<li><a href="#contact">Contact the author</a></li>
</ul>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="fonts" class="docs">Adding fonts to groff</h2>
<div id="small-note" class="box-tip">
<p class="tip-top">
<kbd>&lt;prefix&gt;</kbd>, in this section, refers
to the directory in which groff is installed, typically
<br/>
<span class="pre-in-pp">
/usr/share/groff/
</span>
(for distro-specific, pre-compiled groff packages) or
<br/>
<span class="pre-in-pp">
/usr/local/share/groff/
</span>
(if you&#8217;ve built groff from source).
</p>
<p class="tip-bottom">
<kbd>&lt;version&gt;</kbd> refers to the groff version number, which
can be found, if necessary, by typing
<br/>
<span class="pre-in-pp">
groff -v
</span>
at the command line.
</p>
</div>
<p>
Groff comes with a small library of
<a href="definitions.html#family">families</a>
(see the
<a href="typesetting.html#family">FAMILY</a>
macro for a list). The families have four
<a href="definitions.html#font">fonts</a>
associated with them. These fonts are a combination of
<a href="definitions.html#weight">weight</a>
and
<a href="definitions.html#shape">shape</a>:
<br/>
<span class="pre-in-pp">
R (Roman, usually Medium weight),
I (Italic, usually Medium weight),
B (Bold, usually Roman shape) and
BI (Bold Italic)
</span>
If you work with mom a lot, sooner or later you&#8217;ll find that these
families and their associated fonts aren&#8217;t sufficient. You&#8217;ll
want to supplement them, either with more fonts for the families
already provided&mdash;<i>Damn! I need Helvetica Bold Condensed
Italic</i>&mdash;or with entire new families.
</p>
<h3 id="extending" class="docs">Extending groff families / adding new families and fonts</h3>
<h4 id="traditional" class="docs">The traditional approach</h4>
<p>
The traditional approach to extending groff families has been
to create new families for non-default weights and shapes (e.g.
<b>Light</b>, which is a
<a href="definitions.html#weight">weight</a>,
or <b>Condensed</b>, which is a
<a href="definitions.html#shape">shape</a>),
then to associate them with groff&#8217;s predefined <b>R,
I, B</b> and <b>BI</b> font styles. An example of this
can be seen in the groff PostScript font library itself, which is
found in
<br/>
<span class="pre-in-pp">
&lt;prefix&gt;/&lt;version&gt;/font/devps/
</span>
There&#8217;s one &#8220;family&#8221; for Helvetica (<b>HR</b>,
<b>HI</b>, <b>HB</b>, <b>HBI</b>) and another for Helvetica Narrow
(<b>HNR</b>, <b>HNI</b>, <b>HNB</b>, <b>HNBI</b>).
</p>
<p>
The difficulty with this approach is that typographers tend to
think of families as referring to the entire set of font weights
and shapes associated with a family name. For example, when
a typesetter says &#8220;the Helvetica family&#8221;, s/he is
including the weights Helvetica Thin, Helvetica Light, Helvetica
Regular, Helvetica Bold, Helvetica Heavy, etc, and all their
associated shapes (Roman, Italic, Condensed, Narrow, Extended,
Outline, etc).
</p>
<p>
Thus, intuitively, when a typesetter gives mom a
<kbd>.FAMILY&nbsp;H</kbd> directive, s/he reasonably expects that
any subsequent <kbd>.FT</kbd> directive will access the desired font
from the Helvetica family&mdash;without the need to state explicitly
both family and font to <kbd>.FT</kbd>, as it is explained one can
do in the
<a href="typesetting.html#family">FAMILY</a>
and
<a href="typesetting.html#font">FT</a>
sections of these documents.
</p>
<p>
If one had, say, Helvetica Light Roman and Helvetica Light Italic
as well as Helvetica Light Condensed Roman and Helvetica Light
Condensed Italic, the established groff approach would require two
&#8220;partial&#8221; families, <b>HL</b> (for Helvetica Light)
and <b>HLCD</b> (for Helvetica Light Condensed), with <b>R</b> and
<b>I</b> fonts for both:
<br/>
<span class="pre-in-pp">
HLR
HLI
HLCDR
HLCDI
</span>
Accessing these family/font combos routinely
throughout a document would then require changing the family
(with <kbd>.FAMILY</kbd>) and selecting the desired font
(with <kbd>.FT&nbsp;R</kbd> or <kbd>.FT&nbsp;I</kbd>), or
passing <kbd>.FT</kbd> the lengthy family+fontname (.e.g.
<kbd>.FT&nbsp;HLCDI</kbd>).
</p>
<h4 id="simpler" class="docs">The simpler way with mom</h4>
<p>
Fortunately, groff provides a mechanism whereby it&#8217;s possible
to extend the basic <b>R</b>, <b>I</b>, <b>B</b>, and <b>BI</b> fonts
(&#8220;styles&#8221; in groff-speak) so that one can, in fact,
create extensive type families, and access all the fonts in them
with <kbd>.ft</kbd> (groff) or <kbd>.FT</kbd> (mom).
</p>
<p>
Mom uses this mechanism to offer, in addition to groff&#8217;s
default font styles, the following:
</p>
<div class="examples-container" style="padding-bottom: 1em;">
<div id="style-extensions" style="width: 50%; float: left;">
<span class="pre" style="font-size: 85%">
UL = Ultra Light
ULI = Ultra Light Italic
ULCD = Ultra Light Condensed
ULCDI = Ultra Light Condensed Italic
ULEX = Ultra Light Extended
ULEXI = Ultra Light Extended Italic
XL = Extra Light
XLI = Extra Light Italic
XLCD = Extra Light Condensed
XLCDI = Extra Light Condensed Italic
XLEX = Extra Light Extended
XLEXI = Extra Light Extended Italic
TH = Thin
THI = Thin Italic
THCD = Thin Condensed
THCDI = Thin Condensed Italic
THEX = Thin Extended
THEXI = Thin Extended Italic
L = Light Roman
LI = Light Italic
LCD = Light Condensed
LCDI = Light Condensed Italic
LEX = Light Extended
LEXI = Light Extended Italic
BK = Book Roman
BKI = Book Italic
BKCD = Book Condensed
BKCDI = Book Condensed Italic
BKEX = Book Extended
BKEXI = Book Extended Italic
CD = Medium Condensed
CDI = Medium Condensed Italic
EX = Medium Extended
EXI = Medium Extended Italic
DB = DemiBold Roman
DBI = DemiBold Italic
DBCD = DemiBold Condensed
DBCDI = DemiBold Condensed Italic
DBEX = DemiBold Extended
DBEXI = DemiBold Extended Italic
SB = SemiBold Roman
SBI = SemiBold Italic
SBCD = SemiBold Condensed
SBCDI = SemiBold Condensed Italic
SBEX = SemiBold Extended
SBEXI = SemiBold Extended Italic
</span>
</div>
<span class="pre" style="font-size: 85%">
BCD = Bold Condensed
BCDI = Bold Condensed Italic
BEX = Bold Extended
BEXI = Bold Extended Italic
BO = Bold Outline
XB = Extra Bold
XBI = Extra Bold Italic
XBCD = Extra Bold Condensed
XBCDI = Extra Bold Condensed Italic
XBEX = Extra Bold Extended
XBEXI = Extra Bold Extended Italic
UB = Ultra Bold
UBI = Ultra Bold Italic
UBCD = Ultra Bold Condensed
UBCDI = Ultra Bold Condensed Italic
UBEX = Ultra Bold Extended
UBEXI = Ultra Bold Extended Italic
HV = Heavy
HVI = Heavy Italic
HVCD = Heavy Condensed
HVCDI = Heavy Condensed Italic
HVEX = Heavy Extended
HVEXI = Heavy Extended Italic
BL = Black
BLI = Black Italic
BLCD = Black Condensed
BLCDI = Black Condensed Italic
BLEX = Black Extended
BLEXI = Black Extended Italic
BLO = Black Outline
XBL = Extra Black
XBLI = Extra Black Italic
XBLCD = Extra Black
XBLCDI = Extra Black
XBLEX = Extra Black Italic
XBLEXI = Extra Black Italic
UBL = Ultra Black
UBLI = Ultra Black Italic
UBLCD = Ultra Black Condensed
UBLCDI = Ultra Black Condensed Italic
UBLEX = Ultra Black Extended
UBLEXI = Ultra Black Extended Italic
SC = Small Caps Roman
SCI = Small Caps Italic
SCDB = Small Caps Demibold
SCDBI = Small Caps Demibold Italic
SCSB = Small Caps Semibold
SCSBI = Small Caps Semibold Italic
</span>
</div>
<p style="clear: both;">
Thus, with mom, if you&#8217;ve installed some extra
Helvetica fonts and named them according to the convention
<kbd>&lt;F&gt;&lt;S&gt;</kbd> (where <kbd>&lt;F&gt;</kbd> means
family and <kbd>&lt;S&gt;</kbd> means font style), once having
entered
<br/>
<span class="pre-in-pp" style="margin-bottom: -1em;">
.FAMILY H
</span>
you can access any of the extra Helvetica fonts simply by passing
the correct argument to
<a href="typesetting.html#font">FT</a>
from the list, above. For example, if you were working in Medium
Roman (<kbd>.FT&nbsp;R</kbd>) and you needed Medium Condensed Italic
for a while (assuming it&#8217;s installed), you&#8217;d just type
<br/>
<span class="pre-in-pp" style="margin-bottom: -1em;">
.FT CDI
</span>
to access the Medium Condensed Italic font from the Helvetica
family.
</p>
<p>
Mom&#8217;s list of font styles doesn&#8217;t pretend to be
exhaustive. The extension names are arbitrary and can be used in a
flexible manner. For example, if you create a family that has a
Demibold font (<b>DB</b>) but no Bold font (<b>B</b>), you might
find it more convenient to give the Demibold font the extension
&#8220;<b>B</b>&#8221;.
</p>
<p id="register-style">
You may, at needs, want to add to mom&#8217;s list of font styles.
You can do this by editing the file, om.tmac (typical location:
<kbd>&lt;prefix&gt;/&lt;version&gt;/tmac/om.tmac</kbd>). Near the
top, you&#8217;ll see lines of the form
<br/>
<span class="pre-in-pp">
.sty \n[.fp] XL \" Extra Light
.sty \n[.fp] L \" Light Roman
.sty \n[.fp] LI \" Light Italic
.sty \n[.fp] LCD \" Light Condensed Roman
</span>
Simply add your new font style by imitating what you see, above,
and plugging in your new font style (having, of course,
added the font to groff, correctly named); see
<a href="#steps">Step-by-step instructions</a>).
</p>
<p>
For example, if you already have some fonts from the Univers family
installed and have called the family <b>Univers</b>, you might decide at
some point to add the Bold Outline font (<b>UniversBO</b>). In which
case, you&#8217;d add
<br/>
<span class="pre-in-pp">
.sty \n[.fp] BO \" Bold Outline
</span>
to the <kbd>.sty&nbsp;\n[.fp]&nbsp; &lt;font style&gt;</kbd> list
in om.tmac.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
Mom&#8217;s font extensions are not &#8220;user-space&#8221;
controllable via a macro. If you&#8217;ve been using groff for
a long time, and have already rolled your own solution to adding
families and fonts to groff, you may find that mom&#8217;s font
extensions conflict with your own scheme. Should that be the case,
comment out the <kbd>.sty&nbsp;\n[.fp] &lt;font style&gt;</kbd>
lines found near the top of the <kbd>om.tmac</kbd> file.
</p>
</div>
<div class="box-important">
<p class="tip">
<span class="important">Important:</span>
Be careful that any styles you add do not conflict with
<i>family</i> names that already exist. &#8220;<b>C</b>&#8221;,
for example, conflicts with the Courier family (<b>CR</b>,
<b>CI</b>, <b>CB</b>, <b>CI</b>). Were you to create a font
style &#8220;<b>C</b>&#8221;, thinking that <kbd>.FT&nbsp;C</kbd>
would give you access to font style once you&#8217;d given a
<kbd>.FAMILY</kbd> directive, you&#8217;d get a nasty surprise:
your type would come out in Courier Roman!
</p>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="steps" class="docs">Step-by-step instructions</h2>
<div>
<ul class="no-enumerator" style="margin-left: -1.5em;">
<li><a href="#need">What you need before you start</a></li>
<li><a href="#preparation">Initial preparation</a></li>
<li><a href="#step-1">1. Acquire the font</a></li>
<li><a href="#step-2">2. Prepare to convert the font to the correct format</a>
<ul style="margin-left: -.5em">
<li><a href="#ttf">TTF fonts</a></li>
<li><a href="#type1">Type 1 fonts</a></li>
</ul></li>
<li><a href="#step-3">3. Convert the font and put it in the right place</a></li>
<li><a href="#step-4">4. Update the download file</a>
<ul style="margin-left: -.5em">
<li><a href="#internal">Get the internal font name</a></li>
<li><a href="#add">Add the font to the download file</a></li>
<li><a href="#gropdf-download">Updating the gropdf download file</a></li>
</ul></li>
<li><a href="#groff-font-names">Naming groff fonts</a></li>
<li><a href="#install-font">Automate the whole process &ndash; the install-font script</a>
</li>
</ul>
</div>
<p>
There are a number of ways to approach making fonts available
to groff. These instructions aren&#8217;t meant to cover all
possibilities, merely one.
</p>
<p>
GNU/Linux distributions being what they are, directory locations
may differ and the presence of some executable can&#8217;t be
guaranteed. I run a Debian-based system. The instructions reflect
that. Users of other distros may have to interpret them according
to the way their distro operates.
</p>
<h3 id="need" class="docs appendices">What you need before you start</h3>
<ul style="margin-top: 1em; margin-left: -.5em;">
<li>groff, version 1.18 or higher<br/>
(Debian package: groff)
</li>
<li>ghostscript<br/>
(Debian package: ghostscript or ghostscript-x)
</li>
<li>fontforge<br/>
(Debian package: fontforge)
</li>
</ul>
<h3 id="preparation" class="docs appendices">Initial preparation (you only need do this once)</h3>
<ol id="site-font" style="margin-left: -1em;">
<li>
Locate the groff directory,
<kbd class="nobr">site-font</kbd>. The exact location is
difficult to predict, owing to differences between distros and
whether you&#8217;re using a pre-packaged groff or have built
it from source. Some typical locations are:
<br/>
<span class="pre-in-pp" style="margin-bottom: -2em;">
/usr/share/groff/
/usr/local/share/groff/
/etc/groff/
</span>
If you can&#8217;t find the site-font directory, locate
groff&#8217;s <kbd class="nobr">site-tmac</kbd> directory, and, as root,
create site-font in the same directory. Eg, if you find
site-tmac in <kbd class="nobr">/usr/share/groff/</kbd>, create site-font in
<kbd class="nobr">/usr/share/groff/</kbd>
<br/>
<span class="pre-in-pp" style="margin-bottom: -2em;">
sudo mkdir site-font
</span>
</li>
<li>
Create two files, generate-t42.pe and generate-pfa.pe,
as you see them below. Place them in a convenient and
easily-remembered location, like your home directory.
<br/>
<span class="examples" style="font-size: 95%; display: block; margin-top: .5em;">generate-t42.pe</span>
<div class="examples-container" style="margin-top: 0; margin-bottom: -1em; padding-bottom: 1em;">
<span class="pre">
# generate-t42.pe
Open($1);
Generate($fontname + ".pfa");
Generate($fontname + ".t42");
</span>
</div>
<br/>
<span class="examples" style="font-size: 95%; display: block; margin-top: .5em;">generate-pfa.pe</span>
<div class="examples-container" style="margin-top: 0; padding-bottom: 1em;">
<span class="pre">
# generate-pfa.pe
Open($1);
Generate($fontname + ".pfa");
</span>
</div>
</li>
</ol>
<h3 id="step-1" class="docs appendices">Step 1: Acquire the font</h3>
<p class="top">
The two most commonly available types of fonts are PostScript Type1
(extension .pfb) and TrueType (extension .ttf). Either can be made
available to groff. There are many websites holding collections of
both.
</p>
<h3 id="step-2" class="docs appendices">Step 2: Prepare to convert the font to the correct format</h3>
<p class="top">
Change into the directory holding the new font.
</p>
<p>
For convenience in the next step, make a symbolic link to
the file 'textmap':
<br/>
<span class="pre-in-pp">
ln -s &lt;prefix&gt;/&lt;version&gt;/font/devps/generate/textmap .
</span>
See
<a href="#small-note">here</a>
for an explanation of <kbd>&lt;prefix&gt;</kbd>
and <kbd>&lt;version&gt;</kbd>.
</p>
<p>
In addition, unless you&#8217;re installing fonts from your home
directory, make links to the files 'generate-t42.pe' and
'generate-pfa.pe'.
<br/>
<span class="pre-in-pp">
ln -s $HOME/generate-t42.pe .
ln -s $HOME/generate-pfa.pe .
</span>
</p>
<h3 id="step-3" class="docs appendices">Step 3: Convert the font and put it in the right place</h3>
<p class="top">
TrueType fonts (.ttf) need to be converted to .t42. Type 1 fonts
(.pfa, .pfb) need to be converted to .pfa.
</p>
<h4 id="ttf" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Converting TTF Fonts</h4>
<p class="top" style="margin-top: .5em;">
For .ttf fonts, run
<br/>
<span class="pre-in-pp">
fontforge -script generate-t42.pe &lt;file&gt;.ttf
</span>
This will create three new files with the extensions .t42, .pfa, and
.afm. Next, run
<br/>
<span class="pre-in-pp">
afmtodit &lt;afm file&gt; textmap &lt;groff font&gt;
</span>
This will create a groff font with the name you give. (See
<a href="#groff-font-names">here</a>
for advice on naming groff fonts.)
</p>
<p>
Move the .t42 and groff font files to
<kbd class="nobr">&lt;prefix&gt;/site-font/devps/</kbd>.
</p>
<p>
If you&#8217;re running a recent version of groff that includes
the native pdf device (gropdf), move the .pfa file to <kbd
class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd>. If not, you
may safely remove it. You may also safely remove the .afm file.
</p>
<h4 id="type1" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Converting Type1 Fonts</h4>
<p class="top" style="margin-top: .5em;">
For .pfb fonts, run
<br/>
<span class="pre-in-pp">
fontforge -script generate-pfa.pe &lt;file&gt;.pfb
</span>
This will create two new files with the extensions .pfa, and .afm.
Next, run
<br/>
<span class="pre-in-pp">
afmtodit &lt;afm file&gt; textmap &lt;groff font&gt;
</span>
Move the .pfa and groff font files to
<kbd class="nobr">&lt;prefix&gt;/&lt;site-font&gt;/devps/</kbd>.
(See
<a href="#groff-font-names">here</a>
for advice on naming groff fonts.)
</p>
<p>
If you&#8217;re running a recent version of groff that includes the
native pdf device (gropdf), link the .pfa and groff font files, now
in <kbd class="nobr">&lt;prefix&gt;/&lt;site-font&gt;/devps/</kbd>,
to the <kbd class="nobr">&lt;prefix&gt;/site-font/devpdf</kbd>
directory.
</p>
<p>
Start by changing into the
<kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd>
directory, then:
<br/>
<span class="pre-in-pp">
ln -s &lt;prefix&gt;/&lt;site-font&gt;/devps/&lt;file&gt;.pfa .
ln -s &lt;prefix&gt;/&lt;site-font&gt;/devps/&lt;groff font&gt; .
</span>
You may safely remove the .afm file.
</p>
<h3 id="step-4" class="docs appendices">Step 4: Update the download file</h3>
<h4 id="internal" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Get the internal font name</h4>
<p class="top" style="margin-top: .5em;">
Inspect your new groff font file. Near the top, you will see a line
of the form
<br/>
<span class="pre-in-pp">
internalname &lt;name&gt;
</span>
Usually, the internal name is helpfully descriptive, e.g.
<br/>
<span class="pre-in-pp">
internalname Optima-Bold
</span>
Make a note of the internal name.
</p>
<h4 id="add" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Add the font to the download file</h4>
<p class="top" style="margin-top: .5em;">
If a file called &#8216;download&#8217; is not already present in
<kbd class="nobr">&lt;prefix&gt;/site-font/devps/</kbd>,
copy over the one found in
<kbd class="nobr">&lt;prefix&gt;/&lt;version&gt;/font/devps/</kbd>.
</p>
<p>
The download file maps the internal names used by groff to the
actual fonts. To add your new font to the download file, append a
line containing the internal name, followed by a tab (make sure your
text editor is inserting the tab character, not spaces), followed by
the .t42 or .pfa font to which the internal name refers.
</p>
<p>
For example, if the internal name is Optima-Bold and the font is a
.pfa file called Optima-Bold.pfa, your updated download file will
contain
<br/>
<span class="pre-in-pp">
Optima-Bold&lt;tab&gt;Optima-Bold.pfa
</span>
</p>
<h4 id="gropdf-download" class="docs" style="font-size: 90%; text-transform: uppercase;">&nbsp;&bull;&nbsp;Updating the gropdf download file</h4>
<p class="top" style="margin-top: .5em;">
If you&#8217;re running a recent version of groff that includes
the native pdf device (gropdf), you must update the
<kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/download</kbd>
file as well. If it does not exist, create it.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
Start with a blank &#8216;download&#8217; file. Do not copy
over the &#8216;download&#8217; file from
<kbd class="nobr">&lt;prefix&gt;/&lt;version&gt;/font/devpdf/</kbd>.
</p>
</div>
<p>
The instructions for registering fonts in the
<kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/</kbd> download
file are identical to those for PostScript fonts (see above), but
with one important difference: the lines must all begin with a tab
character. Thus, using our Optima example, your
<kbd class="nobr">&lt;prefix&gt;/site-font/devpdf/download</kbd>
file download line for the same font is
<br/>
<span class="pre-in-pp">
&lt;tab&gt;Optima-Bold&lt;tab&gt;Optima-Bold.pfa
</span>
</p>
<h3 id="groff-font-names" class="docs appendices">Naming groff fonts</h3>
<p class="top">
For convenience when using mom, and to keep your font collection
organized, choose meaningful groff font names following the scheme
&lt;Family&gt;&lt;FONT&gt;, where Family is something
like Optima or Univers or Clarendon, and FONT is either
<br/>
<span style="display: block; margin-left: 2em;">
<kbd>R&nbsp;&nbsp;</kbd>(roman/regular)
<br/>
<kbd>I&nbsp;&nbsp;</kbd>(italic)
<br/>
<kbd>B&nbsp;&nbsp;</kbd>(bold)
<br/>
<kbd>BI&nbsp;</kbd>(bold italic)
</span>
or one of the 1&ndash;5 character fontstyles listed
<a href="#style-extensions">here</a>.
Thus, for the fonts Optima Light Italic and Optima Extra Black, your font names would be
<br/>
<span class="pre-in-pp">
OptimaLI
OptimaXBL
</span>
This scheme allows you to enter <kbd>.FAMILY&nbsp;Optima</kbd> to make
Optima the current family, and <kbd>.FT&nbsp;LI</kbd> or <kbd>.FT&nbsp;XBL</kbd>
when you need the fonts Light Italic or Extra Black.
</p>
<p>
Groff font names are, in fact, arbitrary; you can call your fonts
anything you like, provided the
<a href="#internal">internal name</a>
in the
<a href="#add">download file</a>
matches the internal name found in the groff font file. When
calling a font that does not follow the recommended naming convention,
you must pass the full font name to <kbd>.FT</kbd> whenever you wish
to use it.
</p>
<p>
For example, the font, Goudy Stout, isn&#8217;t really part of the
Goudy family, and while "stout" describes it, Stout is not a
recognized font style. Therefore, its groff name could simply be
GoudyStout, and whenever you needed it, you could call it with
<kbd>.FT&nbsp;GoudyStout</kbd>.
</p>
<h3 id="install-font" class="docs appendices">Automate the whole process &ndash; the install-font script</h3>
<p>
A bash script to make the entire process of installing fonts a
painless no-brainer has been posted online at
<a href="https://www.schaffter.ca/mom/bin/install-font.sh">https://www.schaffter.ca/mom/bin/install-font.sh</a>.
Be sure to make the script executable
(<kbd class="nobr">chmod 755 install-font</kbd>)
after you download it, then type <kbd>./install-font.sh -H</kbd> for
usage.
</p>
<div class="rule-medium" style="margin-top: 2em;"><hr/></div>
<!-- ===================================================================== -->
<h2 id="codenotes" class="docs">Some reflections on mom</h2>
<p>
If, as Eric Raymond asserts, open source begins with a programmer
scratching a personal itch, then mom can truly be called open
source.
</p>
<p>
Mom had her origins in a library of groff routines I wrote over
the years to handle various aspects of typesetting and document
processing that weren&#8217;t adequately covered by ms, me, mm, and
friends. Typically, I&#8217;d use the library to cobble together
macro sets for new challenges as they came my way.
</p>
<p>
As a writer living in a perpetual state of penury, all the computers
I&#8217;ve ever owned have been hand-me-downs&mdash;several
generations out-of-date and resource challenged. Disk space has
always been an issue, as has processor speed and available RAM. One
of the reasons I run GNU/Linux rather than the offering from Redmond
is that it has helped enormously to get the most out of my poor
little boxes.
</p>
<p>
In Linux-land (all Unix variants, in fact), the choice of
typesetting systems basically comes down to groff or TeX. Both are
wonderful&mdash;monumental achievements if you ask me&mdash;and both
have their own particular strengths. However, for people in my
financial position (and there are millions of us around the globe,
in both developed and developing countries), TeX and groff have one
big difference: size. TeX is huge. Even its most ardent supporters
agree it suffers from bloat, on top of being complex and unwieldy to
manage. Groff is tiny by comparison, occupying minimal disk space
and having only a small memory footprint while at the same time
being flexible and powerful, typographically speaking. Back in the
Jurassic Period, I ran it successfully on a 386 with 8 megs of RAM
and a 250 meg hard disk.
</p>
<p>
However, groff has always had a liability: it&#8217;s incredibly geeky.
Owing to its very long history, it&mdash;and its power users
&mdash;seem to have remained stuck in a time warp. The canonical macro packages
still look as they did back in those decades when memory was exorbitantly
expensive and every byte mattered.
</p>
<p>
For some time now, groff users and macro writers have had the option
to use &#8220;long&#8221; names for macros (i.e. longer than two
letters, the original limit), yet have mostly chosen not to. With
long names, it&#8217;s possible to create macro sets that are
humanly readable and easy to interpret, encouraging development and
evolution. What&#8217;s more, the macros themselves need not be
terse, intimidating, and easily forgotten 1- or 2-letter commands
inserted in the body of a document. They can be sensible and
helpful to everyone, groff newbies and old hands alike.
</p>
<p>
Mom&#8217;s macro file, om.tmac, uses long names, aliases, and a
host of other groff goodies that have become part of the whole groff
picture. The function of nearly every macro, number register and
string can be inferred simply from its name. The file is heavily
commented. A consistent, if idiosyncratic, indenting style is used
as well, significantly improving readability. Anyone wanting to
futz around with mom&#8217;s macros should be able to do so with a
minimum of head scratching.
</p>
<div class="rule-medium"><hr/></div>
<!-- ===================================================================== -->
<h2 id="contact" class="docs">Contact the author</h2>
<p>
If you have any questions or comments about mom, suggestions to
make, criticisms to offer, or bugs to report, use the groff mailing
list (subscription information available
<a href="http://www.gnu.org/software/groff/groff.html">here</a>)
or contact me, Peter Schaffter, directly at the following
address:
<br/>
<span class="pre-in-pp">
&#112;&#101;&#116;&#101;&#114;&#64;&#115;&#99;&#104;&#97;&#102;&#102;&#116;&#101;&#114;&#46;&#99;&#97;
</span>
Please include the word &#8220;mom&#8221; or &#8220;groff&#8221; in
the Subject line of any message sent to my personal address or you
risk the wrath of my implacable spam filters.
</p>
<p>
If you want to visit mom&#8217;s website, you&#8217;ll find a link
to it at
<br/>
<span class="pre-in-pp">
https://www.schaffter.ca
</span>
The site contains links to some of my fiction, all of which was
typeset with mom and groff.
</p>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 100%; text-align: right;"><a href="#top">Top</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,505 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Colour</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="graphical.html#top">Next: Graphical objects</a></td>
</tr>
</table>
<h1 class="docs">Coloured text</h1>
<div style="text-align: center;">
<a href="#index-color">List of color macros</a>
</div>
<div class="rule-medium"><hr/></div>
<h2 class="docs">Introduction</h2>
<p>
Mom&#8217;s support for coloured text is straightforward. You begin
by telling mom about the colours you want with
<a href="#newcolor">NEWCOLOR</a>
or
<a href="#xcolor">XCOLOR</a>.
Afterwards, any time you want text to be coloured, you either colour
it with an
<a href="definitions.html#inlines">inline escape</a>
that contains the colour name (e.g. <kbd><span class="nobr">\*[red]</span></kbd>
or <kbd><span class="nobr">\*[blue]</span></kbd>) or invoke the macro
<a href="#color">COLOR</a>
with the name of the colour you want.
</p>
<p id="color-example">
For example, say you want to have the name &#8220;Jack&#8221; in the
sentence &#8220;All work and no play makes Jack a dull boy&#8221;
appear in yellow. You&#8217;d begin by telling mom about the colour,
yellow. There are two ways of doing this; see
<a href="#newcolor">NEWCOLOR</a>
and
<a href="#xcolor">XCOLOR</a>
for a full explanation of the difference between the two.
</p>
<p>
If you use XCOLOR, you&#8217;d enter this:
<br/>
<span class="pre-in-pp">
.XCOLOR yellow
</span>
If you use NEWCOLOR, you might enter:
<br/>
<span class="pre-in-pp">
.NEWCOLOR yellow RGB #FFFF00
</span>
</p>
<p id="color-example2" style="margin-top: -1em;">
After defining or initializing the colour yellow you&#8217;d
colourise the name, Jack, either with an inline escape
<br/>
<span class="pre-in-pp">
All work and no play makes \*[yellow]Jack\*[black] a dull boy.
</span>
or with the
<a href="#color">COLOR</a>
macro
<br/>
<span class="pre-in-pp">
All work and no play makes
.COLOR yellow
Jack
.COLOR black
a dull boy.
</span>
Notice, in both examples, that a) you have to set the colour back
to black after &#8220;Jack,&#8221; and b) you don&#8217;t have to
define or initialize the colour, black. Mom predefines it for you.
</p>
<p>
For information on using colour during
<a href="docprocessing.html#intro-macros-docprocessing">document processing</a>,
see
<a href="docprocessing.html#color">Colour support in document processing</a>.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
Mom&#8217;s colour support is for text only. She doesn&#8217;t
support &#8220;fill&#8221; (or &#8220;background&#8221;) colour for
solid, enclosed graphical objects (polygons, ellipses) drawn with
groff&#8217;s <kbd>\D</kbd>
<a href="definitions.html#inlines">inline escapes</a>,
although you may give a colour as one of the arguments to
mom&#8217;s &#8220;box&#8221; and &#8220;circle&#8221; macros,
<a href="graphical.html#dbx">DBX</a>
and
<a href="graphical.html#dcl">DCL</a>
when the first argument to these macros is <kbd>SOLID</kbd>.
</p>
</div>
<div class="box-tip">
<p class="tip">
<span class="experts">Experts:</span>
If you&#8217;re accustomed to using groff&#8217;s
<kbd>.defcolor</kbd> to define colours, and groff&#8217;s inline
<kbd>\m[&lt;colorname&gt;]</kbd> to call them, you may continue to
do so without confusing mom.
</p>
</div>
<div class="macro-list-container">
<h3 id="index-color" class="macro-list">Coloured text macros</h3>
<ul class="macro-list">
<li><a href="#newcolor">NEWCOLOR</a></li>
<li><a href="#xcolor">XCOLOR</a></li>
<li><a href="#color">COLOR</a></li>
<li><a href="#color-inline">\*[&lt;colourname&gt;]</a> (inline escape)</li>
</ul>
</div>
<div class="rule-medium" style="margin-bottom: 1.5em;"><hr/></div>
<!-- -NEWCOLOR- -->
<div class="macro-id-overline">
<h3 id="newcolor" class="macro-id">Creating (initializing) a colour with NEWCOLOR</h3>
</div>
<div class="box-macro-args">
Macro: <b>NEWCOLOR</b> <kbd class="macro-args">&lt;colour name&gt; [&lt;colour scheme&gt;] &lt;colour components&gt;</kbd>
</div>
<p>
NEWCOLOR lets you create a colour, rather like an artist mixing
paint on a palette. The colour isn&#8217;t used immediately;
NEWCOLOR merely tells mom how to mix the colour when you need it.
If you haven&#8217;t invoked <kbd>.NEWCOLOR</kbd> (or
<kbd><a href="#xcolor">.XCOLOR</a></kbd>),
mom doesn&#8217;t have a clue what you mean when you reference a
colour (with
<a href="#color">COLOR</a>
or
<a href="#color-inline"><kbd><span class="nobr">\*[&lt;colour name&gt;]</span></kbd></a>).
</p>
<p>
The first argument to NEWCOLOR is a name for your colour. It
can be anything you like&mdash;provided it&#8217;s just one word
long&mdash;and can be caps, lower case, or any combination of the
two.
</p>
<p>
The second argument, which is entirely optional, is the
&#8220;colour scheme&#8221; you want mom to use when mixing the
colour. Valid arguments are
<br/>
<span class="pre-in-pp">
RGB (3 components: red green blue)
CYM (3 components: cyan yellow magenta)
CMYK (4 components: cyan magenta yellow black)
GRAY (1 component)
</span>
If you omit the second argument, mom assumes you
want RGB.
</p>
<p>
The final argument is the components of your colour. This can be
hexadecimal string starting with a pound sign (<kbd>#</kbd>) (for
colour values in the 0-255 range) or two pound signs (<kbd>##</kbd>)
(for colour values in the 0-65535 range), or it can be a series of
decimal digits, separated by spaces, one digit per component, with
the argument enclosed in double quotes. (If this is all gibberish
to you, see
<a href="#color-tip">Tips for newbies</a>.)
</p>
<p>
Thus, to tell mom about a colour named &#8220;YELLOW&#8221;, you
could enter one of the following:
<br/>
<span class="pre-in-pp">
.NEWCOLOR YELLOW #FFFF00 \"or ##FFFFFFFF0000 or "1 1 0"
.NEWCOLOR YELLOW RGB #FFFF00 \"or ##FFFFFFFF0000 or "1 1 0"
.NEWCOLOR YELLOW CMY #0000FF \"or ##0000FFFF0000 or "0 0 1"
.NEWCOLOR YELLOW CMYK #0000FF00 \"or ##00000000FFFF0000 or "0 0 1 0"
</span>
After you&#8217;ve told mom about a colour, you can then get her to
set text in that colour either with the
<a href="definitions.html#inlines">inline escape</a>,
<a href="#color-inline"><kbd><span class="nobr">\*[&lt;colourname&gt;]</span></kbd></a>,
or the macro
<a href="#color">COLOR</a>.
(See the
<a href="#color-example">example</a>,
above.)
</p>
<div class="box-tip">
<p class="tip-top">
<span class="note">Note:</span>
The colourname you give to NEWCOLOR may be used with groff&#8217;s
<kbd>\m[&lt;colourname&gt;]</kbd> inline escape (the <kbd>\m</kbd>
escape is used to set text and rule colours). Thus, assuming
a colourname &#8220;blueblack&#8221; set with NEWCOLOR,
<kbd><span class="nobr">\*[blueblack]</span></kbd> and <kbd>\m[blueblack]</kbd>
are equivalent. Furthermore, the colourname can be given as an
argument to <b>groff</b>&#8217;s
<a href="definitions.html#primitives">primitive</a>
request, <kbd>.gcolor</kbd> (which does the same thing as
<kbd>\m[&lt;colourname&gt;]</kbd>).
</p>
<p class="tip-bottom">
Equally, the colourname may be used with
<kbd>\M[&lt;colourname&gt;]</kbd> and <kbd>.fcolor</kbd>, which set
the &#8220;fill&#8221; colour for solid graphical objects.
</p>
</div>
<div class="box-tip">
<p id="color-tip" class="tip-top">
<span class="tip">Tips for newbies:</span>
Colour manipulation can be tremendously confusing if you don&#8217;t
have a background in graphic arts or computing. My advice, if colour
intimidates you, is to stick to using mom&#8217;s default RGB colour
scheme, and to fire up a colour chooser that gives you the RGB values
you want for the colour you select. Plug those values into the
components argument to NEWCOLOR, and you&#8217;ll get the colour
you want. Both the KDE and gnome desktops have colour selectors
that provide you with the shorter RGB hexadecimal string. If
you&#8217;re not running KDE or gnome, the X utility, xcolorsel,
provides you with a similar functionality, although it only provides
RGB values for 256 pre-defined colours. If you use xcolorsel, be
sure to click the button &#8220;Display format&#8221; and select
&#8220;8 bit truncated rgb&#8221;.
</p>
<p class="tip-bottom">
Alternatively, you can use mom&#8217;s simpler
<kbd><a href="#xcolor">XCOLOR</a></kbd>
macro to initialize one of the 256 pre-defined X colours by
supplying the name of the colour as an argument.
</p>
</div>
<!-- -XCOLOR- -->
<div class="macro-id-overline">
<h3 id="xcolor" class="macro-id">Initializing a colour with XCOLOR</h3>
</div>
<div class="box-macro-args">
Macro: <b>XCOLOR</b> <kbd class="macro-args">&lt;X colourname&gt; [&lt;alias&gt;]</kbd>
</div>
<p class="requires">
<kbd style="font-style: normal">&lt;X colourname&gt;</kbd> <i>must be all one word, all lower case.</i>
<br/>
(See
<a href="#xcolor-names" style="font-style: normal;">Finding X colour names</a>
for how to get a list of valid colour names.)
</p>
<p>
XCOLOR is similar to NEWCOLOR in that it tells mom to initialize a
colour, but it&#8217;s easier to use. All you have to do is pass
it, as an argument, the valid name of one of the 256 pre-defined
X colours. The name must be all one word, and, breaking with mom
policy, it must be entered in lower case.
</p>
<p>
For example, if you want to initialize the X colour, coral, all you
have to do is enter
<br/>
<span class="pre-in-pp">
.XCOLOR coral
</span>
Afterwards
<br/>
<span class="pre-in-pp">
.COLOR coral
</span>
will colourise subsequent text coral until you instruct mom to
return to black, or some other pre-defined, initialized colour.
(The
<a href="definitions.html#inlines">inline escape</a>
<kbd><span class="nobr">\*[coral]</span></kbd> will equally colourise text coral
after you&#8217;ve initialized the colour with XCOLOR.)
</p>
<p>
The downside of XCOLOR is that you can&#8217;t create custom
colours. This restriction, however, is mitigated by the fact that
for many users, 256 colours is more than enough to play around with.
</p>
<p>
While some X colours have fanciful names (peachpuff, papayawhip,
thistle, snow), many are self-explanatory and self-descriptive
in ordinary colour terms. &#8220;blue&#8221; is pure (rgb)
blue, &#8220;green&#8221; is pure (rgb) green, and so on.
Furthermore, for many X colours, there exist four variants, each
representing increasingly darker shades of the same colour.
For example, &#8220;blue1&#8221; is a relatively bright blue;
&#8220;blue2&#8221;, &#8220;blue3&#8221; and &#8220;blue4&#8221; are
increasingly darker shades. For that reason, you may find XCOLOR is
a better choice than NEWCOLOR when it comes to initializing common
colours.
</p>
<p>
The whimsical nature of X colour names sometimes makes for names
that are long to type in, e.g. &#8220;mediumspringgreen&#8221;. The
optional second argument to XCOLOR allows you to come up with more
convenient name by which to reference the colour. For example, you
could enter
<br/>
<span class="pre-in-pp">
.XCOLOR mediumspringgreen mygreen
</span>
or
<span class="pre-in-pp">
.XCOLOR mediumspringgreen MYGREEN
</span>
so that whenever you want text mediumspringgreen-ed, you can use
either <kbd>.COLOR&nbsp;mygreen</kbd> (or <kbd>.COLOR&nbsp;MYGREEN</kbd>)
or the inline escape
<kbd>\*[mygreen]</kbd> (or <kbd>\*[MYGREEN]</kbd>.)
</p>
<h3 id="xcolor-names" class="docs">Finding X colour names</h3>
<p>
There are two ways of finding the names of the pre-defined X
colours. One is to consult the file, rgb.txt, included with all
X11 installations. The location of the file on a Debian GNU/Linux
distribution is typically /etc/X11/rgb.txt. Other distributions and
other X installations may have the file in another location. The
file lists the colour names, but doesn&#8217;t show you what the
colours actually look like.
</p>
<p>
A better way to get the colour names, as well as to see what the
colours look like, is to fire up a colour chooser (like xcolorsel)
that both lists the colour names and shows a swatch of the colour
as well.
</p>
<p>
Whichever method you use to find X colour names, remember that the
names, passed as arguments to XCOLOR, must be all one word, all in
lower case.
</p>
<div class="box-tip">
<p class="tip-top">
<span class="note">Note:</span>
Both the colourname and the alias you give to XCOLOR may be
used with groff&#8217;s <kbd>\m[&lt;colourname&gt;]</kbd>
inline escape (the <kbd>\m</kbd> escape is used to set
text and rule colours). Thus, assuming an X-colourname
&#8220;mediumspringgreen&#8221; set with
XCOLOR, and an alias, &#8220;mygreen&#8221;,
<kbd><span class="nobr">\*[mediumspringgreen]</span></kbd>,
<kbd><span class="nobr">\m[mediumspringgreen]</span></kbd>,
<kbd><span class="nobr">\*[mygreen]</span></kbd> and
<kbd><span class="nobr">\m[mygreen]</span></kbd> are all equivalent.
Furthermore, both the colourname and the alias can be given as an
argument to groff&#8217;s
<a href="definitions.html#primitives">primitive</a>
request, <kbd>.gcolor</kbd> (which does the same thing as
<kbd><span class="nobr">\m[&lt;colourname&gt;]</span></kbd>).
</p>
<p class="tip-bottom">
The colourname initialized with XCOLOR <i>but not the
alias</i> may also be used with groff&#8217;s inline escape,
<kbd>\M[&lt;colorname&gt;]</kbd>, and the corresponding primitive,
<kbd>.fcolor</kbd>, both of which set the &#8220;fill&#8221; colour
for solid graphical objects. If you need a colour initialized with
XCOLOR for <kbd>\M</kbd> or <kbd>.fcolor</kbd>, you MUST give the
full colourname; the alias won&#8217;t work.
</p>
</div>
<!-- -COLOR- -->
<div class="macro-id-overline">
<h3 id="color" class="macro-id">Invoking a colour</h3>
</div>
<div class="box-macro-args">
Macro: <b>COLOR</b> <kbd class="macro-args">&lt;colourname&gt;</kbd>
</div>
<p id="color-inline" class="requires" style="font-style: normal;">
Inline: <kbd>\*[&lt;colourname&gt;]</kbd>
</p>
<p>
Once you&#8217;ve told mom about a colour (via
<a href="#newcolor">NEWCOLOR</a>
or
<a href="#xcolor">XCOLOR</a>,
you use either the macro COLOR or the
<a href="definitions.html#inlines">inline escape</a>,
<kbd><span class="nobr">\*[&lt;colourname&gt;]</span></kbd>, to cause mom to set
subsequent text in that colour. See the
<a href="#color-example2">example</a>,
above, which shows both in action.
</p>
<div class="box-tip">
<p class="tip-top">
<span class="note">Note:</span>
You can use the <kbd><span class="nobr">\*[&lt;colourname&gt;]</span></kbd>
inline escape in any
<a href="docprocessing.html#top">document processing</a>
macro that takes a
<a href="definitions.html#stringargument">string argument</a>.
However, you must remember to reset the colour at the end of the
argument (typically with <kbd><span class="nobr">\*[black]</span></kbd>) unless
you want all subsequent invocations of that particular macro to be
colourised.
</p>
<p>
Furthermore, if you use
<kbd><span class="nobr">\*[&lt;colourname&gt;]</span></kbd> in the string
argument passed to
<a href="docelement.html#heading">HEADING&nbsp;&lt;n&gt;</a>
and you&#8217;ve requested that the heading level be numbered, the
numbers themselves will not be colourised, only the text you pass to
the macro. If you wish the numbers to be colourised along with the
text, you must explicitly tell mom with
<a href="docelement.html#heading-style">HEADING_STYLE&nbsp;&lt;n&gt;</a>.
</p>
<p class="tip-bottom">
For colourising underscored text, see
<a href="goodies.html#underscore-color">Colourising underscored text</a>
in the notes at the end of
<a href="goodies.html#underscore">UNDERSCORE</a>.
</p>
</div>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="graphical.html#top">Next: Graphical objects</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,851 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2023 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Document processing, creating cover pages</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="tables-of-contents.html#top">Next: Tables of contents</a></td>
</tr>
</table>
<h1 class="docs">Creating cover pages</h1>
<div style="width: 66%; margin: auto;">
<ul class="no-enumerator">
<li><a href="#cover-intro">Introduction to cover pages</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#important-note">Important note</a></li>
<li><a href="#desc">Description of cover pages</a></li>
<li><a href="#pagination">Headers/footers/pagination</a>
<ul style="margin-left: -1.25em; list-style-type: circle;">
<li><a href="#pagination">DOC_COVERS_COUNT_PAGES</a></li>
<li><a href="#pagination">COVERS_COUNT_PAGES</a></li>
</ul>
</li>
<li><a href="#design">Designing your own cover pages</a></li>
<li><a href="#persistence">Persistence of data and formatting</a></li>
</ul></li>
<li><a href="#index-covers">Doc-cover and cover macros</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#cover">DOC_COVER / COVER</a>
<ul style="margin-left: -1.25em; list-style-type: circle;">
<li><a href="#cover-args">The argument list: saying what goes on doc cover and cover pages</a></li>
<li><a href="#meanings">What the arguments mean</a></li>
<li><a href="#chapter">How the CHAPTER argument and friends work</a></li>
</ul></li>
<li><a href="#covertext">DOC_COVERTEXT / COVERTEXT</a>
<ul style="margin-left: -1.25em; list-style-type: circle;">
<li><a href="#placement">Placement</a></li>
</ul>
</li>
<li><a href="#coverimages">DOC_COVER_IMAGE / COVER_IMAGE</a>
<ul style="margin-left: -1.25em; list-style-type: circle;">
<li><a href="#positioning">Positioning of doc cover and cover images</a></li>
</ul>
</li>
</ul></li>
<li><a href="#on-off">Enabling/disabling automatic generation of cover pages</a></li>
<li><a href="#cover-control">Control macros for covers and doc covers</a></li>
</ul>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="cover-intro" class="docs">Introduction to cover pages</h2>
<p>
Though identical in treatment, mom provides two kinds of cover
pages: document cover pages (&#8221;doc covers&#8221;) and section
cover pages (&#8220;covers&#8221;). Section cover pages are
analogous to title pages.
</p>
<p>
A doc cover is what you&#8217;d most likely use at the start of a
collated document, where you might want the name of the complete
document, the author(s) and the copyright line to appear. Another
place you might use a doc cover is for a novel, where you want the
title of the novel, not the chapter title or chapter number, as the
first cover page.
</p>
<p>
A cover is what you&#8217;d use for pages that separate sections
of a collated document, i.e. title pages. A cover page (but not a
doc cover) in a collated document could, for example, simply read:
&#8221;PART 1&#8221;.
</p>
<p>
In non-collated documents (say, an essay) you can use either a cover
or doc cover to generate the cover sheet.
</p>
<p>
In addition, nothing prevents you from generating both a doc cover
and a cover for every document in a collated document. Or you can
selectively disable the automatic generation of either doc covers or
covers in a collated document on-the-fly.
</p>
<div id="important-note" class="box-important">
<p class="tip">
<span class="important">Important note:</span>
Automatic generation of covers or doc covers after the first one(s)
only takes place if you are working with collated documents. Mom
provides no mechanism for saying &#8221;print a section cover
here even though I&#8217;m still working on the same (non-collated)
document.&#8221;
</p>
</div>
<h3 id="desc" class="docs">Description of cover pages</h3>
<p>
By default, mom typesets covers and doc covers identically to
<a href="definitions.html#docheader">docheaders</a>
(see
<a href="docprocessing.html#docheader-control">How to change the look of docheaders</a>
for a description of what a docheader looks like). The only
differences are
</p>
<ul style="margin-top: -.5em; margin-bottom: -.5em;">
<li>the position on the page where the information is output</li>
<li>the (optional) addition of copyright and miscellaneous information</li>
<li>there&#8217;s no running text underneath, although you can add text
to a cover or doc cover (for example, an Abstract) with
<a href="#covertext">COVERTEXT</a>
</li>
</ul>
<p>
You tell mom what you want to appear on cover pages through the
arguments you pass to
<a href="#cover">DOC_COVER</a>
and/or
<a href="#cover">COVER</a>.
Provided you have already given mom the appropriate reference macros
(e.g.
<a href="docprocessing.html#title">TITLE</a>
or
<a href="docprocessing.html#author">AUTHOR</a>),
she will output covers and doc covers identically to how she
would output docheaders containing the same information.
</p>
<p>
By default, mom starts covers and doc covers one-third of the way
down the page. This can be changed through the use of the control
macros DOC_COVER_START_POS / COVER_START_POS (or DOC_COVER_ADVANCE /
COVER_ADVANCE).
</p>
<p>
If you request copyright information (and have already given mom the
reference macro
<a href="docprocessing.html#copyright">COPYRIGHT</a>)
she sets it, by default, in a smaller
<a href="definitions.html#ps">point size</a>
in the bottom right hand corner of the cover or doc cover. The
position, as well as all of the standard typesetting parameters, can be
altered via control macros.
</p>
<p>
Similarly, if you request miscellaneous information (and have
already given mom the reference macro
<a href="docprocessing.html#misc">MISC</a>)
she sets it, by default, in a smaller point size in the bottom left
hand corner of the cover or doc cover. As with the copyright, the
position and type specs can be altered via control macros.
</p>
<h3 id="pagination" class="docs">Headers/footers/pagination</h3>
<p>
Mom does not set any
<a href="definitions.html#header">headers</a>
or
<a href="definitions.html#footer">footers</a>
on cover pages. Neither does she set any page numbers. From
the point of view of pagination, covers and doc covers are by
default considered &#8221;null&#8221; pages. If you wish them to
be included in the pagination scheme (even though no page numbers
appear), you must tell mom that&#8217;s what you want by invoking
<br/>
<span class="pre-in-pp">
.DOC_COVER_COUNTS_PAGES
</span>
or
<br/>
<span class="pre-in-pp">
.COVER_COUNTS_PAGES
</span>
</p>
<h3 id="design" class="docs">Designing your own cover pages</h3>
<p>
Finally, if you want to design your own cover page(s), you can
typeset them by hand inside a
<a href="#covertext">COVERTEXT</a>
block using mom&#8217;s typesetting macros to format the text.
</p>
<h3 id="persistence" class="docs">Persistence of data and formatting</h3>
<p>
Doc-cover and cover data&mdash;that is to say, the strings passed to
reference macros that appear on doc cover and cover
pages&mdash;do not persist after
<a href="docprocessing.html#start">START</a>,
however the formatting of the various parts (TITLE, AUTHOR,
COPYRIGHT, etc.) does.
</p>
<div class="macro-list-container">
<h3 id="index-covers" class="macro-list">Cover and document cover macros</h3>
<ul class="macro-list">
<li><a href="#cover">DOC_COVER and COVER</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#cover-args">The arguments: saying what goes on doc cover and cover pages</a></li>
</ul></li>
<li><a href="#covertext">DOC_COVERTEXT / COVERTEXT</a></li>
<li><a href="#doc-coverimage">DOC_COVER_IMAGE / COVER_IMAGE</a></li>
<li><a href="#on-off">Enabling/disabling automatic generation of cover pages</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#doc-covers">DOC_COVERS</a></li>
<li><a href="#covers">COVERS</a></li>
</ul></li>
<li><a href="#cover-control">Control macros for doc covers and covers</a></li>
</ul>
</div>
<!-- -COVER- -->
<div class="macro-id-overline">
<h3 id="cover" class="macro-id">DOC_COVER and COVER</h3>
</div>
<div id="doc-cover" class="box-macro-args">
Macro: <b>DOC_COVER</b> <kbd class="macro-args">(see argument list, below)</kbd>
</div>
<div class="box-macro-args" style="margin-top: 1em;">
Macro: <b>COVER</b> <kbd class="macro-args">(see argument list, below)</kbd>
</div>
<p>
DOC_COVER and COVER behave identically. The reason mom provides
two macros for cover page generation is so that you can have two
different kinds of covers with different information on each.
</p>
<p>
Imagine, for a moment, you&#8217;ve written a document comprised of
three sections. When you
<a href="rectoverso.html#collate">COLLATE</a>
the document for output, you could use DOC_COVER to generate a cover
page that contained the name of the entire document, your (the
author&#8217;s) name, and perhaps the copyright date. Subsequently,
you could use COVER, after each <kbd>.COLLATE</kbd> but before each
<kbd><a href="docprocessing.html#start">.START</a></kbd>,
to generate a cover page (title page, cover sheet) containing
just the name of the section, for example, &#8220;Part 1&#8221;.
</p>
<p>
The arguments to <kbd>DOC_COVER</kbd> and <kbd>COVER</kbd> tell mom
what you&#8217;d like on cover pages. You may give as many or as
few arguments as you need, in any order. A very common setup would
be:
<br/>
<span class="pre-in-pp">
.COVER TITLE AUTHOR COPYRIGHT
</span>
</p>
<h4 id="cover-args" class="docs" style="margin-top: -1em;">The argument list</h4>
<p style="margin-top: 1em">
The arguments to <kbd>COVER</kbd> and <kbd>DOC_COVER</kbd> tell mom
what you want on the cover page:
<br/>
<span class="pre-in-pp">
TITLE | DOCTITLE | DOC_COVERTITLE | COVERTITLE
CHAPTER | CHAPTER_TITLE | CHAPTER+TITLE
SUBTITLE
AUTHOR
DOCTYPE
DOC_COVERTEXT | COVERTEXT
DOC_COVER_IMAGE | COVER_IMAGE
COPYRIGHT
MISC
PDF_OUTLINE_LABEL "&lt;label&gt;"
BLANKPAGE
</span>
</p>
<h4 id="meanings" class="docs" style="margin-top: -1em;">What the arguments mean</h4>
<dl>
<dt class="params">TITLE</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#title">TITLE</a>
</dd>
<dt class="params">DOCTITLE</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#doc-title">DOCTITLE</a>
</dd>
<dt class="params">DOC_COVERTITLE / COVERTITLE</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#doc-covertitle">DOC_COVERTITLE</a>
or
<a href="docprocessing.html#covertitle">COVERTITLE</a>
</dd>
<dt class="params">CHAPTER, CHAPTER_TITLE, CHAPTER+TITLE</dt>
<dd class="cover-args">&ndash; see below,
<a href="#chapter">How the CHAPTER argument and friends work</a>
</dd>
<dt class="params">SUBTITLE</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#subtitle">SUBTITLE</a>
</dd>
<dt class="params">AUTHOR</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#author">AUTHOR</a>
</dd>
<dt class="params">DOCTYPE</dt>
<dd class="cover-args">&ndash; the string you gave to
<a href="docprocessing.html#doctype">DOCTYPE NAMED</a>
</dd>
<dt class="params">DOC_COVERTEXT / COVERTEXT</dt>
<dd class="cover-args">&ndash; the block of type you entered for
<a href="#covertext">DOC_COVERTEXT</a>
or
<a href="#covertext">COVERTEXT</a>
</dd>
<dt class="params">DOC_COVER_IMAGE / COVER_IMAGE</dt>
<dd class="cover-args">&ndash; the image file you gave to
<a href="#covertext">DOC_COVER_IMAGE</a>
or
<a href="#covertext">COVER_IMAGE</a>
</dd>
<dt class="params">COPYRIGHT</dt>
<dd class="cover-args">&ndash; the string you gave to
<a href="docprocessing.html#copyright">COPYRIGHT</a>
</dd>
<dt class="params">MISC</dt>
<dd class="cover-args">&ndash; the string(s) you gave to
<a href="docprocessing.html#misc">MISC</a>
</dd>
<dt class="params">PDF_OUTLINE_LABEL &lt;label&gt;</dt>
<dd class="cover-args">
<span style="display:block; margin-left: 1em">
By default, mom identifies doc covers in the outline panel of PDF
viewers with the prepended label, &#8220;Cover:&#8221;, and covers
with the label &#8220;Title Page:&#8221;. If you would like
to change the label, give the <kbd>PDF_OUTLINE_LABEL</kbd>
argument to DOC_COVER or COVER along with the new label, in
quotation marks, as in this example:
<br/>
<kbd>&nbsp;&nbsp;.COVER TITLE AUTHOR COPYRIGHT PDF_LABEL "Cover Sheet: "</kbd>
</span>
</dd>
<dt class="params">BLANKPAGE</dt>
<dd class="cover-args">
<span style="display:block; margin-left: 1em">
If the final argument to DOC_COVER or COVER is <kbd>BLANKPAGE</kbd>,
mom will insert a blank page after the doc cover or cover. This is
particularly useful if you intend to print your document two-sided,
since, in two-sided printing, there may be instances where you do
not want text on the reverse side of cover or title pages
</span>
<span style="display:block; margin-left: 1em; margin-top: .5em">
If you enable
<a href="#pagination">DOC_COVERS_COUNT_PAGES</a>
and/or
<a href="#pagination">COVERS_COUNT_PAGES</a>,
the blank page will be taken into account in the pagination
scheme, though no page number appears on it. Otherwise, blank
pages are invisible to mom&#8217;s pagination.
</span>
</dd>
</dl>
<p>
Please note that in all cases, if you have passed
a reference macro one of the optional arguments
<kbd>DOC_COVER</kbd> or <kbd>COVER</kbd> (e.g.
<kbd>.TITLE&nbsp;DOC_COVER&nbsp;"Title"</kbd>), mom will print the
appropriate string on the appropriate cover page. Thus,
<br/>
<span class="pre-in-pp">
.TITLE DOC_COVER "Collected Essays"
.TITLE COVER "1985-2015"
.TITLE "Neo-liberalism: Who Did They Think They Were Fooling?"
.DOC_COVER TITLE
.COVER TITLE
</span>
will print &#8220;Collected Essays&#8221; on the doc cover page,
&#8220;1985-2015&#8221; on the cover page, and, assuming the
docheader hasn&#8217;t been disabled, &#8220;Neo-liberalism: Who
Did They Think They Were Fooling?&#8221; as the title in the
docheader.
</p>
<p>
Note that
<br/>
<span class="pre-in-pp">
.DOC_COVERTITLE "Collected Essays"
.COVERTITLE "1985-2015"
.TITLE "Neo-liberalism: Who Did They Think They Were Fooling?"
.DOC_COVER DOC_COVERTITLE
.COVER COVERTITLE
</span>
could be used to accomplish the same thing.
</p>
<h5 id="chapter" class="docs" style="margin-top: 0; text-transform: none;">How the CHAPTER argument and friends work</h5>
<p style="margin-top: .75em">
<span style="display: block; margin-bottom: -1.25em; font-weight: bold;">&bull;&nbsp;CHAPTER</span>
<br/>
The <kbd>CHAPTER</kbd> argument will print the
<a href="docprocessing.html#chapter-string">CHAPTER_STRING</a>
concatenated with the chapter number you gave to
<a href="docprocessing.html#chapter">CHAPTER</a>.
For example, assuming a vanilla setup for your chapter:
<br/>
<span class="pre-in-pp" style="color: #64614a;">
.CHAPTER 1
.CHAPTER_TITLE "The Bonny Blue Yonder"
<span style="color: #941614;">.COVER CHAPTER</span> \" (or <span style="color: #941614;">.DOC_COVER CHAPTER</span>)
</span>
will print (and only print)
<br/>
<span class="pre-in-pp">
Chapter 1
</span>
</p>
<p style="margin-top: -1em;">
<span style="display: block; margin-bottom: -1.25em; font-weight: bold;">&bull;&nbsp;CHAPTER_TITLE</span>
<br/>
The <kbd>CHAPTER_TITLE</kbd> argument will print the chapter title
you gave to
<a href="docprocessing.html#chapter-title">CHAPTER_TITLE</a>.
For example, assuming a vanilla setup for your chapter:
<br/>
<span class="pre-in-pp" style="color: #64614a;">
.CHAPTER 1
.CHAPTER_TITLE "The Bonny Blue Yonder"
<span style="color: #941614;">.COVER CHAPTER_TITLE</span> \"(or <span style="color: #941614;">.DOC_COVER CHAPTER_TITLE</span>)
</span>
will print (and only print)
<br/>
<span class="pre-in-pp">
The Bonny Blue Yonder
</span>
</p>
<p style="margin-top: -1em;">
<span style="display: block; margin-bottom: -1.25em; font-weight: bold;">&bull;&nbsp;CHAPTER+TITLE</span>
<br/>
The <kbd>CHAPTER+TITLE</kbd> argument will print both the
concatenated chapter string+number and the chapter title. For
example, assuming a vanilla setup for your chapter:
<br/>
<span class="pre-in-pp" style="color: #64614a;">
.CHAPTER 1
.CHAPTER_TITLE "The Bonny Blue Yonder"
<span style="color: #941614;">.COVER CHAPTER+TITLE</span> \"(or <span style="color: #941614;">.DOC_COVER CHAPTER+TITLE</span>)
</span>
will print
<br/>
<span class="pre-in-pp">
Chapter 1
The Bonny Blue Yonder
</span>
</p>
<div class="macro-id-overline">
<h3 id="covertext" class="macro-id">DOC_COVERTEXT and COVERTEXT</h3>
</div>
<div class="box-macro-args">
Macro: <b>DOC_COVERTEXT</b> <kbd class="macro-args">[START &lt;starting position&gt;] &lt;toggle&gt;</kbd>
</div>
<div class="box-macro-args" style="margin-top: 1em;">
Macro: <b>COVERTEXT</b> <kbd class="macro-args">[START &lt;starting position&gt;] &lt;toggle&gt;</kbd>
</div>
<p class="requires">
&bull;&nbsp;Must come after
<a href="#printstyle"><span class="normal">PRINTSTYLE</span></a>
</p>
<p>
<kbd>DOC_COVERTEXT</kbd> and <kbd>COVERTEXT</kbd> allow you to add
text to doc covers and covers in addition to, or instead of, what is
generated by mom from the arguments you give to
<a href="#doccover">DOC_COVER</a>
and
<a href="#doccover">COVER</a>.
</p>
<p>
Invoke <kbd>.DOC_COVERTEXT</kbd> or <kbd>.COVERTEXT</kbd> on a line
by itself, follow it with the text and formatting you desire, and
terminate the text block with <kbd>.DOC_COVERTEXT&nbsp;OFF</kbd> or
<kbd>COVERTEXT&nbsp;OFF</kbd> (or <kbd>QUIT, END, DONE</kbd>, etc.).
</p>
<p>
By default, cover text is set over the full line length of the
document, using the style parameters of
<a href="definitions.html#running">running text</a>.
Therefore, as noted, these macros must come after PRINTSTYLE
and any global style changes (margins, family, size, leading,
etc.). Formatting within a cover text block must be done
&#8220;manually&#8221; with mom&#8217;s typesetting macros;
<a href="docelement.html#pp">PP</a>
is the only allowed document element tag.
</p>
<h4 id="placement" class="docs">Placement</h4>
<p>
If you do not instruct mom to put anything on doc cover or cover
pages except <kbd>DOC_COVERTEXT</kbd> or <kbd>COVERTEXT</kbd>, the
cover text will begin at the document&#8217;s top margin.
Equally, if only <kbd>COPYRIGHT</kbd> and/or <kbd>MISC</kbd> are
to go on the pages, cover text begins at the top margin. In all
other cases, cover text begins below the last element on the page
(excluding COPYRIGHT or MISC), separated by a blank line.
</p>
<p>
If you wish to change the starting position of the text, you must
use
<a href="typesetting.html#space">SP</a>
or
<a href="typesetting.html#ald">ALD</a>
to move it further down the page. Alternatively, you may use the
optional START argument to give a precise location for the text to
begin.
</p>
<p>
<kbd>DOC_COVERTEXT</kbd> and <kbd>COVERTEXT</kbd> are particularly
useful for putting abstracts on cover pages, as technical reports
often require.
</p>
<p>
Here&#8217;s a simple recipe for setting an abstract:
<br/>
<span class="pre-in-pp">
.COVERTEXT
.FT BI
.PT_SIZE 14
.LS 14
.CENTER
Abstract
.SP .5v
.FT R
.PT_SIZE 12
.IB 6P
.JUSTIFY
Text of Abstract...
.COVERTEXT OFF
</span>
Assuming you have told mom to put the title and author on the
cover page, the abstract will appear beneath the author with a
14-point bold-italic title, centered, with the text of the abstract
medium-roman and justified, indented 6 picas from both margins.
</p>
<div class="macro-id-overline">
<h3 id="coverimages" class="macro-id">DOC_COVER_IMAGE and COVER_IMAGE</h3>
</div>
<div id="doc-coverimage" class="box-macro-args">
Macro: <b>DOC_COVER_IMAGE</b> <kbd class="macro-args">&lt;image&gt; &lt;width&gt; &lt;height&gt; [ -L | -C | -R | -I &lt;indent&gt; &lt;Y-pos&gt; [ &lt;X-pos&gt; ] ]</kbd>
</div>
<div id="coverimage" class="box-macro-args" style="margin-top: 1em;">
Macro: <b>COVER_IMAGE</b> <kbd class="macro-args">&lt;image&gt; &lt;width&gt; &lt;height&gt; [ -L | -C | -R | -I &lt;indent&gt; &lt;Y-pos&gt; [ &lt;X-pos&gt; ] ]</kbd>
</div>
<p>
There are times you need a full page image on a cover, for example
the jacket of a book. Equally, there are times when you need a small
image on the cover, perhaps a company logo.
</p>
<p>
DOC_COVER_IMAGE and COVER_IMAGE take the same arguments
as PDF_IMAGE, and in the same order. Consult
<a href="images.html#pdf-image">PDF_IMAGE</a>
for a description.
</p>
<p>
Two additional arguments allow you to place images using x-y
coordinates. Please note that if you use x-y coordinates for
positioning, <b>Y-pos</b> comes before <b>X-pos</b> in the order of
arguments.
</p>
<p>
Like PDF_IMAGE, the image file must be in PDF format. Mom
apologizes, but PostScript images are not supported for inclusion on
covers. See
<a href="images.html#pdf">Image conversion and file processing</a>
for instructions on converting various image types to PDF, and
<a href="images.html#bounding-box">here</a>
for instructions on obtaining image dimensions.
</p>
<h4 id="positioning" class="docs">Positioning of doc cover and cover images</h4>
<p>
With no arguments other than <kbd>&lt;file name&gt;</kbd>,
<kbd>&lt;width&gt;</kbd>, and <kbd>&lt;height&gt;</kbd>,
DOC_COVER_IMAGE and COVER_IMAGE place images flush with the top
left corner of the printer sheet. This allows placing full-page
background images on covers. For example, assuming a US-letter page
size,
<br/>
<span class="pre-in-pp">
.DOC_COVER_IMAGE image.pdf 612p 792p
.DOC_COVER TITLE AUTHOR DOC_COVER_IMAGE
</span>
will fill the doc cover page with &#8220;image.pdf&#8221; and set
the title and author in their usual locations.
</p>
<p>
For smaller images, the horizontal position is established
with one of the <kbd>-L</kbd>, <kbd>-C</kbd>, <kbd>-R</kbd>, or
<kbd>-I&nbsp;&lt;indent&gt;</kbd> arguments, just like
<a href="images.html#pdf-image">PDF_IMAGE</a>.
You may instead use the <kbd>X-pos</kbd> argument, provided that it
is preceded by a <kbd>Y-pos</kbd> argument. The values given to
<kbd>-I</kbd>, <kbd>Y-pos</kbd> and <kbd>X-pos</kbd> must have a
<a href="definitions.html#unitofmeasure">unit of measure</a>
appended to them.
</p>
<p>
Vertical positioning of smaller images requires the <kbd>Y-pos</kbd>
argument (which is why it precedes <kbd>X-pos</kbd> in the order of
arguments) otherwise the image will be flush with the top edge of
the printer sheet
</p>
<p>
The positioning of images does not effect the placement of type on
doc cover and cover pages.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Tip:</span>
The combination of
<a href="#covertext">COVERTEXT</a>
and COVER_IMAGE make it possible to design covers entirely to your
own specifications.
</p>
</div>
<div class="macro-id-overline" style="margin-top: .5em">
<h3 id="on-off" class="macro-id">Enabling/disabling automatic generation of cover pages</h3>
</div>
<div id="covers" class="box-macro-args" style="margin-top: .5em">
Macro: <b>COVERS</b> <kbd class="macro-args">&lt;toggle&gt;</kbd>
</div>
<div id="doc-covers" class="box-macro-args" style="margin-top: 1em;">
Macro: <b>DOC_COVERS</b> <kbd class="macro-args">&lt;toggle&gt;</kbd>
</div>
<p>
By default, if you give mom a
<a href="#cover">COVER</a>
or
<a href="#doc-cover">DOC_COVER</a>
directive, she will print the cover or doc cover. In a document
that contains sections, articles or chapters formerly treated as
&#8221;one-off&#8217;s&#8221; but now being
<a href="rectoverso.html#collate-intro">collated</a>,
such behaviour may not be desirable.
</p>
<p>
Mom lets you selectively enable or disable the generation of covers
and/or doc covers with the toggle macros, COVERS and DOC_COVERS.
Because they&#8217;re toggle macros, simply invoking them by
themselves enables automatic cover or doc cover generation, while
invoking them with any argument at all (<kbd>OFF, QUIT, X</kbd>,
etc) disables cover or doc cover generation. </p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
You must place these macros prior to any instance of
<a href="docprocessing.html#start">START</a>.
Since they&#8217;re &#8221;on&#8221; by default, there&#8217;s no
need to use them if you want covers. However, if you don&#8217;t,
especially in the kind of scenario described above, the best place
to put them (most likely with an <kbd>OFF, NO, X</kbd>, etc. argument),
is immediately after the first invocation of START. By doing so,
you ensure they meet the requirement of preceding all subsequent
instances of START.
</p>
</div>
<div class="rule-short"><hr/></div>
<h2 id="cover-control" class="macro-group">Control macros for doc covers and covers</h2>
<p>
The default typographic appearance of the items on a doc cover or
cover is identical to that of the items in a
<a href="definitions.html#docheader">docheader</a>.
(See
<a href="docprocessing.html#docheader-desc">Docheader description</a>
for a description of the defaults.)
</p>
<p>
<a href="docprocessing.html#copyright">COPYRIGHT</a>
and
<a href="docprocessing.html#misc">MISC</a>,
which do not appear in docheaders, have the following default
characteristics:
</p>
<ul style="margin-top: -.5em; margin-bottom: -.5em;">
<li>the COPYRIGHT line is set flush with the document&#8217;s right
and bottom margins, 2
<a href="definitions.html#ps">point sizes</a>
smaller than the size of
<a href="definitions.html#running">running text</a>
</li>
<li>MISC lines are set flush with the document&#8217;s left and bottom
margins, in the same family, font and point size as the
copyright line.
</li>
</ul>
<p>
The defaults for the entirety of doc covers and covers, and all the
elements thereon, can be changed with control macros whose defaults
and arguments are identical to the corresponding
<a href="docprocessing.html#index-docheader-control">Control macros for docheaders</a>
(q.v.) The only difference is the name by which you invoke them. Wherever
<kbd>DOCHEADER</kbd> is used for overall changes, replace it
with <kbd>DOC_COVER</kbd> or <kbd>COVER</kbd>. For part-by-part
changes, prepend <kbd>DOC_COVER_</kbd> or <kbd>COVER_</kbd> to the
part/parameter.
</p>
<p>
Thus, to change the overall family, color, leading, quad, and
starting position of a doc cover, you&#8217;d do
<br/>
<span class="pre-in-pp">
.DOC_COVER_FAMILY H
.DOC_COVER_COLOR blue
.DOC_COVER_LEAD +2
.DOC_COVER_QUAD L
.DOC_COVER_ADVANCE 3i \" or .DOC_COVER_START_POS 3i
</span>
To change the style parameters for selected parts of a cover, you
might do something like this:
<br/>
<span class="pre-in-pp">
.COVER_TITLE_FONT B
.COVER_TITLE_SIZE +4
.COVER_SUBTITLE_FONT I
.COVER_AUTHOR_FONT R
.COVER_AUTHOR_SPACE_BEFORE 6p
.COVER_DOCTYPE_COLOR red
.COVER_MISC_SIZE -1
.COVER_MISC_LEAD 12
.COVER_COPYRIGHT_SIZE -2
.COVER_COPYRIGHT_QUAD L
.COVER_MISC_QUAD R
</span>
Note in the above example that _COPYRIGHT_QUAD and _MISC_QUAD set
both the horizontal position on the page and the quad direction,
either L (or LEFT) or R (or RIGHT), and have no corresponding
docheader control macro.
</p>
<div class="box-tip">
<p class="tip-top">
<span class="note">Tip:</span>
As with the docheader control macros, <kbd>DOC_COVER_</kbd> and
<kbd>COVER_</kbd> part/parameter style changes may be
<a href="docprocessing.html#grouping">grouped</a>,
for example
<br/>
<span class="pre-in-pp">
.DOC_COVER_TITLE_STYLE \
FAMILY A \
FONT B \
SIZE +4 \
CAPS
</span>
</p>
</div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="tables-of-contents.html">Next: Tables of contents</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,996 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Definitions and Terms</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="using.html#top">Next: Using mom</a></td>
</tr>
</table>
<h1 id="terms" class="docs">Definitions of terms used in this manual</h1>
<p>
I use a number of typesetting-specific and groff-specific terms
throughout this documentation, as well as a few terms that apply
to mom herself. To make life easier, I&#8217;ll explain
them here. Refer back to this section should you encounter a word
or concept you&#8217;re not familiar with.
</p>
<div class="rule-short" style="margin-top: 18px; margin-bottom: 28px;"><hr/></div>
<div class="col-1-definitions">
<table class="definitions">
<tr><th class="definitions">Typesetting terms</th></tr>
<tr>
<td>
<a href="#ascender">Ascender</a><br/>
<a href="#baseline">Baseline</a><br/>
<a href="#ballotbox">Ballot box</a><br/>
<a href="#bullet">Bullet</a><br/>
<a href="#capheight">Cap-height</a><br/>
<a href="#descender">Descender</a><br/>
<a href="#discretionaryhyphen">Discretionary hyphen</a><br/>
<a href="#dropcap">Drop cap</a><br/>
<a href="#em">Em/en</a><br/>
<a href="#family">Family</a><br/>
<a href="#figurespace">Figure space/Digit space</a><br/>
<a href="#fixedwidthfont">Fixed width font</a><br/>
<a href="#fixedwidthspace">Fixed width space</a><br/>
<a href="#font">Font</a><br/>
<a href="#force">Force justify</a><br/>
<a href="#just">Justify/justification</a><br/>
<a href="#gutter">Gutter</a><br/>
<a href="#kern">Kerning</a><br/>
<a href="#kernunit">Kern Units</a><br/>
<a href="#leading">Lead/leading</a><br/>
<a href="#leader">Leaders</a><br/>
<a href="#ligatures">Ligature</a><br/>
<a href="#picaspoints">Picas/Points</a><br/>
<a href="#ps">Point Size</a><br/>
<a href="#quad">Quad</a><br/>
<a href="#rag">Rag</a><br/>
<a href="#shape">Shape</a><br/>
<a href="#solid">Solid/set solid</a><br/>
<a href="#trackkerning">Track kerning/Line kerning</a><br/>
<a href="#unbreakablespace">Unbreakable space</a><br/>
<a href="#weight">Weight</a><br/>
<a href="#wordspace">Word space</a><br/>
<a href="#xheight">x-height</a><br/>
</td>
</tr>
</table>
</div>
<div class="col-2-definitions">
<table class="definitions">
<tr><th class="definitions">Groff terms</th></tr>
<tr>
<td>
<a href="#alias">Alias</a><br/>
<a href="#arguments">Arguments</a><br/>
<a href="#commentlines">Comment lines</a><br/>
<a href="#controllines">Control Lines</a><br/>
<a href="#filled">Filled lines</a><br/>
<a href="#inlines">Inline escapes</a><br/>
<a href="#inputline">Input line</a><br/>
<a href="#macros">Macros</a><br/>
<a href="#units">Machine units</a><br/>
<a href="#numericargument">Numeric argument</a><br/>
<a href="#outputline">Output line</a><br/>
<a href="#primitives">Primitives</a><br/>
<a href="#preprocessor">Pre-processor</a><br/>
<a href="#stringargument">String Argument</a><br/>
<a href="#unitofmeasure">Unit of measure</a><br/>
<a href="#zerowidthcharacter">Zero-width character</a><br/>
</td>
</tr>
</table>
</div>
<div class="col-3-definitions">
<table class="definitions">
<tr><th class="definitions">Mom terms</th></tr>
<tr>
<td>
<a href="#baseline-grid">Baseline grid</a><br/>
<a href="#blockquote">Blockquote</a><br/>
<a href="#controlmacro">Control macro</a><br/>
<a href="#docheader">Docheader</a><br/>
<a href="#epigraph">Epigraph</a><br/>
<a href="#float">Float</a><br/>
<a href="#footer">Footer</a><br/>
<a href="#head">Head</a><br/>
<a href="#header">Header</a><br/>
<a href="#linebreak">Linebreak</a><br/>
<a href="#parahead">Paragraph head</a><br/>
<a href="#pdflink">PDF link</a><br/>
<a href="#pdfoutline">PDF outline</a><br/>
<a href="#quote">Quote</a><br/>
<a href="#running">Running text</a><br/>
<a href="#toggle">Toggle</a><br/>
</td>
</tr>
</table>
</div>
<h3 id="typesetting-terms" class="docs">Typesetting terms</h3>
<dl>
<dt id="ascender">Ascender</dt>
<dd>
The portion of a letter that extends above the bowl. For
example, the letters a, c, and e have no ascenders. The letters
b, d, and h do.
</dd>
<dt id="baseline">Baseline</dt>
<dd>
The imaginary line on which the bottoms of capital letters and
the bowls of lower case letters rest.
</dd>
<dt id="ballotbox">Ballot box</dt>
<dd>
An unfilled square, usually
<a href="#capheight">cap-height</a>
in size, typically placed beside items in a checklist.
</dd>
<dt id="bullet">Bullet</dt>
<dd>
A small, filled circle typically found beside items or points in
a list.
</dd>
<dt id="capheight">Cap-height</dt>
<dd>
The height of the tallest capital letter in a given
<a href="#font">font</a>
at the current
<a href="#ps">point size</a>.
</dd>
<dt id="descender">Descender</dt>
<dd>
The portion of a letter that extends beneath the
<a href="#baseline">baseline</a>
(j, q, y are letters with descenders).
</dd>
<dt id="discretionaryhyphen">Discretionary hyphen</dt>
<dd>
A symbol inserted between two syllables of a word that indicates
to a typesetting program the valid hyphenation points in the
word. Normally, if hyphenation is turned on, groff knows where
to hyphenate words. However, hyphenation being what it is
(in English, at any rate), groff doesn&#8217;t always get it right.
Discretionary hyphens make sure it does. In the event that the
word doesn&#8217;t need to be hyphenated at all, groff leaves them
alone. In groff, the discretionary hyphen is entered with
<kbd>\%</kbd> (i.e. a backslash followed by the percent sign).
</dd>
<dt id="dropcap">Drop cap</dt>
<dd>
A large, usually upper-case letter that introduces the first
paragraph of a document or section thereof. The top of the
drop cap usually lines up with the top of the first line of the
paragraph, and typically &#8220;drops&#8221; several lines lower.
Text adjacent to the drop cap is indented to the right of the
letter until the bottom of the drop cap is reached, at which
point text reverts to the left margin.
</dd>
<dt id="em">Em/en</dt>
<dd>
An em is a relative measurement equal to the width of the
letter M at a given
<a href="#ps">point size</a>
in a given
<a href="#font">font</a>.
Since most Ms are designed square, an em is usually (but
sometimes erroneously) considered to be the same size as the
current point size (i.e., if the point size of the type is 12,
one em equals 12 points). An en is equal to the width of a
letter N (historically 2/3 of an em, although groff treats an en
as 1/2 of an em). Typically, ems and ens are used to measure
indents, or to define the length of dashes (long hyphens).
</dd>
<dt id="family">Family</dt>
<dd>
The collective name by which a collection of
<a href="#font">fonts</a>
are known, e.g. Helvetica, Times Roman, Garamond.
</dd>
<dt id="figurespace">Figure space/Digit space</dt>
<dd>
A
<a href="#fixedwidthspace">fixed width space</a>
that has the width of one digit. Used for aligning numerals in,
say, columns or numbered lists. In groff, the figure space is
entered with <kbd>\0</kbd> (i.e. a backslash followed by a zero)
</dd>
<dt id="fixedwidthfont">Fixed-width font</dt>
<dd>
A family or font in which every character occupies exactly the
same amount of horizontal space on the line. Courier is the
best-known, if not the most elegant, fixed-width font.
</dd>
<dt id="fixedwidthspace">Fixed width space</dt>
<dd>
Equal to
<a href="#wordspace">word space</a>,
but does not expand or contract when text is
<a href="#just">justified</a>.
In groff, fixed width space is entered with
<kbd>\&lt;space&gt;</kbd> (i.e. a backslash followed by a space)
</dd>
<dt id="font">Font</dt>
<dd>
The specific
<a href="#weight">weight</a>
and
<a href="#shape">shape</a>
of type within a
<a href="#family">family</a>,
e.g. light, medium, bold (which are weights), and roman, italic,
condensed (which are shapes). By default, groff knows of four
fonts within its default set of families: R (medium roman), I
(medium italic), B (bold roman) and BI (bold italic).
Mom considerably extends this very basic list.
</dd>
<dt id="force">Force justify</dt>
<dd>
Sometimes, in
<a href="#just">justified</a>
text, a line needs to be broken short of the right margin.
Force justifying means telling a typesetting program (like
groff) that you want the line broken early AND that you want the
line&#8217;s word spacing stretched to force the line flush with the
right margin.
</dd>
<dt id="gutter">Gutter</dt>
<dd>
The vertical whitespace separating columns of type.
</dd>
<dt id="just">Justify/justification</dt>
<dd>
Lines of type are justified when they&#8217;re flush at both the left
and right margins. Justification is the act of making both
margins flush. Some people use the terms "left justified" and
"right justified" to mean type where only the left (or right)
margins align. I don&#8217;t. See
<a href="#quad">quad</a>.
</dd>
<dt id="kern">Kerning</dt>
<dd>
Moving pairs of letters closer together to remove excess
whitespace between them. In the days before phototypesetting,
type was set from small, rectangular blocks of wood or metal,
each block having exactly one letter. Because the edge of
each block determined the edge of each letter, certain letter
combinations (TA, for example) didn&#8217;t fit together well and had
to be mortised by hand to bring them visually closer. Modern
typesetting systems usually take care of kerning automatically,
but they&#8217;re far from perfect. Professional typesetters still
devote a lot of time to fitting letters and punctuation together
properly.
</dd>
<dt id="kernunit">Kern Units</dt>
<dd>
A relative distance, which, by default, is equal to 1/36 of the
current
<a href="#ps">point size</a>.
Used between individual letters for
<a href="#kern">kerning</a>.
Different typesetting systems use different values (1/54 is
popular), and sometimes call kern units by a different name.
It is possible to change the default size of the kern unit with the
<a href="inlines.html#kernunit">KERN_UNIT</a>
macro.
</dd>
<dt id="leading">Lead/leading</dt>
<dd>
The distance from the
<a href="#baseline">baseline</a>
of one line of type to the line of type immediately beneath
it. Pronounced "ledding." Also called line spacing. Usually
measured in
<a href="#picaspoints">points</a>.
<p>
<em>In case you&#8217;re interested...</em> In previous centuries,
lines of type were separated by thin strips of&mdash;you guessed
it&mdash;lead. Lines of type that had no lead between them were said
to be &#8220;set solid.&#8221; Once you began separating them with
strips of lead, they were said to be &#8220;leaded&#8221;, and the
spacing was expressed in terms of the number of
<a href="#picaspoints">points</a>
of lead. For this reason, &#8220;leading&#8221; and &#8220;line
spacing&#8221; aren&#8217;t, historically speaking, synonymous.
If type was set 10 on 12, for example, the leading was 2
points, not 12. Nowadays, however, the two terms are used
interchangeably to mean the distance from baseline to baseline.
</p>
</dd>
<dt id="leader">Leaders</dt>
<dd>
Single characters used to fill lines, usually to their end. So
called because they &#8220;lead&#8221; the eye from one element
of the page to another. For example, in the following (brief)
Table of Contents, the periods (dots) are leaders.
<span class="pre" style="margin-bottom: -2em;">
Foreword............... 2
Chapter 1.............. 5
Chapter 2.............. 38
Chapter 3.............. 60
</span>
</dd>
<dt id="ligatures">Ligature</dt>
<dd>
Ligatures are letters joined together to form a single
character. The commonest are fi, fl, ff, ffi and ffl. Others
are ae and oe. Occasionally, one sees an st ligature, but this
is archaic and quite rare.
</dd>
<dt id="picaspoints">Picas/Points</dt>
<dd>
There are twelve points in a pica, and six picas in an inch
(hence 72 points to the inch). In the same way that gem-dealers
have always used their own system of measurement for weight
(carats), typographers have always used their own system of
measurement for type.
</dd>
<dt id="ps">Point Size</dt>
<dd>
The nominal size of type, measured in
<a href="#picaspoints">points</a>
from the bottom of the longest
<a href="#descender">descender</a>
to the top of the highest
<a href="#ascender">ascender</a>.
In reality, type is always fractionally smaller than its point
size.
</dd>
<dt id="quad">Quad</dt>
<dd>
When only one margin of type is flush, lines of type are quadded
in the direction of the flush margin. Therefore, quad left
means the left margin is flush, the right isn&#8217;t. Quad right
means the right margin is flush, the left isn&#8217;t. Quad centre
means neither the left nor the right margin is flush; rather,
lines of type are quadded on both sides so that type appears
centred on the page.
</dd>
<dt id="rag">Rag</dt>
<dd>
Describes a margin that isn&#8217;t flush. Rag right means the right
margin isn&#8217;t flush. Rag left means the left margin isn&#8217;t flush.
The expression "flush left/rag right" is sometimes used to
describe type that is
<a href="#quad">quadded</a>
left.
</dd>
<dt id="shape">Shape</dt>
<dd>
The degree of slant and/or the width of characters.
(Technically speaking, this is not a proper typesetting term;
however, it may help clarify some concepts presented in these
documents.)
<p>
Some typical shapes are:
</p>
<ul style="margin-top: -.5em; margin-bottom: -.5em">
<li>Roman, which has no slant, and has letterforms of
average width</li>
<li>Italic, which is slanted, and has letterforms
of average width</li>
<li>Condensed, which has no slant, but has
letterforms narrower than the average represented by Roman</li>
<li>Condensed Italic, which is slanted, with letterforms narrower
than average</li>
</ul>
<p>
The term
<a href="#font">font</a>,
as it is used in these documents, refers to a combination of
<a href="#weight">weight</a>
and shape.
</p>
</dd>
<dt id="solid">Solid/set solid</dt>
<dd>
When no
<a href="#leading">lead</a>
is added between lines of type (i.e., the
<a href="#ps">point size</a>
and linespacing are the same), the lines are said to be &#8220;set
solid.&#8221;
</dd>
<dt id="trackkerning">Track kerning/Line kerning</dt>
<dd>
Sometimes, it&#8217;s advantageous to increase or decrease the amount
of space between every letter in a line by an equal (usually
small) amount, in order to fit more (or fewer) characters on the
line. The correct term is letter spacing, but track kerning and
line kerning (and sometimes, just "kerning") have come to mean
the same thing.
</dd>
<dt id="unbreakablespace">Unbreakable space</dt>
<dd>
Equal to
<a href="#wordspace">word space</a>,
however words separated by an unbreakable space will always be
kept together on the same line. Expands and contracts like word
space. Useful for proper names, which one should, whenever
possible, avoid splitting onto two lines. In groff, unbreakable
space is entered with <kbd>\~</kbd> (i.e. a backslash followed by a
tilde)
</dd>
<dt id="weight">Weight</dt>
<dd>
The thickness of the strokes of letterforms. Medium and Book
have average thicknesses and are the weights used for most
of the text in books, magazines, newspapers, etc. Light has
strokes slightly thinner than Medium or Book, but is still
acceptable for most text. Semibold, Bold, Heavy and Black all
have strokes of increasing thickness, making them suitable for
headings and the like.
</dd>
<dt id="wordspace">Word space</dt>
<dd>
The amount of whitespace between words. When text is
<a href="#just">justified</a>,
word space expands or contracts to make the margins flush.
</dd>
<dt id="xheight">x-height</dt>
<dd>
The height of a lower case letter x in a given font at a given
point size. Generally used to mean the average height of the
bowl of lower case letters.
</dd>
</dl>
<h3 id="groff-terms" class="docs">Groff terms</h3>
<dl>
<dt id="alias">Alias</dt>
<dd>
A
<a href="#macros">macro</a>
invoked by a name different from its &#8220;official&#8221;
name. For example, the official name of the macro to change
<a href="#family">family</a>
is <kbd>FAMILY</kbd>. Its alias is <kbd>FAM</kbd>.
Aliases may be created for any macro (via the
<a href="goodies.html#alias"><kbd>ALIAS</kbd></a>
macro) provided the alias uses a name not already taken by the
mom macros or one of the groff
<a href="#primitives">primitives</a>.
For a complete list of words or names you must not use, see the
<a href="reserved.html#reserved">list of reserved words</a>.
</dd>
<dt id="arguments">Arguments</dt>
<dd>
Parameters or information needed by a
<a href="#macros">macro</a>
to do its job. For example, in the macro
<span class="pre" style="margin-bottom: -2em;">
.PT_SIZE 12
</span>
<kbd>12</kbd> is the argument. In the macro
<span class="pre" style="margin-bottom: -2em;">
.QUAD LEFT
</span>
<kbd>LEFT</kbd> is the argument. Arguments are separated from
macros by spaces. Some macros require several arguments; each
is separated by a space.
</dd>
<dt id="commentlines">Comment Lines</dt>
<dd>
<a href="#inputline">Input lines</a>
introduced with the comment character <kbd>\#</kbd> (i.e. a
backslash followed by the pound sign). When processing output,
groff silently ignores everything on a line that begins with the
comment character.
</dd>
<dt id="controllines">Control Lines</dt>
<dd>
Instructions to groff that appear on a line by themselves, which
means that &#8220;control lines&#8221; are either
<a href="#macros">macros</a>
or groff
<a href="#primitives">primitives</a>.
Control lines begin with a period or, occasionally, an apostrophe.
</dd>
<dt id="filled">Filled lines/fill mode</dt>
<dd>
Automatic
<a href="#just">justification</a>
or
<a href="#quad">quadding</a>.
In fill mode, the ends of lines as they appear in your text
editor are ignored. Instead, words from adjoining
<a href="#inputline">input lines</a>
are added one at a time to the output line until no more words
fit. Then, depending whether text is to be
<a href="#just">justified</a>
or
<a href="#quad">quadded</a>
(left, right, or centre), and depending on whether automatic
hyphenation is turned on, groff attempts to hyphenate the last
word, or, barring that, spreads and breaks the line (when
justification is turned on) or breaks and quads the line (when
quadding is turned on).
<p id="no-fill">
Nofill mode (non-filled text) means that groff respects the ends
of lines exactly as they appear in your text editor.
</p>
</dd>
<dt id="inlines">Inline escapes</dt>
<dd>
Instructions issued to groff that appear as part of an
<a href="#inputline">input line</a>
(as opposed to
<a href="#macros">macros</a>,
which must appear on a line by themselves). Inline escapes are
always introduced by the backslash character. For example,
<span class="pre" style="margin-bottom: -2em;">
A line of text with the word T\*[BU 2]oronto in it
</span>
contains the inline escape <kbd>\*[BU 2]</kbd> (which means
&#8220;move the letter &#8216;o&#8217; 2
<a href="#kernunit">kern units</a>
closer to the letter &#8216;T&#8217;&#8221;).
<p style="margin-bottom: -2em;">
Mom&#8217;s inline escapes always take the form
<kbd>\*[&lt;ESCAPE&gt;]</kbd>, where <kbd>ESCAPE</kbd> is
composed of capital letters, sometimes followed immediately by a
digit, sometimes followed by a space and a
<a href="#numericargument">numeric argument</a>.
Groff&#8217;s escapes begin with the backslash
character but typically have no star and are in lower case. For
example, the mom escapes to move forward 6
points on a line are either
<span class="pre" style="margin-bottom: -2em;">
\*[FP6]&nbsp;&nbsp;or&nbsp;&nbsp;\*[FWD 6p]
</span>
while the groff escape for the same thing is
<span class="pre" style="margin-bottom: -2em;">
\h&#8217;6p&#8217;
</span>
</p>
</dd>
<dt id="inputline" style="margin-top: -1em;">Input line</dt>
<dd>
A line of text as it appears in your text editor.
</dd>
<dt id="macros">Macros</dt>
<dd>
Instructions embedded in a document that determine how groff
processes the text for output. mom&#8217;s macros
always begin with a period, on a line by themselves, and must
be typed in capital letters. Typically, macros contain complex
commands issued to groff&mdash;behind the scenes&mdash;via
groff
<a href="#primitives">primitives</a>.
</dd>
<dt id="units">Machine units</dt>
<dd>
A machine unit is 1/1000 of a
<a href="#picaspoints">point</a>
when the groff device is ps. (&#8220;ps&#8221; means
&#8220;PostScript&#8221;&mdash;the default device for
which groff prepares output, and the device for which
mom was originally designed.)
</dd>
<dt id="numericargument">Numeric argument</dt>
<dd>
An
<a href="#arguments">argument</a>
that has the form of a digit. Numeric arguments can be built
out of arithmetic expressions using +, -, *, and / for plus,
minus, times, and divided-by respectively. If a numeric
argument requires a
<a href="#unitofmeasure">unit of measure</a>,
a unit of measure must be appended to <em>every</em> digit in
the argument. For example:
<span class="pre" style="margin-bottom: -2em;">
.ALD 1i-1v
</span>
<div class="box-important" style="margin-right: 2.5em;">
<p class="tip">
<span class="important">IMPORTANT:</span> groff does not
respect the order of operations, but rather evaluates
arithmetic expressions from left to right. Parentheses must
be used to circumvent this peculiarity. Not to worry, though.
The likelihood of more than just the occasional plus or minus
sign when using mom&#8217;s macros is slim.
</p>
</div>
</dd>
<dt id="outputline">Output line</dt>
<dd>
A line of text as it appears in output copy.
</dd>
<dt id="preprocessor">Pre-processor</dt>
<dd>
Pre-processors are used by groff to generate tables
(<strong>tbl</strong>), diagrams (<strong>pic</strong>), graphs
(<strong>grap</strong>), and equations (<strong>eqn</strong>).
These pre-processors are fully supported by mom. In addition,
the &#8220;refer&#8221; pre-processor is used to generate
bibliographies and lists of cited works. The PDF_IMAGE macro,
which allows insertion of graphics into a document, is not
strictly a pre-processor but behaves similarly to tbl, pic, and
eqn.
</dd>
<dt id="primitives">Primitives</dt>
<dd>
The lowercase instructions, introduced with a period, that groff
uses as its native command language, and out of which macros
are built. The majority of groff&#8217;s primitive requests are two
letters long.
</dd>
<dt id="stringargument">String Argument</dt>
<dd>
Technically, any
<a href="#arguments">argument</a>
that is not numeric. In this documentation, string argument
means an argument that requires the user to input text. For
example, in the
<a href="#macros">macro</a>
<span class="pre" style="margin-bottom: -2em;">
.TITLE "My Pulitzer Novel"
</span>
<kbd>"My Pulitzer Novel"</kbd> is a string argument.
<p>
Because string arguments must be enclosed by double-quotes, you
can&#8217;t use double-quotes as part of the string argument. If you
need double-quotes to be part of a string argument, use the
<a href="#inlines">inline escapes</a>
<kbd>\(lq</kbd> and <kbd>\(rq</kbd> (leftquote and
rightquote respectively) in place of the double-quote character
(<kbd>"</kbd>).
</p>
</dd>
<dt id="unitofmeasure">Unit of measure</dt>
<dd>
The single letter after a
<a href="#numericargument">numeric argument</a>
that tells mom what measurement scale the
argument should use. Common valid units are:
<span class="pre" style="margin-bottom: -2em;">
i (inches)
p (points)
P (Picas)
c (centimetres)
m (ems)
n (ens)
u (machine units)
v (the current leading [line space])
</span>
<p style="margin-top: -1em;">
Units of measure must come immediately after the numeric
argument (i.e. with no space between the argument and the unit
of measure), like this:
<span class="pre" style="margin-bottom: -2em;">
.ALD 2v
.LL 39P
.IL 1i
</span>
The above example advances 2 line spaces and sets the line
length to 39 picas with a left indent of 1 inch.
</p>
<div class="box-important" style="margin-right: 2.5em;">
<p class="tip">
<span class="important">IMPORTANT:</span>
Most mom macros that set the size or measure of something must
be given a unit of measure since most of the macros do not have
default units of measure. There are a couple of exceptions,
the most notable of which are <kbd>PT_SIZE</kbd> and
<kbd class="bold">LS</kbd>. Both use
<a href="#picaspoints">points</a>
as the default unit of measure, which means you don&#8217;t have to
append &#8220;p&#8221; to their argument.
</p>
</div>
<p>
You can enter decimal values for any unit of measure. Different
units may be combined by adding them together (e.g. 1.5i+2m,
which gives a measure of 1-1/2 inches plus 2 ems).
</p>
<div class="box-tip" style="margin-right: 2.5em;">
<p class="tip">
<span class="note">Note:</span>
a pica is composed of 12 points, therefore 12.5 picas is 12
picas and 6 points, not 12 picas and 5 points. If you want 12
picas and 5 points, you have to enter the measure as 12P+5p.
</p>
</div>
</dd>
<dt id="zerowidthcharacter">Zero-width character</dt>
<dd>
The
<a href="#inlines">inline escape</a>
that allows you to print a literal period, apostrophe and, if
<a href="#outputline">output lines</a>
are
<a href="#filled">filled</a>,
a space that falls at the beginning of an
<a href="#inputline">input line</a>.
It looks like this:
<span class="pre" style="margin-bottom: -2em;">
\&amp; <span style="font-family: arial, sans-serif; font-weight: normal">(i.e. a backslash followed by an ampersand)</span>
</span>
Normally, groff interprets a period (or an apostrophe) at the
beginning of an input line as meaning that what follows is a
<a href="#controllines">control line</a>.
In fill modes, groff treats a space at the beginning of an input
line as meaning &#8220;start a new line and put a space at the
beginning of it.&#8221; If you want groff to interpret periods
and apostrophes at the beginning of input lines literally (i.e.
to print them), or spaces at the beginning of input lines as just
garden variety word spaces, you must start the line with the
zero-width character.
</dd>
</dl>
<h3 id="mom-terms" class="docs">Mom terms</h3>
<dl>
<dt id="baseline-grid">Baseline grid</dt>
<dd>
Virtual guide lines spaced according to the
<a href="#leading">leading</a>
established for running text. Adherence to the grid ensures that
text fills the page completely to the bottom margin. Uncorrected
deviations from the grid result in bottom margins that fall short.
</dd>
<dt id="controlmacro">Control macro</dt>
<dd>
Macros used in
<a href="docprocessing.html#docprocessing">document processing</a>
to control/alter the appearance of document elements (e.g.
headings, quotes, footnotes,
<a href="#header">headers</a>,
etc.).
</dd>
<dt id="docheader">Document header/docheader</dt>
<dd>
Document information (title, subtitle, author, etc) output at
the top of page one.
</dd>
<dt id="epigraph">Epigraph</dt>
<dd>
A short, usually cited passage that appears at the beginning of
a chapter, story, or other document.
</dd>
<dt id="float">Float</dt>
<dd>
A float is material intended to be kept together as a block.
Floated material that fits on a page in position is output on that
page. Floats that do not fit in position are deferred to the top
of the next page.
</dd>
<dt id="footer">Footer/page footer</dt>
<dd>
Document information (frequently author and title) output in
the bottom margin of pages after page one. Not to be
confused with footnotes, which are considered part of
<a href="#running">running text</a>.
</dd>
<dt id="head">Heading</dt>
<dd>
The title used to identify a section of a document. Headings
are hierarchic, corresponding to the notion of head, subhead,
subsubhead, etc.
</dd>
<dt id="header">Header/page header</dt>
<dd>
Document information (frequently author and title) output in the
top margin of pages after page one.
<div class="box-tip" style="margin-right: 2.5em;">
<p class="tip">
<span class="note">Note:</span> In terms of content and style,
headers and
<a href="#footer">footers</a>
are the same; they differ only in their placement on the page.
In most places in this documentation, references to the content
or style of headers applies equally to footers.
</p>
</div>
</dd>
<dt id="linebreak">Linebreak/author linebreak</dt>
<dd>
A gap in the vertical flow of
<a href="#running">running text</a>,
frequently set off by typographic symbols such as asterisks or
daggers. Used to indicate a shift in the content of a document
(e.g. a scene change in a short story). Also commonly called a
scene break or a section break.
</dd>
<dt id="parahead">Paragraph head</dt>
<dd>
A heading joined to the body of a paragraph.
</dd>
<dt id="pdflink">PDF link</dt>
<dd>
A portion of text that, when clicked on in a PDF viewer, navigates
to a bookmarked location in a document, generally but not
exclusively a heading. It may also point to an external URL.
PDF links are usually coloured to make them stand out from the
surrounding text.
</dd>
<dt id="pdfoutline">PDF outline</dt>
<dd>
The hierarchically-arranged navigation outline provided by most PDF
viewers (e.g. Okular, Evince), typically in a panel to the left of
the document window, and usually labelled &#8220;Contents&#8221;.
</dd>
<dt id="quote">Quote</dt>
<dd>
A quote, to mom, is a line-for-line setting
of quoted material (e.g. poetry, song lyrics, or a snippet of
programming code). You don&#8217;t have to use
<a href="typesetting.html#br"><kbd>BR</kbd></a>
with quotes.
</dd>
<dt id="running">Running text</dt>
<dd>
In a document formatted with mom, running
text means text that forms the body of the document, including
elements such as headings.
<a href="#docheader">Docheaders</a>,
<a href="#header">headers</a>,
<a href="#footer">footers</a>
and page numbers are not part of running text.
</dd>
<dt id="toggle">Toggle</dt>
<dd>
A macro or tag that, when invoked without an argument, begins
something or turns a feature on, and, when invoked with ANY
argument, ends something or turns a feature off. See
<a href="intro.html#toggle-example">Example 3</a>
of the section
<a href="intro.html#macro-args">How to read macro arguments</a>.
</dd>
</dl>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="using.html#top">Next: Using mom</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,689 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Graphical Objects</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="docprocessing.html#top">Next: Document processing</a></td>
</tr>
</table>
<h1 class="docs">Graphical objects</h1>
<div style="text-align: center;">
<ul class="no-enumerator" style="margin-left: -2.5em;">
<li><a href="#intro-graphical">Introduction to graphical objects</a></li>
<li><a href="#behaviour">Graphical objects behaviour</a></li>
<li><a href="#order">Order of arguments</a></li>
<li><a href="#index-graphical">Index of graphical objects macros</a></li>
</ul>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="intro-graphical" class="docs">Introduction to graphical objects</h2>
<p>
Groff has a number of
<a href="definitions.html#inlines">inline escapes</a>
for drawing rules, polygons, ellipses and splines. All begin with
<kbd>\D</kbd> (presumably for &#8220;Draw&#8221;) and are documented
in the groff info manual:
<br/>
<span class="pre-in-pp">
info groff \D
</span>
The escapes allow you to draw just about any simple graphical object
you can think of, but owing to their syntax they&#8217;re not always easy
to read, which can make tweaking them difficult. Additionally,
while they perform in a <i>consistent</i> manner, they don&#8217;t
always perform in an <i>expected</i> manner.
</p>
<p>
Experience shows that the most common graphical elements typesetters
need are rules (horizontal and vertical), boxes, and circles (or
ellipses). For this reason, mom provides macros
to draw these objects in an easy-to-understand way; the results are
predictable, and mom&#8217;s syntax makes fixes or tweaks
painless.
</p>
<p id="graphical-example">
For example, if you want to draw a 2-inch square outline box at the left
margin using groff&#8217;s <kbd>\D</kbd> escapes, it looks like this:
<br/>
<span class="pre-in-pp">
back up
by
weight
+-------+
| |
\D't 500'\h'-500u'\D'p 2i 0 0 2i -2i 0 0 -2i'
| | | |
+-------+ +------------------------+
set rule draw box, 1 line at a time
weight
</span>
Obviously, this isn&#8217;t very efficient for something as simple as a
box.
</p>
<p>
Here&#8217;s the same box, drawn with mom&#8217;s box drawing
macro
<kbd><a href="#dbx">DBX</a></kbd>:
<br/>
<span class="pre-in-pp">
left margin indent--+ +--box width
| |
.DBX .5 0 2i 2i
| |
rule weight--+ +--box depth
(in points)
</span>
</p>
<p>
Mom&#8217;s graphical object macros allow&mdash;in fact,
require&mdash;giving the rule weight (&#8220;thickness&#8221;) for
the object (or saying that you want it filled), an indent from the
left margin where the object begins, the dimensions of the object,
and optionally a colour for the object.
</p>
<p>
There are no defaults for the arguments to mom&#8217;s graphical
object macros, which means you must supply the arguments every time
you invoke them.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
As stated above, mom only provides macros for commonly-used
graphical objects (rules, boxes, circles). More complex objects
(polygons, non-straight lines, splines) must be drawn using
groff&#8217;s <kbd>\D</kbd> escapes.
</p>
</div>
<h3 id="behaviour" class="docs">Graphical object behaviour</h3>
<p>
Mom&#8217;s graphical object macros all behave in the following,
carved-in-stone ways:
</p>
<ol style="margin-top: -.5em; margin-bottom: -.5em;">
<li>Objects are drawn from the
<a href="definitions.html#baseline">baseline</a>
down, including horizontal rules.</li>
<li>Objects begin precisely at the left indent supplied as
an argument to the macro.</li>
<li>Objects are drawn from left to right.</li>
<li>Enclosed objects (boxes, circles) are drawn from the
perimeter <i>inward</i>.</li>
<li>Objects return to their horizontal/vertical point of origin.</li>
</ol>
<p>
The consistency means that once you&#8217;ve mastered the very
simple order of arguments that applies to invoking graphical
object macros, you can draw objects with full confidence that you
know exactly where they&#8217;re placed and how much room they
occupy. Furthermore, because all return to their point of origin,
you&#8217;ll know exactly where you are on the page.
</p>
<h3 id="order" class="docs">Order of arguments</h3>
<p>
The order of arguments to the graphical object macros is the same
for every macro:
</p>
<ul style="margin-top: -.5em; margin-bottom: -.5em;">
<li>the rule weight
<ul style="margin-left: -.75em;">
<li>the single word <kbd>SOLID</kbd> may be used in place
of <kbd>weight</kbd> if you want boxes or circles filled</li>
</ul></li>
<li>the indent from the current left margin at which to begin
the object
</li>
<li>the width of the object if applicable</li>
<li>the depth of the object if applicable</li>
<li>the colour of the object (optional)</li>
</ul>
<div class="macro-list-container">
<h3 id="index-graphical" class="macro-list">Graphical objects macros</h3>
<ul class="macro-list">
<li><a href="#drh">DRH</a>
&ndash; horizontal rules</li>
<li><a href="#drv">DRV</a>
&ndash; vertical rules</li>
<li><a href="#dbx">DBX</a>
&ndash; box</li>
<li><a href="#dcl">DCL</a>
&ndash; circles or ellipses</li>
</ul>
</div>
<!-- -DRH- -->
<div class="macro-id-overline">
<h3 id="drh" class="macro-id">Drawing horizontal rules</h3>
</div>
<div class="box-macro-args">
Macro: <b>DRH</b> <kbd class="macro-args">&lt;none&gt; | &lt;weight&gt; &lt;indent&gt; &lt;width&gt; [&lt;colour&gt;]</kbd>
</div>
<p class="requires">
&bull;&nbsp;
the argument to <kbd class="normal">&lt;weight&gt;</kbd> is in
<a href="definitions.html#picaspoints" class="normal">points</a>,
but do <span class="normal">not</span> append the
<a href="definitions.html#unitsofmeasure">unit of measure</a>,
<kbd class="normal">p</kbd>
<br/>
&bull;&nbsp;
<kbd class="normal">&lt;indent&gt;</kbd>
and
<kbd class="normal">&lt;width&gt;</kbd>
require a unit of measure
<br/>
&bull;&nbsp;
arithmetic expressions to
<kbd class="normal">&lt;indent&gt;</kbd>
and
<kbd class="normal">&lt;width&gt;</kbd>
must be surrounded by parentheses
</p>
<p>
If all you want is to draw a rule from your current left
margin to your current right margin (in other words, a &quot;full
measure&quot; rule), you may invoke <kbd>.DRH</kbd> without any
arguments.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
DRH is the only graphical object macro that may be invoked
without arguments. The weight (&#8220;thickness&#8221;) of
the rule is determined by the argument you last gave the
macro
<a href="inlines.html#rule-weight">RULE_WEIGHT</a>.
DRH, used this way, is exactly equivalent to entering the
<a href="definitions.html#inlines">inline escape</a>
<a href="inlines.html#inline-rule-mom"><kbd><span class="nobr">\*[RULE]</span></kbd></a>.
</p>
</div>
<p style="margin-top: -.5em;">
To draw horizontal rules of a specified width, you must, at
a minimum, supply DRH with the arguments <kbd>weight,</kbd>
<kbd>indent</kbd> (measured from the current left margin) and
<kbd>width</kbd>.
</p>
<p>
Optionally, you may give a <kbd>color</kbd> argument. The colour
may be either one defined with
<a href="color.html#newcolor">NEWCOLOR</a>,
or a named X-color initialized with
<a href="color.html#xcolor">XCOLOR</a>,
or an X-color alias (again, initialized with XCOLOR).
</p>
<p>
Say, for example, you want to draw a 1-1/4 point horizontal rule
that starts 2 picas from the current left margin and runs for 3
inches. To do so, you&#8217;d invoke <kbd>.DRH</kbd> like this:
<br/>
<span class="pre-in-pp">
weight width
| |
.DRH 1.25 2P 3i
|
indent
</span>
(Note that the rule weight argument, which is expressed in points,
must not have the unit of measure <kbd>p</kbd> appended to it.)
</p>
<p>
If, in addition, you want the rule blue:
<br/>
<span class="pre-in-pp">
.DRH 1.25 2P 3i blue
</span>
</p>
<h3 class="docs">How mom handles the positioning of horizontal rules</h3>
<p>
Horizontal rules are drawn from left to right, and from the baseline
down. &#8220;From the baseline down&#8221; means that if you request
a rule with a weight of four points, the four points of rule fall
entirely below the baseline.
</p>
<p>
Furthermore, after the rule is drawn, mom returns you to the current
left margin, at the same vertical position on the page as when DRH
was invoked. In other words, DRH causes no movement on the page,
either horizontal or vertical.
</p>
<!-- -DRV- -->
<div class="macro-id-overline">
<h3 id="drv" class="macro-id">Drawing vertical rules</h3>
</div>
<div class="box-macro-args">
Macro: <b>DRV</b> <kbd class="macro-args">&lt;weight&gt; &lt;indent&gt; &lt;depth&gt; [&lt;colour&gt;]</kbd>
</div>
<p class="requires">
&bull;&nbsp;
the argument to <kbd class="normal">&lt;weight&gt;</kbd> is in
<a href="definitions.html#picaspoints" class="normal">points</a>,
but do <span class="normal">not</span> append the
<a href="definitions.html#unitsofmeasure">unit of measure</a>,
<kbd class="normal">p</kbd>
<br/>
&bull;&nbsp;
<kbd class="normal">&lt;indent&gt;</kbd>
and
<kbd class="normal">&lt;depth&gt;</kbd>
require a unit of measure
<br/>
&bull;&nbsp;
arithmetic expressions to
<kbd class="normal">&lt;indent&gt;</kbd>
and
<kbd class="normal">&lt;depth&gt;</kbd>
must be surrounded by parentheses
</p>
<p>
To draw vertical rules of a specified depth, you must, at
a minimum, supply DRV with the arguments <kbd>weight,</kbd>
<kbd>indent</kbd> (measured from the current left margin) and
<kbd>depth</kbd>.
</p>
<p>
Optionally, you may give a <kbd>color</kbd> argument. The colour
may be either one defined with
<a href="color.html#newcolor">NEWCOLOR</a>,
or a named X-color initialized with
<a href="color.html#xcolor">XCOLOR</a>,
or an X-color alias (again, initialized with XCOLOR).
</p>
<p>
Say, for example, you want to draw a 3/4-point vertical rule that
starts 19-1/2 picas from the current left margin and has a depth of
6 centimetres. To do so, you&#8217;d invoke <kbd>.DRV</kbd> like
this:
<br/>
<span class="pre-in-pp">
weight depth
| |
.DRV .75 19P+6p 6c
|
indent
</span>
(Note that the rule weight argument, which is expressed in points,
must not have the unit of measure <kbd>p</kbd> appended to it.)
</p>
<p>
If, in addition, you want the rule red:
<br/>
<span class="pre-in-pp">
.DRV .75 19P+6p 6c red
</span>
</p>
<h3 class="docs">How mom handles the positioning of vertical rules</h3>
<p>
Vertical rules are drawn from the baseline down, and from left to
right. &quot;Left to right&quot; means that if you request a rule
with a weight of four points, the four points of rule fall entirely
to the right of the indent given to DRV.
</p>
<p>
Furthermore, after the rule is drawn, mom returns you to the current
left margin, at the same vertical position on the page as when DRV
was invoked. In other words, DRV causes no movement on the page,
either horizontal or vertical.
</p>
<!-- -DBX- -->
<div class="macro-id-overline">
<h3 id="dbx" class="macro-id">Drawing boxes</h3>
</div>
<div class="box-macro-args">
Macro: <b>DBX</b> <kbd class="macro-args">&lt;weight&gt;|SOLID &lt;indent&gt; &lt;width&gt;|FULL_MEASURE &lt;depth&gt; [&lt;color&gt;]</kbd>
</div>
<p class="requires">
&bull;&nbsp;
the argument to <kbd class="normal">&lt;weight&gt;</kbd> is in
<a href="definitions.html#picaspoints" class="normal">points</a>,
but do <span class="normal">not</span> append the
<a href="definitions.html#unitsofmeasure">unit of measure</a>
<kbd class="normal">p</kbd>
<br/>
&bull;&nbsp;<kbd class="normal">&lt;indent&gt;</kbd>,
<kbd class="normal">&lt;width&gt;</kbd>,
and
<kbd class="normal">&lt;depth&gt;</kbd>
require a unit of measure
<br/>
&bull;&nbsp;
arithmetic expressions to
<kbd class="normal">&lt;indent&gt;</kbd>,
<kbd class="normal">&lt;width&gt;</kbd>,
and
<kbd class="normal">&lt;depth&gt;</kbd>
must be enclosed in parentheses.
</p>
<p>
To draw boxes you must, at a minimum, supply DBX with the arguments
<kbd>weight</kbd> or <kbd>SOLID</kbd>, <kbd>indent</kbd>,
<kbd>width</kbd> or <kbd>FULL_MEASURE</kbd>, and <kbd>depth</kbd>.
</p>
<p>
<kbd>weight</kbd> is the rule weight of outlined boxes, given in
points but without the
<a href="definitions.html#unitsofmeasure">unit of measure</a>
<kbd>p</kbd> appended.
</p>
<p>
If <kbd>SOLID</kbd> is given as the first argument, the box is
filled rather than outlined and no <kbd>weight</kbd> argument should
be supplied.
</p>
<p>
<kbd>indent</kbd> is measured from the current left margin. If
<kbd>FULL_MEASURE</kbd> is given, <kbd>indent</kbd> should be set to
&#8220;0&#8221;.
</p>
<p>
<kbd>width</kbd> is the width of the box with a
<a href="definitions.html#unitsofmeasure">unit of measure</a>
appended, caclculated from <kbd>indent</kbd> argument.
</p>
<p>
If <kbd>FULL_MEASURE</kbd> is given instead of <kbd>width</kbd>,
it circumvents having to calculate the width when left and/or right
indents are in effect; mom draws the box from the current left
margin to the current right margin. When no indents are in effect,
<kbd>FULL_MEASURE</kbd> or <kbd>\n[.l]u</kbd>&#8212;the groff
way of saying &#8220;the current line length&#8221;&#8212;have the
same effect.
</p>
<p>
Optionally, you may give a <kbd>color</kbd> argument. The colour
may be either one defined with
<a href="color.html#newcolor">NEWCOLOR</a>,
or a named X-color initialized with
<a href="color.html#xcolor">XCOLOR</a>,
or an X-color alias (again, initialized with XCOLOR).
</p>
<p>
Say, for example, you want to draw a 1/2 point outline box that
starts one inch from the current left margin and has the dimensions
12 picas x 6 picas. To do so, you&#8217;d invoke <kbd>.DBX</kbd>
like this:
<br/>
<span class="pre-in-pp">
indent depth
| |
.DBX .5 1i 12P 6P
| |
weight width
</span>
(Note that the box weight argument, which is expressed in points,
must not have the unit of measure <kbd>p</kbd> appended to it.)
</p>
<p>
If you want the same box, but solid (&#8220;filled&#8221;) rather
than drawn as an outline:
<br/>
<span class="pre-in-pp">
.DBX SOLID 1i 12P 6P
</span>
Additionally, if you want the box green:
<br/>
<span class="pre-in-pp">
.DBX .5 1i 12P 6P green
</span>
or
<span class="pre-in-pp">
.DBX SOLID 1i 12P 6P green
</span>
</p>
<h3 class="docs">How mom handles the positioning of boxes</h3>
<p>
Boxes are drawn from the baseline down, from left to right, and
from the perimeter <i>inward</i>. &#8220;From the perimeter
inward&#8221; means that if you request a box weight of six points,
the 6-point rules used to draw the outline of the box fall entirely
<i>within</i> the dimensions of the box.
</p>
<p>
Furthermore, after the box is drawn, mom returns you to the current
left margin, at the same vertical position on the page as when DBX
was invoked. In other words, DBX causes no movement on the page,
either horizontal or vertical.
</p>
<!-- -DCL- -->
<div class="macro-id-overline">
<h3 id="dcl" class="macro-id">Drawing circles (ellipses)</h3>
</div>
<div class="box-macro-args">
Macro: <b>DCL</b> <kbd class="macro-args">&lt;weight&gt;|SOLID &lt;indent&gt; &lt;width&gt;|FULL_MEASURE &lt;depth&gt; [&lt;color&gt;]</kbd>
</div>
<p class="requires">
&bull;&nbsp;
the argument to <kbd class="normal">&lt;weight&gt;</kbd> is in
<a href="definitions.html#picaspoints" class="normal">points</a>,
but do <span class="normal">not</span> append the
<a href="definitions.html#unitsofmeasure">unit of measure</a>
<kbd class="normal">p</kbd>
<br/>
&bull;&nbsp;<kbd class="normal">&lt;indent&gt;</kbd>,
<kbd class="normal">&lt;width&gt;</kbd>,
and
<kbd class="normal">&lt;depth&gt;</kbd>
require a unit of measure
<br/>
&bull;&nbsp;
arithmetic expressions to
<kbd class="normal">&lt;indent&gt;</kbd>,
<kbd class="normal">&lt;width&gt;</kbd>,
and
<kbd class="normal">&lt;depth&gt;</kbd>
must be enclosed in parentheses.
</p>
<p>
To draw circles you must, at a minimum, supply DCL with the arguments
<kbd>weight</kbd> or <kbd>SOLID</kbd>, <kbd>indent</kbd>,
<kbd>width</kbd> or <kbd>FULL_MEASURE</kbd>, and <kbd>depth</kbd>.
</p>
<p>
<kbd>weight</kbd> is the rule weight of outlined circles, given in
points but without the unit of measure
<a href="definitions.html#unitsofmeasure">unit of measure</a>
<kbd>p</kbd> appended.
</p>
<p>
If <kbd>SOLID</kbd> is given as the first argument, the circle is
filled rather than outlined and no <kbd>weight</kbd> argument should
be supplied.
</p>
<p>
<kbd>indent</kbd> is measured from the current left margin. If
<kbd>FULL_MEASURE</kbd> is given, <kbd>indent</kbd> should be set to
&#8220;0&#8221;.
</p>
<p>
<kbd>width</kbd> is the width of the circle with a
<a href="definitions.html#unitsofmeasure">unit of measure</a>
appended, caclculated from <kbd>indent</kbd> argument.
</p>
<p>
If <kbd>FULL_MEASURE</kbd> is given instead of <kbd>width</kbd>,
it circumvents having to calculate the width when left and/or right
indents are in effect; mom draws the circle from the current left
margin to the current right margin. When no indents are in effect,
<kbd>FULL_MEASURE</kbd> or <kbd>\n[.l]u</kbd>&#8212;the groff
way of saying &#8220;the current line length&#8221;&#8212;have the
same effect.
</p>
<p>
Optionally, you may give a <kbd>color</kbd> argument. The colour
may be either one defined with
<a href="color.html#newcolor">NEWCOLOR</a>,
or a named X-color initialized with
<a href="color.html#xcolor">XCOLOR</a>,
or an X-color alias (again, initialized with XCOLOR).
</p>
<p>
Say, for example, you want to draw a 1/2 point outline circle that
starts one inch from the current left margin and has the dimensions
12 picas x 6 picas. To do so, you&#8217;d invoke <kbd>.DCL</kbd>
like this:
<br/>
<span class="pre-in-pp">
indent depth
| |
.DCL .5 1i 12P 6P
| |
weight width
</span>
(Note that the circle weight argument, which is expressed in points,
must not have the unit of measure <kbd>p</kbd> appended to it.)
</p>
<p>
If you want the same circle, but solid (&#8220;filled&#8221;) rather
than drawn as an outline:
<br/>
<span class="pre-in-pp">
.DCL SOLID 1i 12P 6P
</span>
Additionally, if you want the circle green:
<br/>
<span class="pre-in-pp">
.DCL .5 1i 12P 6P green
</span>
or
<span class="pre-in-pp">
.DCL SOLID 1i 12P 6P green
</span>
</p>
<h3 class="docs">How mom handles the positioning of circles (ellipses)</h3>
<p>
Circles (ellipses) are drawn from the baseline down, from left
to right, and from the perimeter <i>inward</i>. &#8220;From the
perimeter inward&#8221; means that if you request a circle weight of
six points, the 6-point rule used to draw the outline of the circle
or ellipse falls entirely <i>within</i> the dimensions of the
circle or ellipse.
</p>
<p>
Furthermore, after the circle is drawn, mom returns you to the
current left margin, at the same vertical position on the page as
when DCL was invoked. In other words, DCL causes no movement on the
page, either horizontal or vertical.
</p>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="docprocessing.html#top">Next: Document processing</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,487 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>What is mom?</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="definitions.html#top">Next: Definitions</a></td>
</tr>
</table>
<h1 id="intro" class="docs">What is mom?</h1>
<div style="text-align: center;">
<ul class="no-enumerator" style="margin-left: -2.5em;">
<li ><a href="#intro-intro">Who is mom meant for?</a></li>
<li ><a href="#intro-typesetting">Typesetting with mom</a></li>
<li ><a href="#intro-docprocessing">Document processing with mom</a></li>
<li ><a href="#intro-philosophy">Mom&#8217;s philosophy</a></li>
<li ><a href="#intro-documentation">A note on mom&#8217;s documentation</a></li>
<li ><a href="#canonical">Canonical reference materials</a></li>
<li ><a href="#macro-args">How to read macro arguments</a></li>
</ul>
</div>
<div class="rule-short" style="margin-top: 18px;"><hr/></div>
<h2 id="intro-intro" class="docs">Who is mom meant for?</h2>
<p>
Mom (&#8220;my own macros&#8221;, &#8220;my other macros&#8221;,
&#8220;maximum overdrive macros&#8221;...) is a macro set for groff,
designed to format documents in Portable Document Format (.pdf) and
PostScript (.ps). She&#8217;s aimed at three kinds of users:
</p>
<ol style="margin-top: -.5em; margin-bottom: -.5em;">
<li>Typesetters who suspect groff might be the right
tool for the job but who are frustrated,
intimidated, or puzzled by groff&#8217;s terse,
not-always-typographically-intuitive
<a href="definitions.html#primitives">primitives</a>;
</li>
<li>Writers who need to format their work easily, with a
minimum of clutter;
</li>
<li>Newcomers to groff, typesetting, or document processing
who need a well-documented macro set to get them started.
</li>
</ol>
<p>
Mom is actually two macro packages in one: a very complete set
of typesetting macros, and an equally thorough set of document
formatting macros. The typesetting macros afford fine-grained
control over all visible aspects of page layout and design (margins,
fonts, sizes, kerning, etc), while the document formatting macros
focus on the logical structure of a document (titles, headings,
paragraphs, lists, etc) and call on groff to render logical
structure into pleasing type.
</p>
<h2 id="intro-typesetting" class="docs">Typesetting with mom</h2>
<p>
Mom&#8217;s typesetting macros control the basic parameters
of type: margins, line lengths, type family, font, point size,
linespacing, and so on. In addition, they allow you to move
around on the page horizontally and vertically, and to set up
tabs, indents, and columns. Finally, they let you adjust such
typographic details as justification style, letter spacing, word
spacing, hyphenation, and kerning.
</p>
<p>
The typesetting macros also provide the means to create horizontal
and vertical rules, rectangles (boxes, frames), and ellipses
(circles).
</p>
<p>
In terms of typographic control, the typesetting macros provide
access to groff&#8217;s primitives in a way that&#8217;s consistent,
sensible, and easy to use. With them, you can create individual
pages designed from the ground up. Provided you have not signalled
to mom that you want document processing (via the
<a href="docprocessing.html#start">START</a>
macro; see below), every typesetting macro is a literal command
that remains in effect until you modify it or turn it off. This
means that if you want to create flyers, surveys, tabulated forms,
curricula vitae and so on, you may do so in the good old-fashioned
way: one step at a time with complete control over every element on
the page.
</p>
<p>
Years of experience have convinced me that no program can ever
replace the human eye and human input when it comes to high quality
typesetting. Words and punctuation on the printed page are too
variable, too fluid, to be rendered flawlessly by any algorithm,
no matter how clever.
</p>
<p>
Mom, therefore, does not try to guess solutions for issues like
hanging punctuation, or left-margin adjustments for troublesome
letters like T, V and W. Rather, she provides tools that allow
knowledgeable typesetters to handle these typographic challenges in
ways that are easier and more intuitive than manipulating groff at
the primitive level.
</p>
<h2 id="intro-docprocessing" class="docs">Document processing with mom</h2>
<p>
Mom&#8217;s document processing macros let you format documents
without having to worry about the typographic details. In this
respect, mom is similar to other groff macro packages, as well as
to html and LaTeX. Where mom differs is in the degree of control
you have over the look and placement of the various elements of a
document. For example, if you&#8217;d like your headings underlined,
or in caps, or centred rather than flush left, you can make the
changes easily and have them apply to the whole document. Temporary
and one-off changes are easy, too.
</p>
<p>
Mom has some features other macro sets don&#8217;t provide. For
example, you can switch between draft-style and final-copy output.
If you regularly make submissions to publishers and editors who
insist on "typewritten, double-spaced," there&#8217;s a special
macro&mdash;
<a href="docprocessing.html#printstyle">PRINTSTYLE <kbd>TYPEWRITE</kbd></a>&mdash;
that changes typeset documents into ones that would make an
old-school typing teacher proud. Footnotes, endnotes, tables of
contents, multiple columns, nested lists, recto/verso printing and
user designable headers and footers are also part of the fun.
</p>
<h2 id="intro-philosophy" class="docs">Mom&#8217;s philosophy</h2>
<p>
Formatting documents should be easy, from soup to nuts. Writers
need to focus on what they&#8217;re writing, not on how it looks.
From the moment you fire up an editor to the moment you add
"FINIS" to your opus, nothing should interfere with the flow of
your words. The commands needed to format your work should be
easy to remember, comprehensible, and stand out well from the
text. There shouldn&#8217;t be too much clutter. Your documents
should be as readable inside a text editor as they are on the
printed page.
</p>
<p>
Unfortunately, in computerland, &#8220;easy,&#8221;
&#8220;comprehensible,&#8221; and &#8220;readable&#8221; often
mean &#8220;you&#8217;re stuck with what you get.&#8221; No
document formatting system can give you exactly what you want all
the time, every time. Documents always need to be tweaked, either
to satisfy a typographic whim or to clarify some aspect of their
content.
</p>
<p>
Groff has traditionally solved the problem of formatting vs.
tweaking by requiring users of the common macro packages (mm, ms,
me and their offspring) to resort to groff
<a href="definitions.html#primitives">primitives</a>
and
<a href="definitions.html#inlines">inline escapes</a>
for their special typesetting needs. Not to put too fine a point
on it, groff primitives tend toward the abstruse, and most inline
escapes are about as readable as an encrypted password. This does
not make for happy-camper writers, who either find themselves stuck
with a formatting style they don&#8217;t like, or are forced to
learn groff from the ground up&mdash;a daunting task, to say the
least.
</p>
<p>
Mom aims to make creating documents a simple matter, but with no
corresponding loss of user control. The document processing macros
provide an initial set of reasonable defaults, but anything that
is not to your liking can be changed. In combination with the
typesetting macros, you have all the tools you need to massage
passages and tweak pages until they look utterly professional.
</p>
<p>
One rarely hears the term &#8220;user interface&#8221; in
conjunction with document processing. Since formatting takes
place inside a text editor, little thought is given to the
look and feel of the formatting commands. Mom attempts to
rectify this by providing users with a consistent, readable
&#8220;coding&#8221; style. Most of the macros (especially in
the document processing set) have humanly-readable names. Not
only does this speed up learning the macros, it makes the sense
of what&#8217;s going on in a document easier to decipher,
typographically and structurally.
</p>
<p>
Mom does not try to be all things to all people. In contrast to
the normal groff philosophy, she does not try to produce output
that looks good no matter where it&#8217;s displayed. She&#8217;s
designed for primarily for PDF or PostScript output, although
with
<a href="docprocessing.html#printstyle">PRINTSTYLE <kbd>TYPEWRITE</kbd></a>
she produces acceptable terminal copy. No attempt is made to be
compatible with older versions of troff.
</p>
<p>
One special feature in mom&#8217;s design is the attention she pays
to aligning the bottom margins of every page. Nothing screams
shoddy in typeset documents louder than bottom margins that
wander, or, in typesetter jargon, &#8220;hang.&#8221; There are,
of course, situations where whitespace at the bottom of a page
may be unavoidable (for example, you wouldn&#8217;t want a head
to appear at the bottom of the page without some text underneath
it), but in all cases where hanging bottom margins can be avoided,
mom does avoid them, by clever adjustments to leading (&#8220;line
spacing&#8221;) and the spacing between different elements on the
page.
</p>
<h2 id="intro-documentation" class="docs">A note on mom&#8217;s documentation</h2>
<p>
Writing documentation is tough, no doubt about it. One is never
quite sure of the user&#8217;s level of expertise. Is s/he new to
the application, new to its underlying protocols and programs, new
to the operating system? At some point, one has to decide for whom
the documentation is intended. Making the wrong choice can mean the
difference between a program that gets used and a program that gets
tossed.
</p>
<p>
Mom&#8217;s documentation assumes users know their way around
their own operating system (basic file management, how to use
the command line, how to use a text editor, etc). I run GNU/Linux,
and while the documentation may exhibit a GNU/Linux bias, mom
and groff can, in fact, be run on other platforms.
</p>
<p>
The documentation further assumes users at least know what groff
is, even if they don&#8217;t know much about it. Lastly,
it assumes that everyone&mdash;groff newbies and experts
alike&mdash;learns faster from a few well-placed examples than
from manpage-style reference docs. What mom&#8217;s documentation
doesn&#8217;t assume is that you know everything&mdash;not about
groff, not about typesetting, not about document processing. Even
experts have odd lacunae in their knowledge base. Therefore,
whenever I suspect that a term or procedure will cause head
scratching, I offer an explanation. And when explanations
aren&#8217;t enough, I offer examples.
</p>
<h3 id="canonical" class="docs">Canonical reference materials</h3>
<p>
The canonical reference materials for groff are
<strong>cstr54</strong> (a downloadable PostScript copy of which
is available
<a href="http://www.kohala.com/start/troff/cstr54.ps">here</a>)
and the <strong>troff</strong> and <strong>groff_diff</strong>
manpages. The most complete and up-to-date source of information is
the groff info pages, available by typing <kbd>info groff</kbd> at
the command line (assuming you have the TeXinfo standalone browser
installed on your system, which is standard for most GNU/Linux
distributions). And for inputting special characters, see <kbd>man
groff_char</kbd>.
</p>
<p style="margin-top: 24px;">
I&#8217;ve tried to avoid reiterating the information contained
in these documents; however, in a few places, this has proved
impossible. But be forewarned: I have no qualms about
sidestepping excruciating completeness concerning groff usage;
I&#8217;m more interested in getting mom users up and running.
<i>Mea culpa.</i>
</p>
<p>
Groff has ancillary programmes (pre-processors) for generating
tables (<strong>tbl</strong>), diagrams (<strong>pic</strong>), and
equations (<strong>eqn</strong>), which may be used in conjunction
with mom. The manuals describing their usage are found at:
<br/>
<span style="display:block; margin-top: .5em">
<kbd>&nbsp;&nbsp;tbl</kbd>&nbsp;<a href="http://www.kohala.com/start/troff/v7man/tbl/tbl.ps">http://www.kohala.com/start/troff/v7man/tbl/tbl.ps</a>
<br/>
<kbd>&nbsp;&nbsp;pic</kbd>&nbsp;<a href="http://www.kohala.com/start/troff/gpic.raymond.ps">http://www.kohala.com/start/troff/gpic.raymond.ps</a>
<br/>
<kbd>&nbsp;&nbsp;eqn</kbd>&nbsp;<a href="http://www.kohala.com/start/troff/v7man/eqn/eqn2e.ps">http://www.kohala.com/start/troff/v7man/eqn/eqn2e.ps</a>
</span>
</p>
<div class="box-tip">
<p class="tip-top" style="padding-bottom: 9px;">
<b>Note:</b> Mom&#8217;s macro file (om.tmac) is heavily
commented. Each macro is preceded by a description of its
arguments, function and usage, which may give you information in
addition to what&#8217;s contained in this documentation.
</p>
</div>
<div class="rule-short" style="padding-top: 6px; padding-bottom: 3px;"><hr/></div>
<h2 id="macro-args" class="docs">How to read macro arguments</h2>
<p>
The concise descriptions of macros in this documentation typically
look like this:
</p>
<div class="box-macro-args">
Macro: <b>MACRO_NAME</b> <kbd class="macro-args">arguments</kbd>
</div>
<p>
<kbd>arguments</kbd> lists the macro&#8217;s
arguments using conventions that should be familiar to anyone who
has ever read a manpage. Briefly:
</p>
<ol>
<li>Macro arguments are separated from each other by spaces.</li>
<li>If an argument is surrounded by chevrons
(<kbd>&lt;&nbsp;&gt;</kbd>), it&#8217;s a description
of the argument, not the argument itself.
</li>
<li>If an argument begins with or is surrounded by double-quotes, the
double quotes must be included in the argument.
</li>
<li>If the user has a choice between several arguments, each of the
choices is separated by the pipe character
(<kbd>|</kbd>), which means &#8220;or.&#8221;
</li>
<li>Arguments that are optional are surrounded by square brackets.</li>
<li><kbd>&lt;off&gt;</kbd> or <kbd>&lt;anything&gt;</kbd> in an argument
list means that any argument other than those in the argument
list turns the macro off.
</li>
</ol>
<h3 id="toggle-macro" class="docs">Toggle macros</h3>
<p>
Some macros don&#8217;t require an argument. They simply start
something. When you need to turn them off, the same macro with
any argument will do the trick. That&#8217;s right: <em>any</em>
argument (in caps, lowercase, or a mixture thereof). This permits
choosing whatever works for you: <kbd>OFF</kbd>, <kbd>end</kbd>,
<kbd>Quit</kbd>, <kbd>Q</kbd>, <kbd>X</kbd>, and so on.
</p>
<p>
Since these macros toggle things on and off, the argument list
simply reads <kbd>toggle</kbd>.
</p>
<div id="examples" class="examples-container">
<h2 class="docs" style="margin-top: .5em;">Examples</h2>
<div class="examples">Example 1: An argument requiring double-quotes</div>
<div class="box-macro-args" style="max-width: 684px;">
Macro: <b>TITLE</b> <kbd class="macro-args">&quot;&lt;title of document&gt;&quot;</kbd>
</div>
<p>
The required argument to TITLE is the title of your document.
Since it&#8217;s surrounded by double-quotes, you must include
them in the argument, like this:
<br/>
<span class="pre-in-pp">
.TITLE "My Pulitzer Novel"
</span>
</p>
<div class="examples" style="margin-top: -1em;">Example 2: A macro with required and optional arguments</div>
<div class="box-macro-args" style="width: 684px;">
Macro: <b>TAB_SET</b> <kbd class="macro-args">&lt;tab number&gt; &lt;indent&gt; &lt;length&gt; [ L | R | C | J [ QUAD ] ]&nbsp;</kbd>
</div>
<p>
The first required argument is a number that identifies the tab
(say, "3"). The second required argument is an indent from the
left margin (say, 6 picas). The third required argument is the
length of the tab (say, 3 picas). Therefore, at a minimum, when
using this macro, you would enter:
<br/>
<span class="pre-in-pp">
.TAB_SET 3 6P 3P
</span>
The remaining two arguments are optional. The first is a
single letter, either <kbd>L, R, C</kbd> or
<kbd>J</kbd>. The second, which is itself
optional after <kbd>L, R, C</kbd> or
<kbd>J</kbd>, is the word <kbd>QUAD</kbd>.
Therefore, depending on what additional information you wish to
pass to the macro, you could enter:
<br/>
<span class="pre-in-pp">
.TAB_SET 3 6P 3P L
</span>
or
<br/>
<span class="pre-in-pp">
.TAB_SET 3 6P 3P L QUAD
</span>
</p>
<div id="toggle-example" class="examples" style="margin-top: -1em;">Example 3: A sample toggle macro:</div>
<div class="box-macro-args" style="max-width: 684px;">
Macro: <b>QUOTE</b> <kbd class="macro-args">toggle</kbd>
</div>
<p>
<kbd>QUOTE</kbd> begins a section of quoted text
in a document and doesn&#8217;t require an argument. When the
quote&#8217;s finished, you have to tell mom it&#8217;s done.
<span class="pre">
.QUOTE
So runs my dream, but what am I?
An infant crying in the night
An infant crying for the light
And with no language but a cry.
.QUOTE OFF
</span>
</p>
<p>
Alternatively, you could have turned the quote off with
<kbd>END</kbd>, or <kbd>X</kbd>, or something else.
</p>
</div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="definitions.html#top">Next: Definitions</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,639 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2024 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Writing letters</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="macrolist.html#top">Next: Quick reference guide</a></td>
</tr>
</table>
<h1 class="docs">Writing letters</h1>
<div style="width: 33%; margin: auto;">
<ul class="no-enumerator">
<li><a href="#letters-intro">Introduction</a></li>
<li><a href="#letters-tutorial">Tutorial</a></li>
<li><a href="#letters-defaults">Mom&#8217;s default letter style</a></li>
<li><a href="#index-letters-macros">The letter macros</a></li>
</ul>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="letters-intro" class="docs">Introduction</h2>
<p>
Mom&#8217;s simple but effective letter-writing macros are a subset
of the
<a href="docprocessing.html#docprocessing">document processing macros</a>,
designed to ease the creation of correspondence.
</p>
<p>
Because the letter macros are a subset of the document processing
macros, you can use
<a href="definitions.html#controlmacro">control macros</a>
to design correspondence to your own specifications. However,
mom makes no pretence of providing complete design flexibility in
the matter of letters, which are, after all, simple communicative
documents whose only real style requirements are that they be neat
and professional-looking.
</p>
<div class="examples-container" style="margin-top: 1.5em; margin-bottom: 1.5em;">
<h3 id="letters-tutorial" class="docs">Tutorial &ndash; writing letters</h3>
<p>
Mom letters begin, like all mom-processed documents, with
<a href="docprocessing.html#reference-macros">reference macros</a>
(in this case,
<a href="docprocessing.html#author">AUTHOR</a>),
a
<a href="docprocessing.html#doctype">DOCTYPE</a>
(LETTER, obviously), the essential
<a href="docprocessing.html#printstyle">PRINTSTYLE</a>
macro, and
<a href="docprocessing.html#start">START</a>,
like this:
<br/>
<span class="pre-in-pp">
.AUTHOR "Yannick P. Guique"
.DOCTYPE LETTER
.PRINTSTYLE TYPESET
.START
</span>
PRINTSTYLE, above, could also be <kbd>TYPEWRITE</kbd>. Mom has no
objection to creating letters that look like they were typed on an
Underwood by a shapely secretary with 1940s gams.
</p>
<p>
Please note that if you choose <kbd>PRINTSTYLE TYPEWRITE</kbd>,
there&#8217;s no need to give the <kbd>SINGLESPACE</kbd> option, as
this is the unalterable default for letters.
</p>
<p>
After the START macro, you enter headers pertinent to your letter:
the date, the addressee (in business correspondence, typically both
name and address), the addresser (that&#8217;s you; in business
correspondence, typically both name and address), and a greeting
(in full, e.g. &#8220;Dear Mr. Smith,&#8221; or &#8220;Dear
Mr. Smith:&#8221;).
</p>
<p>
The macros for entering the headers are simple (they&#8217;re not even
<a href="definitions.html#toggle">toggles</a>):
<br/>
<span class="pre-in-pp">
.DATE
.TO
.CC
.FROM
.GREETING
</span>
You may enter them in any order you like, except for GREETING, which
must come last. Mom ignores any headers you omit and spaces the
letter&#8217;s opening according to what you do include. See
<a href="#letters-defaults">Default for letters</a>
to find out how mom formats the headers.
</p>
<p>
Once you&#8217;ve filled in what you need to get a letter started,
simply type the letter, introducing each and every paragraph,
including the first, with the
<a href="docelement.html#pp">PP</a>
macro.
</p>
<p>
Letters are concluded with the
<a href="#closing">CLOSING</a>
macro. If you want a complimentary closing (&#8220;Yours
truly,&#8221; &#8220;Sincerely,&#8221; &#8220;Hugs and
kisses&#8221;), invoke CLOSING on a line by itself and follow
it with the text of the closing. <b>N.B.</b> Don&#8217;t
add your name; mom supplies it automatically (from
<a href="docprocessing.html#author">AUTHOR</a>),
leaving room above it for your signature. If you'd prefer not to have a
complimentary closing, place <kbd>\&</kbd> immediately underneath
<kbd>.CLOSING</kbd>. Mom then just adds your name (from AUTHOR),
again leaving room for your signature.
</p>
<p>
Assuming our tutorial letter is for business correspondence,
here&#8217;s what the complete letter looks like.
<br/>
<span class="pre-in-pp">
.AUTHOR "Yannick P. Guique"
.DOCTYPE LETTER
.PRINTSTYLE TYPESET
.START
.DATE
August 25, 2010
.TO
GUILLAUME BARRIÈRES
Minidoux Corporation
5000 Pannes Drive
Redmond, Virginia
.CC
John Doe
Jane Deere
Joe Blough
.FROM
Y.P. GUIQUE
022 Umask Road
St-Sauveur-en-dehors-de-la-mappe, Québec
.GREETING
Dear Mr. Barrières,
.PP
It has come to my attention that you have once again been
lobbying the US government to prohibit the use of open source
software by endeavouring to outlaw so-called "warranty
free" applications.
.PP
I feel it is my duty to inform you that the success of your
operating system relies heavily on open source programs and
protocols, notably TCP/IP.
.PP
Therefore, in the interests of your corporation&#8217;s fiscal health,
I strongly advise that you withdraw support for any US
legislation that would cripple or render illegal open source
development.
.CLOSING
Sincerely,
</span>
This produces a letter with headers that follow the North American
standard for business correspondence. If you&#8217;d prefer another style
of correspondence, for example, British, you&#8217;d set up the same
letter like this:
<br/>
<span class="pre-in-pp">
.AUTHOR "Yannick P. Guique"
.DOCTYPE LETTER
.PRINTSTYLE TYPESET
.START
.FROM
.RIGHT
Y.P. GUIQUE
022 Umask Road
St-Sauveur-en-dehors-de-la-mappe, Québec
.TO
GUILLAUME BARRIÈRES
Minidoux Corporation
5000 Pannes Drive
Redmond, Virginia
.CC
John Doe
Jane Deere
Joe Blough
.DATE
.RIGHT
August 25, 2010
.GREETING
Dear Mr. Barrières,
</span>
Notice the use of <kbd>.RIGHT</kbd> after <kbd>.FROM</kbd> and
<kbd>.DATE</kbd> in this example, used to change the default quad
for these macros.
</p>
</div>
<h2 id="letters-defaults" class="docs">Default letter style</h2>
<p>
In letters, if the order of header macros is
</p>
<ol style="margin-top: -.5em;">
<li><kbd>.DATE</kbd></li>
<li><kbd>.TO</kbd>&nbsp;&nbsp;(the addressee)</li>
<li><kbd>.FROM</kbd>&nbsp;&nbsp;(the addresser)</li>
<li><kbd>.GREETING</kbd>&nbsp;&nbsp;(&#8220;Dear Whoever,&#8221; &#8220;To Whom It May Concern,&#8221; etc.)</li>
</ol>
<p style="margin-top: -.5em;">
Mom sets
</p>
<ul style="margin-top: -.5em;">
<li>the date flush right, page right, at the top of page one,
with a gap of two linespaces underneath
</li>
<li>the addressee (<kbd>.TO</kbd>) in a block flush left, page
left, with a gap of one linespace underneath
</li>
<li>the addresser (<kbd>.FROM</kbd>) in a block flush left, page
left, with a gap of one linespace underneath
</li>
<li>the greeting flush left, with a gap of one linespace
underneath
</li>
</ul>
<p style="margin-top: -.5em;">
which is the standard for North American business correspondence.
The <kbd>.CC</kbd> macro, followed by a list of carbon copy
recipients, may go anywhere before <kbd>.GREETING</kbd>
</p>
<p>
If you switch the order of <kbd>.DATE</kbd>, <kbd>.TO</kbd> and/or
<kbd>.FROM</kbd>, mom sets all the headers
flush left, with a gap of one linespace underneath each. (The
default left quad of any header can be changed by invoking the
<kbd>.RIGHT</kbd> macro, on a line by itself, immediately before
inputting the text of the header.)
</p>
<p>
Following the headers, mom sets
</p>
<ul style="margin-top: -.5em;">
<li>the body of the letter justified</li>
<li>in multi-page letters:
<ul style="margin-left: -.5em;">
<li>a footer indicating there&#8217;s a next page (of the form <kbd>.../#</kbd>)</li>
<li>the page number at the top of every page after page one</li>
</ul></li>
<li>the closing/signature lines flush left, indented halfway across the page</li>
</ul>
<p>
Other important style defaults are listed below, and may be changed
via the
<a href="typesetting.html#top">typesetting macros</a>
or the document processing
<a href="definitions.html#controlmacro">control macros</a>
prior to
<a href="docprocessing.html#start">START</a>.
Assume that any style parameter not listed below is the same as for
any document processed with
<a href="docprocessing.html#typeset-defaults">PRINTSTYLE <kbd>TYPESET</kbd></a>
or
<a href="docprocessing.html#typewrite-defaults">PRINTSTYLE <kbd>TYPEWRITE</kbd></a>.
</p>
<div class="defaults-container" style="padding-bottom: 8px;">
<span class="pre defaults">
PARAMETER PRINTSTYLE TYPESET PRINTSTYLE TYPEWRITE
Paper size 8.5 x 11 inches 8.5 x 11 inches
Left/right margins 1.125 inches 1.125 inches
Header margin 3.5 picas 3.5 picas
(for page numbers)
Header gap 3 picas 3 picas
(for page numbers)
Family Times Roman Courier
Font roman roman
Point size 12 12
Line space 13.5 12 (i.e. singlespaced)
Paragraph indent 3 ems 3 picas
Spaced paragraphs yes no
Footers* yes yes
Footer margin 3 picas 3 picas
Footer gap 3 picas 3 picas
Page numbers top, centred top, centred
*Footers contain a &quot;next page&quot; number of the form .../#
</span>
</div>
<div class="rule-medium"><hr/></div>
<div class="macro-list-container">
<h3 id="index-letters-macros" class="macro-list">The letter macros</h3>
<p style="margin-left: 9px; margin-top: -1.5em;">
All letter macros must come after
<a href="docprocessing.html#start">START</a>,
except NO_SUITE, which must come after
<a href="docprocessin.html#start">PRINTSTYLE</a>
and before
<a href="docprocessing.html#start">START</a>.
</p>
<ul class="macro-list" style="margin-top: -.75em;">
<li><a href="#date">DATE</a></li>
<li><a href="#to">TO</a></li>
<li><a href="#cc">CC</a></li>
<li><a href="#from">FROM</a></li>
<li><a href="#greeting">GREETING</a></li>
<li><a href="#closing">CLOSING</a>
<ul style="margin-left: -.5em;">
<li><a href="#closing-indent">CLOSING_INDENT</a></li>
<li><a href="#signature-indent">SIGNATURE_INDENT</a></li>
</ul></li>
<li><a href="#no-suite">NO_SUITE</a> &ndash; turn the &#8220;next page&#8221; footer off</li>
</ul>
</div>
<!-- -DATE- -->
<div id="date" class="box-macro-args">
Macro: <b>DATE</b>
</div>
<p>
Invoke <kbd>.DATE</kbd> on a line by itself, with the date
underneath, like this:
<br/>
<span class="pre-in-pp">
.DATE
October 31, 2024
</span>
You may also enter the date symbolically using groff&#8217;s
<b>.pso</b> request and the system <b>date</b> command, like
this:
<br/>
<span class="pre-in-pp">
.DATE
.pso date "+%B %-e, %Y%n"
</span>
Consult the date(1) manpage for details of date formatting. Note
that you must pass <b>pdfmom</b> or <b>groff</b> the <b>-U</b> flag
when you use the <b>.pso</b> request.
</p>
<p>
If you wish to change the default quad direction for the date,
enter <kbd>.LEFT</kbd> or <kbd>.RIGHT</kbd>, on a line by itself,
immediately after <kbd>.DATE</kbd>.
</p>
<p>
If you want additional space between the date and any letter header
that comes after it, do so after inputting the date, not at the top
of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.DATE
October 31, 2012
.SPACE \"Or, more simply, .SP
</span>
If you wish to remove the default space,
<br/>
<span class="pre-in-pp">
.SPACE -1v \"Or, more simply, .SP -1v
</span>
will do the trick.
</p>
<!-- -TO- -->
<div id="to" class="box-macro-args">
Macro: <b>TO</b>
</div>
<p>
Invoke <kbd>.TO</kbd> on a line by itself, with the name and address
of the addressee underneath, like this:
<br/>
<span class="pre-in-pp">
.TO
JOHN SMITH
10 Roberts Crescent
Bramladesh, Ont.
</span>
If you wish to change the default quad direction for the address,
enter <kbd>.LEFT</kbd> or <kbd>.RIGHT</kbd>, on a line by itself,
immediately after <kbd>.TO</kbd>.
</p>
<p>
If you want additional space between the address and any letter
header that comes after it, do so after inputting the address, not
at the top of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.TO
JOHN SMITH
10 Roberts Crescent
Bramladesh, Ont.
.SPACE \"Or, more simply, .SP
</span>
If you wish to remove the default space,
<br/>
<span class="pre-in-pp">
.SPACE -1v \"Or, more simply, .SP -1v
</span>
will do the trick.
</p>
<!-- -CC- -->
<div id="cc" class="box-macro-args">
Macro: <b>CC</b>
</div>
<p>
The <kbd>.CC</kbd> macro, invoked on a line by itself and followed
by the names of carbon copy recipients, one to a line, creates a CC
list that is set at the bottom of letters, underneath the signature
line. If the list runs deep, mom shifts it to the next page.
</p>
<p>
Mom&#8217;s default is to introduce the list of CC recipients with
<kbd>CC:</kbd>. The default can be changed with the CC_STRING
macro, e.g.
<br/>
<span class="pre-in-pp">
.CC_STRING "Copies to:"
</span>
</p>
<p>
When setting up letter headers, the CC macro may go anywhere before
<a href="#greeting">GREETING</a>.
</p>
<!-- -FROM- -->
<div id="from" class="box-macro-args">
Macro: <b>FROM</b>
</div>
<p>
Invoke <kbd>.FROM</kbd> on a line by itself, with the name and
address of the addresser underneath, like this:
<br/>
<span class="pre-in-pp">
.FROM
JOE BLOW
15 Brunette Road
Ste-Vieille-Andouille, Québec
</span>
If you wish to change the default quad direction for the address,
enter <kbd>.LEFT</kbd> or <kbd>.RIGHT</kbd>, on a line by itself,
immediately after <kbd>.FROM</kbd>.
</p>
<p>
If you want additional space between the address and any letter
header that comes after it, do so after inputting the address, not
at the top of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.FROM
JOE BLOW
15 Brunette Road
Ste-Vieille-Andouille, Québec
.SPACE \"Or, more simply, .SP
</span>
If you wish to remove the default space,
<br/>
<span class="pre-in-pp">
.SPACE -1v \"Or, more simply, .SP -1v
</span>
will do the trick.
</p>
<!-- -GREETING- -->
<div id="greeting" class="box-macro-args">
Macro: <b>GREETING</b>
</div>
<p>
Invoke <kbd>.GREETING</kbd> on a line by itself, with the full
salutation you want for the letter underneath, like this:
<br/>
<span class="pre-in-pp">
.GREETING
Dear Mr. Smith,
</span>
</p>
<!-- -CLOSING- -->
<div id="closing" class="box-macro-args">
Macro: <b>CLOSING</b>
</div>
<p>
Mom-formatted letters must end with <kbd>.CLOSING</kbd>. Follow
it on the next line with your preferred complimentary closing
(e.g. &#8220;Yours truly,&#8221;), like this:
<br/>
<span class="pre-in-pp">
.CLOSING
Yours truly,
</span>
If you&#8217;d rather not have a complimentary closing, follow
<kbd>.CLOSING</kbd> with <kbd>\&</kbd> on a line by itself. Mom
will still automatically supply the signature line, whose position
you may want to adjust with
<a href="signature-space">SIGNATURE_SPACE</a>.
</p>
<div class="box-tip" style="background-color: #E3D2B1;">
<p class="tip">
<span class="tip" style="display: inline-block; padding-bottom: .5em; color: #000056;">CLOSING control macros and defaults</span>
<br/>
Two macros control the behaviour of <kbd>.CLOSING</kbd>:
</p>
<ul style="margin-top: -1.25em;">
<li>CLOSING_INDENT</li>
<li>SIGNATURE_SPACE</li>
</ul>
<p id="closing-indent" style="margin-top: -.25em;">
The first, CLOSING_INDENT, indicates the distance from the left
margin you&#8217;d like to have your closing indented. It takes a
single
<a href="definitions.html#numericargument">numeric argument</a>
and must have a
<a href="definitions.html#unitofmeasure">unit of measure</a>
appended to it, unless you want an indent of 0 (zero). Mom&#8217;s
default is one half the width of the letter&#8217;s line length
(i.e. halfway across the page). If you wanted, instead, an indent of
6
<a href="definitions.html#picaspoints">picas</a>,
you&#8217;d do it like this:
<br/>
<span class="pre-in-pp">
.CLOSING_INDENT 6P
</span>
Or, if you wanted to have no indent at all:
<br/>
<span class="pre-in-pp">
.CLOSING_INDENT 0
</span>
</p>
<p id="signature-space" style="margin-top: -1.25em;">
The second, SIGNATURE_SPACE, controls how much room to leave for the
signature. It takes a single
<a href="definitions.html#numericargument">numeric argument</a>
and must have a
<a href="definitions.html#unitofmeasure">unit of measure</a>
appended to it. Mom&#8217;s default is 3 line spaces, but if you
wanted to change that to, say, 2 line spaces, you&#8217;d do:
<br/>
<span class="pre-in-pp">
.SIGNATURE_SPACE 2v
</span>
</p>
</div>
<!-- -NO_SUITE- -->
<div id="no-suite" class="box-macro-args" style="margin-top: 2em;">
Macro: <b>NO_SUITE</b>
</div>
<p>
If you don&#8217;t want mom to print a &#8220;next page&#8221;
number at the bottom of multi-page letters, invoke
<kbd>.NO_SUITE</kbd>, on a line by itself, prior to
<a href="docprocessing.html#start">START</a>.
</p>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="macrolist.html">Next: Quick reference guide</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,350 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Recto/verso printing, collating</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="cover.html#top">Next: Cover pages</a></td>
</tr>
</table>
<h1 class="docs">Recto/verso printing, collating</h1>
<div style="width: 50%; margin: auto;">
<ul class="no-enumerator" style="margin-left: -1em;">
<li><a href="#rectoverso-intro">Introduction to recto/verso printing</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#rectoverso-list">Macro list</a></li>
</ul></li>
<li><a href="#collate-intro">Introduction to collating</a>
<ul style="margin-left: -.5em; list-style-type: disc;">
<li><a href="#collate">The COLLATE macro</a></li>
</ul></li>
</ul>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="rectoverso-intro" class="docs">Introduction to recto/verso printing</h2>
<p>
Recto/verso printing allows you to set up a mom document in such
a way that it can be printed on both sides of a printer sheet and
subsequently bound.
</p>
<p>
With recto/verso, mom automatically takes control of the following
aspects of alternating page layout:
</p>
<ul style="margin-top: -.5em; margin-left: -.5em; margin-bottom: -.5em;">
<li>switching left and right margins (if they&#8217;re not equal)</li>
<li>switching the left and right parts of the default 3-part
<a href="definitions.html#header">headers</a>
or
<a href="definitions.html#footer">footers</a>
(see the
<a href="headfootpage.html#description-general">General description of headers</a>)
</li>
<li>switching
<a href="headfootpage.html#hdrftr-recto">HEADER_RECTO</a>
and
<a href="headfootpage.html#hdrftr-recto">HEADER_VERSO</a>
if user-defined, single string recto/verso headers
or footers are used in place of the default 3-part
headers or footers
</li>
<li>switching the page number position (if page numbers are not centred)</li>
</ul>
<br/>
<div class="macro-list-container">
<h3 id="rectoverso-list" class="macro-list">Recto/verso macros</h3>
<ul class="macro-list">
<li><a href="#recto-verso">RECTO_VERSO</a></li>
<li><a href="#force-recto">FORCE_RECTO</a></li>
<li><a href="#switch-hdrftr">SWITCH_HEADERS (also FOOTERS)</a>
&ndash; switch starting position of the header parts (left and right)
</li>
</ul>
</div>
<!-- -RECTO_VERSO- -->
<div id="recto-verso" class="box-macro-args">
Macro: <b>RECTO_VERSO</b>
</div>
<p>
If you want mom to set up alternating pages for recto/verso
printing, simply invoke RECTO_VERSO, with no argument, anywhere in
your document (most likely before
<a href="docprocessing.html#start">START</a>).
</p>
<div class="box-tip">
<p class="tip-top">
<span class="note">Note:</span>
Recto/verso always switches the left and right parts of
<a href="definitions.html#header">headers</a>
or
<a href="definitions.html#footer">footers</a>
on odd/even pages. However, it only switches the left and right
margins if the margins aren&#8217;t equal. Consequently, it is
your responsibility to set the appropriate differing left and right
margins with
<a href="typesetting.html#l-margin">L_MARGIN</a>
and
<a href="typesetting.html#r-margin">R_MARGIN</a>
(prior to
<a href="docprocessing.html#start">START</a>)
or with
<a href="docprocessing.html#doc-left-margin">DOC_LEFT_MARGIN</a>
and
<a href="docprocessing.html#doc-right-margin">DOC_RIGHT_MARGIN</a>
(before or after START).
</p>
<p class="tip-bottom">
Equally, recto/verso only switches the page number position if page
numbers aren&#8217;t centred, which means you have to set the page
number position with
<a href="headfootpage.html#pagenum-pos">PAGENUM_POS</a>
(before or after START).
</p>
</div>
<!-- -FORCE_RECTO- -->
<div id="force-recto" class="box-macro-args" style="margin-top: 1em;">
Macro: <b>FORCE_RECTO</b>
</div>
<p>
It is a common convention with two-sided printing to ensure that
cover pages, title pages, and chapters or major sections of a document
always begin on the recto side of a page. This sometimes
necessitates inserting a blank page before the start of a new
chapter or major section.
</p>
<p>
If you would like mom to take care of this for you automatically,
simply invoke <kbd>FORCE_RECTO</kbd> before the first
<a href="docprocessing.html#start">START</a>
of the document.
</p>
<!-- -SWITCH_HDRFTR- -->
<div id="switch-hdrftr" class="box-macro-args" style="margin-top: 1em;">
Macro: <b>SWITCH_HEADERS</b>
</div>
<p>
SWITCH_HEADERS switches the location of the header left string
(by default, the author) and the header right string (by default,
the document title). If you don&#8217;t like mom&#8217;s default
placement of author and title, use SWITCH_HEADERS to reverse it.
</p>
<p>
SWITCH_HEADERS can also be useful in conjunction with
<a href="#recto-verso">RECTO_VERSO</a>.
The assumption of RECTO_VERSO is that the first page of a document
(i.e. recto/odd) represents the norm for header-left and header-right,
meaning that the second (and all subsequent verso/even) pages of the
document will reverse the order of header-left and header-right.
</p>
<p>
If mom&#8217;s behaviour in this matter is not what you want, simply
invoke SWITCH_HEADERS on the first page of your recto/verso document
to reverse her default treatment of header parts. The remainder of
your document (with respect to headers) will come out as you want.
</p>
<div class="rule-medium"><hr/></div>
<!-- ===================================================================== -->
<h2 id="collate-intro" class="docs">Introduction to collating</h2>
<p>
Many people wisely keep chapters of a long work in separate
files, previewing or printing them as needed during the draft
phase. However, when it comes to the final version, mom requires
a single, collated file in order to keep track of page numbering
and recto/verso administration, generating tables of contents and
endnotes, ensuring that
<a href="definitions.html#docheader">docheaders</a>
get printed correctly, and a host of other details.
</p>
<p>
The COLLATE macro, which can be used with any
<a href="docprocessing.html#doctype">DOCTYPE</a>
except <kbd>LETTER</kbd>, lets you glue mom-formatted input files
together. You need only concatenate chapters into a single file
(most likely with <kbd>cat(1)</kbd>), and put
<kbd>.COLLATE</kbd> at the end of each concatenated chapter.
Assuming all the files begin with the required
<a href="docprocessing.html#reference-macros">reference macros</a>
(metadata), style parameters, and
<a href="docprocessing.html#start">START</a>,
each chapter will begin on a fresh page and behave as expected.
</p>
<p>
Even if you work with monolithic, multi-chapter files, every
chapter and its associated metadata plus <kbd>.START</kbd>
still needs to be preceded by <kbd>.COLLATE</kbd>.
</p>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
COLLATE assumes you are collating documents/files with similar
type-style parameters hence there&#8217;s no need for PRINTSTYLE
to appear after COLLATE, although if you&#8217;re collating
documents that were created as separate files, chances are the
PRINTSTYLE&#8217;s already there.
</p>
</div>
<div class="box-tip">
<p id="caution" class="tip">
<b>Two words of caution:</b>
</p>
<ol style="margin-top: -1.25em; padding-bottom: .5em;">
<li>Do not collate documents of differing
PRINTSTYLES (i.e., don&#8217;t try to
collate a <kbd>TYPESET</kbd> document and <kbd>TYPEWRITE</kbd>
document).
</li>
<li>Use <kbd>.DOC_FAMILY</kbd> instead of
<kbd>.FAMILY</kbd> if, for some reason, you want to
change the family of all the document elements after
<kbd>.COLLATE</kbd>. <kbd>.FAMILY</kbd>, by itself, will
change the family of paragraph text only.
</li>
</ol>
</div>
<!-- -COLLATE- -->
<div class="macro-id-overline">
<h3 id="collate" class="macro-id">collate</h3>
</div>
<div class="box-macro-args">
Macro: <b>COLLATE</b>
</div>
<p>
The most basic (and most likely) collating situation looks like
this:
<br/>
<span class="pre-in-pp">
.COLLATE
.CHAPTER 17
.START
</span>
A slightly more complex version of the same thing, for chapters
that require their own titles, looks like this:
<br/>
<span class="pre-in-pp">
.COLLATE
.CHAPTER_TITLE "Geek Fatigue: Symptoms and Causes"
.START
</span>
</p>
<div class="box-tip" style="margin-top: -1em">
<p class="tip">
<span class="tip">Tip:</span>
If the last line of text before <kbd>.COLLATE</kbd>
falls too close to the bottom margin, or if the line is followed
by a macro likely to cause a linebreak (e.g. <kbd>.LIST OFF</kbd> or
<kbd>.IQ</kbd>), mom may output a superfluous blank page before
the start of the following document.
</p>
<p class="tip-bottom" style="margin-top: -1em">
In order to avoid this, insert
<a href="docprocessing.html#EL"><kbd>.EL</kbd></a>
after the last line of text, before <kbd>.COLLATE</kbd> and/or any
concluding macros. For example,
<br/>
<span class="pre-in-pp">
some concluding text.\c
.EL
.COLLATE
</span>
or
<br/>
<span class="pre-in-pp">
some concluding text.\c
.EL
.LIST OFF
.COLLATE
</span>
</p>
</div>
<div class="box-tip">
<p class="tip">
<span class="note">Note:</span>
See the
<a href="#caution">two words of caution</a>,
above.
</p>
</div>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="cover.html">Next: Cover pages</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,691 @@
/* Copyright (C) 2004-2020 Free Software Foundation, Inc. */
/* This file is part of mom, which is part of groff, a free software */
/* project. */
/* You can redistribute it and/or modify it under the terms of the */
/* "GNU General Public License" as published by the "Free Software */
/* Foundation", version 2.
/* The license text is available in the internet at */
/* <http://www.gnu.org/licenses/gpl-2.0.html> */
/* stylesheet for the mom macros documentation */
a:link { color: blue; text-decoration: none; }
a:hover { color: red; text-decoration: underline; }
a:visited { color: purple; text-decoration: none; }
a:visited:hover { color: purple; text-decoration: underline; }
a.header-link:visited { color: #6e70cc ; }
a.header-link:visited:hover { color: #6e70cc ; }
a:link.quick { text-decoration: underline; }
.version /* version number for top of toc.html */
{
font-size: 90% ;
text-align: center ;
}
.page /* Page setup: page color, size and border */
{
width: 67% ;
position: relative ;
top: 12px ;
bottom: 12px ;
margin: auto ;
padding: 12px ;
border: solid 1px #ceac8d ;
color: #302419 ;
background-color: #ffffeb ;
font: 1em/1.5em arial,sans-serif ;
font-variant-ligatures: none;
}
.nobr /* Make <nobr> a class property */
{
white-space: nowrap ;
hyphens: none ;
}
/* Heads */
h1.docs
{
font-family: arial,sans-serif ;
font-size: 125% ;
text-align: center ;
color: #002b56 ;
background-color: #e2f1ff ;
outline: solid 1px #99cccc ;
padding: 6px ;
}
h2.docs
{
margin-bottom: -.25em ;
font-size: 105% ;
color: #000056 ;
}
h2.macro-group /* ie "Page setup" or "Indents" or "Multi-columns" */
{
margin-top: 1em ;
font-size: 120% ;
color: #000056 ;
background-color: #dfccad ;
padding: 6px ;
}
h3.docs
{
margin-bottom: -.5em ;
font-size: 95% ;
color: #000056 ;
text-transform: uppercase ;
}
h3.appendices
{
font-size: 100% ;
text-transform: none ;
}
h3.notes
{
display: inline-block ;
margin-top: .5em ;
}
h3.control
{
padding-top: .5em ;
font-size: 100% ;
text-transform: none ;
}
h3.numbered
{
font-size: 100% ;
margin-bottom: -.5em ;
}
h3.macro-id
{
font-size: 105% ;
color: #000056 ;
text-transform: uppercase ;
margin-top: 3px ;
margin-bottom: 0px ;
}
h4.docs
{
font-size: 95% ;
margin-bottom: -.5em ;
color: #000056 ;
}
h4.doc-param-macros
{
margin-top: -.5em ;
}
h4.arg-list
{
margin-top: -.5em ;
}
h4.fields
{
color: #302419 ;
}
h5.docs
{
margin-bottom: -.5em ;
font-size: 95% ;
color: #000056 ;
text-transform: uppercase ;
}
ul.doc-param-macros
{
margin-top: .75em ;
margin-left: -.5em ;
}
.control-macros-header
{
display: inline-block ;
margin-bottom: -.25em ;
padding: 2px 6px 0 6px ;
outline: 1px solid #000058 ;
font-size: 100% ;
background-color: #e2f1ff ;
}
.control-macro
{
font-size: 100% ;
margin-bottom: -.75em ;
color: #2f2f71 ;
}
.macro-id-overline
{
display: inline-block ;
border-top: solid 2px #8d8775 ;
margin-bottom: .5em ;
}
/* Paragraphs */
p.no-indent
{
text-indent: 0px ;
}
p.requires
{
font-family: arial,sans-serif ;
font-style: italic ;
text-indent: 0px ;
margin-top: .25em ;
}
p.alias
{
font-family: arial,sans-serif ;
font-style: normal ;
text-indent: 0px ;
margin-top: .25em ;
}
/* Horizontal rules */
hr /* horizontal rules need a border to be colorized) */
{
border: solid 1px #8d8775 ;
}
div.rule-short /* for section breaks; top/bottom margins set manually */
{
display: block ;
width: 25% ;
margin: auto;
clear: both ;
}
div.rule-medium /* underneath mini-tocs; top/bottom margins set manually */
{
display: block ;
width: 40% ;
margin: auto;
clear: both ;
}
div.rule-long /* precedes nav bar at bottom of page */
{
display: block ;
width: 90% ;
margin: auto;
}
/* Boxed text */
.box-macro-args /* Macro name+args */
{
display: block ;
border: solid 1px #302419 ;
padding-top: 5px ;
padding-bottom: 3px ;
padding-left: 15px ;
padding-right: 15px ;
background-color: #ffffff ;
white-space: nowrap ;
overflow: auto ;
}
.box-code
{
display: block ;
width: 100% ;
border: solid 1px #302419 ;
padding-top: 5px ;
padding-bottom: 18px ;
padding-left: 15px ;
padding-right: 15px ;
color: #6f614a ;
background-color: #ffffff ;
white-space: nowrap ;
}
.box-tip
{
outline: solid 1px #ceac8d ;
padding-left: 15px ;
padding-right: 15px ;
text-align: left ;
background-color: #f9f9d9 ;
margin-bottom: 1.5em ;
}
.box-example-layout
{
outline: solid 1px #ceac8d ;
padding-left: 15px ;
padding-right: 15px ;
text-align: justify ;
background-color: #f9f9d9 ;
margin-bottom: 2.5em ;
}
.box-notes
{
outline: solid 1px #ceac8d ;
padding-left: 15px ;
padding-right: 15px ;
text-align: justify ;
background-color: #f9f9d9 ;
margin-bottom: 1.5em ;
}
.box-important
{
outline: solid 1px #ce7a65 ;
padding-left: 15px ;
padding-right: 15px ;
text-align: justify ;
background-color: #f9f9d9 ;
margin-bottom: 1.5em ;
}
p.tip
{
padding-top: 9px ;
padding-bottom: 9px ;
text-indent: 0px ;
}
p.tip-top
{
padding-top: 9px ;
text-indent: 0px ;
}
p.tip-bottom
{
padding-bottom: 9px ;
text-indent: 0px ;
}
/* Pre-formatted code */
span.pre /* pre-formatted multi-line blocks; indent must be exactly 2 spaces */
{
display: block ;
position: relative ;
top: -1em ;
margin-bottom: -1.5em ;
font-family: "Lucida Console",monospace ;
font-weight: bolder ;
font-size: 95% ;
white-space: pre ;
overflow: auto ;
}
span.defaults
{
margin-left: 6px ;
padding-bottom: 1em ;
font-size: 95% ;
}
span.pre-in-pp
{
display: block ;
position: relative ;
top: -1em ;
margin-bottom: -.5em ;
font-family: "Lucida Console",monospace ;
font-weight: bolder ;
font-size: 95% ;
white-space: pre ;
overflow: auto ;
}
span.important
{
font-family: arial,sans-serif ;
font-weight: bolder ;
color: #8b0000 ;
}
span.note
{
font-family: arial,sans-serif ;
font-weight: bolder ;
color: #443526 ;
}
span.additional-note
{
font-family: arial,sans-serif ;
font-weight: bolder ;
font-style: italic ;
color: #443526 ;
}
span.tip
{
font-family: arial,sans-serif ;
font-weight: bolder ;
color: #443526 ;
}
span.experts
{
font-family: arial,sans-serif ;
font-weight: bolder ;
color: #443526 ;
}
/* Mini-tocs (usually at top of page) */
/* 1-column, centered mini-toc */
ul.mini-toc-centered
{
text-align: center ;
list-style-type: none ;
margin-left: -40px ;
}
/* 2-column mini-toc column defs*/
.mini-toc-col-1
{
float: left ;
width: 49% ;
margin-left: -10px ;
}
.mini-toc-col-2
{
float: left ;
width: 51% ;
clear: right ;
}
/* 3-column mini-toc column defs */
.col-1-definitions
{
float: left ;
width: 32% ;
height: 55em ;
padding-bottom: 9px;
background-color: #ded4bd ;
margin-right: 2% ;
}
.col-2-definitions
{
float: left ;
width: 32% ;
height: 55em ;
padding-bottom: 9px;
background-color: #ded4bd ;
margin-right: 2% ;
}
.col-3-definitions
{
float: left ;
width: 32% ;
height: 55em ;
padding-bottom: 9px;
background-color: #ded4bd ;
margin-bottom: 24px ;
}
/* List styles */
ul.toc
{
margin-top: .5em ;
}
ul.no-enumerator
{
list-style-type: none ;
}
.list-head
{
font-family: arial,sans-serif ;
font-weight: bolder ;
font-size: 110% ;
color: #000056 ;
}
.list-head-goodies
{
font-family: arial,sans-serif ;
font-weight: normal ;
font-size: 110% ;
color: #000056 ;
}
.no-anchor
{
color: #302419 ;
font-weight: bold ;
}
.text-color
{
color: #302419 ;
}
li.item
{
font-family: arial,sans-serif ;
font-weight: normal ;
font-size: 100% ;
margin-left: -10px ;
list-style-type: disc ;
}
.mini-toc
{
margin-top: -1em ;
font-size: 90% ;
}
.sublist
{
margin-left: -1em ;
font-size: 90% ;
color: #302419 ;
list-style-type: disc ;
}
.sub
{
list-style-type: circle ;
}
.normal
{
font-style: normal ;
font-size: 100% ;
}
.normal-smaller
{
font-weight: normal ;
color: #302419 ;
font-size: 90% ;
}
.normal-sub-sub
{
font-weight: normal ;
color: #302419 ;
font-size: 90% ;
}
/* Macro lists / defaults */
div.macro-list-container
{
background-color: #ded4bd ;
margin-bottom: 1.5em ;
}
h3.macro-list
{
font-size: 100% ;
color: #000056 ;
text-transform: uppercase ;
padding: 9px ;
}
ul.macro-list
{
margin-left: -21px ;
padding-right: 12px ;
list-style-type: none ;
font-family: arial,sans-serif ;
margin-top: -1.25em ;
padding-bottom: 6px ;
}
ol.macro-list
{
font-family: arial,sans-serif ;
margin-top: -1.25em ;
padding-bottom: 6px ;
}
.defaults-container
{
background-color: #e3d2b1 ;
border: 1px solid #3f2c00 ;
margin-bottom: 2.5em ;
}
h3.defaults
{
font-size: 100% ;
color: #000056 ;
text-transform: uppercase ;
padding: 9px ;
}
p.defaults
{
margin-top: .25em ;
margin-left: 6px ;
margin-right: 12px ;
margin-bottom: 0 ;
}
#toc-title, #toc-head, #toc-subhead, #toc-parahead
{
display: block ;
margin-top: -1em ;
margin-bottom: -1em ;
}
/* Bottom of page spacer */
div.bottom-spacer
{
display: block ;
height: 24px ;
}
/* General markup */
kbd
{
font-family: "Lucida Console",monospace ;
font-weight: bold ;
font-size: 98% ;
}
kbd.macro-args
{
margin-right: .5em ;
color: #6f614a ;
white-space: nowrap ;
overflow: auto ;
}
/* tocs */
h1.toc
{
font-family: arial,sans-serif ;
font-size: 175% ;
text-align: center ;
color: #002b56 ;
background-color: #e2f1ff ;
outline: solid 1px #99cccc ;
padding: 6px ;
}
h2.toc
{
font-size: 120% ;
color: #000056 ;
}
h3.toc
{
margin-top: -.5em ;
margin-bottom: -.5em ;
font-size: 100% ;
color: #6e70cc ;
}
.highlight
{
font-weight: bold ;
}
.fourth-level
{
margin-left: -1.25em ;
list-style-type: none ;
}
ul.toc-docproc
{
margin-left: -1em ;
}
.toc-docproc-header
{
margin-top: -.5em ;
text-transform: uppercase ;
}
a.header-link
{
color: #6e70cc ;
font-size: 95% ;
}
/* Examples */
.examples-container
{
border: solid 1px #917963 ;
background-color: #f9f9d9 ;
padding-left: 24px ;
padding-right: 24px ;
padding-top: 3px ;
padding-bottom: 3px ;
}
.examples
{
font-weight: bolder ;
font-size: 98% ;
color: #524b3f ;
margin-top: 12px ;
margin-bottom: 3px ;
}
/* definitions.html */
table.definitions /* mini-toc is set up as a table */
{
margin-top: 12px ;
text-align: left ;
margin-left: 12px ;
}
th.definitions
{
padding-bottom: 6px ;
font-size: 120% ;
color: #000056 ;
}
dt /* definition terms in italic*/
{
font-style: italic ;
}
dt.no-italic
{
font-style: normal ;
}
/* Tables */
table.quick-ref
{
margin-top: .25em ;
}
table.quick-ref, th.quick-ref
{
padding-bottom: .25em ;
font-family: "Lucida Console",monospace ;
font-weight: bold ;
text-align: left ;
}
td
{
padding: 0 ;
padding-left: .5em ;
}
/* Misc */
span.book-title
{
font-style: italic ;
}
dt.params
{
font-style: normal ;
font-weight: bold ;
}
dd.cover-args
{
margin-bottom: .25em;
margin-left: 1.25em ;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2023 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom, version 2.6_d -- Table of Contents</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div class="page">
<div class="version">
mom, version 2.6_d
</div>
<h1 class="toc" style="margin-top: 9px;">Table of Contents</h1>
<p style="margin-left: 2.75em; margin-right: 2.75em; text-align:center ">
The table of contents is large. To ease navigation,
click on any link in the
<br/>
<a href="#quick-toc">Quick Table of Contents</a>
<br/>
which will take you to the corresponding entry in the
<br/>
<a href="#detailed-toc">Detailed Table of Contents</a>.
<br/>
If you&#8217;ve been using mom for a while, you may prefer the
<br/>
<a href="macrolist.html#top">Quick Reference Guide</a>,
<br/>
which gives a convenient, categorized list of mom&#8217;s
user-space macros with links to corresponding entries in the
documentation.
</p>
<div class="rule-medium"><hr/></div>
<!-- -QUICK TABLE OF CONTENTS- -->
<h2 id="quick-toc" class="toc" style="margin-top: 18px; text-align: center;">Quick Table of Contents</h2>
<div style="width: 50%; margin-top: .75em; margin-left: 12px; float: left;">
<h3 id="version-2" class="toc"><a style="color: #6e70cc" href="#v2-notes">VERSION 2.0 NOTES</a></h3>
<br/>
<h3 id="introductory" class="toc"><a style="color: #6e70cc" href="#what">INTRODUCTION TO MOM</a></h3>
<ul class="toc">
<li><a href="#what">What is mom?</a></li>
<li><a href="#defs">Definitions of terms used in this manual</a></li>
<li><a href="#using">Using mom</a></li>
</ul>
<h3 id="typesetting" class="toc"><a style="color: #6e70cc" href="#typeset">TYPESETTING WITH MOM</a></h3>
<ul class="toc">
<li><a href="#type-intro">Introduction to the typesetting macros</a></li>
<li><a href="#page">Page setup</a></li>
<li><a href="#param">Basic typesetting parameters</a></li>
<li><a href="#just">Justifying, quadding, etc.</a></li>
<li><a href="#refine">Refinements</a></li>
<li><a href="#mod">Modifying type</a></li>
<li><a href="#vert">Vertical movements</a></li>
<li><a href="#tab">Tabs</a></li>
<li><a href="#col">Multiple columns</a></li>
<li><a href="#ind">Indents</a></li>
<li><a href="#goodies">Goodies</a></li>
<li><a href="#escapes">Inline escapes</a></li>
<li><a href="#color">Coloured text</a></li>
<li><a href="#graphical">Graphical objects</a></li>
</ul>
</div>
<div style="margin-left: 332px;">
<h3 id="document-processing" class="toc" style="margin-top: 1.25em;"><a style="color: #6e70cc" href="#doc-proc">DOCUMENT PROCESSING WITH MOM</a></h3>
<ul class="toc" style="margin-left: 3em;">
<li><a href="#doc-proc">Introduction to document processing</a></li>
<li><a href="#doc-defaults">Document defaults</a></li>
<li><a href="#vert-ws">Vertical whitespace management</a></li>
<li><a href="#prelim">Preliminary document setup</a></li>
<li><a href="#typemacdoc">Behaviour of the typesetting macros during document processing</a></li>
<li><a href="#tags">The document element tags</a> &ndash; headings, paragraphs, quotes, etc.</li>
<li><a href="#images">Graphics, floats, and preprocessor support</a></li>
<li><a href="#box">Shaded backgrounds and frames</a></li>
<li><a href="#hdrftr">Page headers and footers</a></li>
<li><a href="#paginate">Pagination</a></li>
<li><a href="#rv">Recto/verso printing and collating</a></li>
<li><a href="#cover">Cover pages</a></li>
<li><a href="#tocs">Tables of contents</a></li>
<li><a href="#ref">Bibliographies and references</a></li>
<li><a href="#letter">Writing letters</a>
<ul style="list-style-type: none;">
<li style="display: inline-block; width: 212px; height: 0; margin-top: .5em; margin-left: -2.5em; border: solid 1px #8d8775;">&nbsp;</li>
</ul></li>
<li style="margin-top: -1em;"><a href="#quick">Quick reference guide</a></li>
<li><a href="#appendices">Appendices</a></li>
</ul>
</div>
<div class="rule-long" style="clear: both;"><hr/></div>
<!-- -FULL TABLE OF CONTENTS- -->
<h2 id="detailed-toc" class="toc" style="margin-top: 24px; text-align: center;">Detailed Table of Contents</h2>
<div style="margin-left: 12px;">
<h3 id="v2-notes" class="toc"><a style="color: #6e70cc" href="version-2.html#top">VERSION 2.0 NOTES</a></h3>
<ul class="toc">
<li><a href="version-2.html#prefatory">Prefatory comments</a></li>
<li><a href="version-2.html#differences">Differences between 2.0 and 1.x</a>
<ul>
<li><a href="version-2.html#pdf-support">PDF Support</a></li>
<li><a href="version-2.html#covers">Covers</a></li>
<li><a href="version-2.html#headings">Headings</a></li>
<li><a href="version-2.html#margin-notes">Margin notes</a></li>
<li><a href="version-2.html#floats">Floats</a></li>
<li><a href="version-2.html#table-of-contents">Table of Contents</a></li>
</ul></li>
<li><a href="version-2.html#pdfmom">The <strong>pdfmom</strong> wrapper around groff</a></li>
<li><a href="version-2.html#install-font">The <strong>install-font</strong> script</a></li>
</ul>
<h3 id="what" class="toc"><a style="color: #6e70cc" href="intro.html#top">1. WHAT IS MOM?</a></h3>
<ul class="toc">
<li><a href="intro.html#intro-intro">1.1 Who is mom meant for?</a></li>
<li><a href="intro.html#intro-typesetting">1.2 Typesetting with mom</a></li>
<li><a href="intro.html#intro-docprocessing">1.3 Document processing with mom</a></li>
<li><a href="intro.html#intro-philosophy">1.4 Mom&#8217;s philosophy</a></li>
<li><a href="intro.html#intro-documentation">1.5 A note on mom&#8217;s documentation</a>
<ul>
<li><a href="intro.html#canonical">1.5.1 Canonical reference materials</a></li>
<li><a href="intro.html#macro-args">1.5.2 How to read macro arguments</a></li>
<li><a href="intro.html#toggle-macro">1.5.3 &#8220;Toggle&#8221; macros</a></li>
<li><a href="intro.html#examples">1.5.4 Examples</a></li>
</ul>
</li>
</ul>
<h3 id="defs" class="toc"><a style="color: #6e70cc" href="definitions.html#top">2. DEFINITIONS OF TERMS USED IN THIS MANUAL</a></h3>
<ul class="toc">
<li><a href="definitions.html#typesetting-terms">2.1 Typesetting terms</a></li>
<li><a href="definitions.html#groff-terms">2.2 Groff terms</a></li>
<li><a href="definitions.html#mom-terms">2.3 Mom&#8217;s document processing terms</a></li>
</ul>
<h3 id="using" class="toc"><a style="color: #6e70cc" href="using.html#top">3. USING MOM</a></h3>
<ul class="toc">
<li><a href="using.html#using-intro">3.1 Introduction</a></li>
<li><a href="using.html#using-macros">3.2 How to input mom&#8217;s macros</a></li>
<li><a href="using.html#viewing">3.3 Processing and viewing documents</a>
<ul>
<li><a href="using.html#pdf">Mom and pdf</a></li>
<li><a href="using.html#pdfmom">pdfmom</a></li>
</ul></li>
<li><a href="using.html#previewing">3.4 Automatic previewing of documents</a></li>
</ul>
<!-- -TYPESETTING MACROS- -->
<h3 id="typeset" class="toc"><a style="color: #6e70cc" href="typesetting.html#top">4. TYPESETTING WITH MOM</a></h3>
<ul class="toc">
<li><a id="type-intro" href="typesetting.html#typesetting-intro">4.1 Introduction to the typesetting macros</a></li>
<li><a id="page" href="typesetting.html#page-setup-intro">4.2 Page setup</a> &ndash; paper size and page margins
<ul>
<li><a href="typesetting.html#index-page-setup">4.2.1 Macro list</a></li>
</ul></li>
<li><a id="param" href="typesetting.html#basic-params-intro">4.3 Basic typesetting parameters</a> &ndash; family, font, fallback font, point size, line space, line length, autolead
<ul>
<li><a href="typesetting.html#index-basic">4.3.1 Macro list</a></li>
</ul></li>
<li><a id="just" href="typesetting.html#justification-intro">4.4 Justifying, quadding, filling and breaking lines</a>
<ul>
<li><a href="typesetting.html#index-justification">4.4.1 Macro list</a></li>
</ul></li>
<li><a id="refine" href="typesetting.html#refinements-intro">4.5 Refinements</a> &ndash; word space, sentence space, letter spacing (track kerning), hyphenation, kerning, ligatures
<ul>
<li><a href="typesetting.html#index-refinements">4.5.1 Macro list</a></li>
</ul></li>
<li><a id="mod" href="typesetting.html#modifications-intro">4.6 Modifying Type</a> &ndash; pseudo-italic, -bold, -condensed, and -extended
<ul>
<li><a href="typesetting.html#index-modifications">4.6.1 Macro list</a></li>
</ul></li>
<li><a id="vert" href="typesetting.html#aldrld-intro">4.7 Vertical Movements</a> &ndash; moving up and down on the page
<ul>
<li><a href="typesetting.html#index-aldrld">4.7.1 Macro list</a></li>
</ul></li>
<li><a id="tab" href="typesetting.html#tabs-intro">4.8 Tabs</a>
<ul>
<li><a href="typesetting.html#typesetting-tabs">4.8.1 Typesetting tabs</a>
<ul>
<li><a href="typesetting.html#typesetting-tabs-tut">4.8.1.1 Quickie tutorial</a></li>
</ul></li>
<li><a href="typesetting.html#string-tabs">4.8.2 String tabs (autotabs)</a>
<ul>
<li><a href="typesetting.html#string-tabs-tut">4.8.2.1 Quickie tutorial</a></li>
</ul></li>
<li><a href="typesetting.html#index-tabs">4.8.3 Macro list</a></li>
</ul></li>
<li><a id="col" href="typesetting.html#multicolumns-intro">4.9 Multiple columns</a>
<ul>
<li><a href="typesetting.html#index-multicolumns">4.9.1 Macro list</a></li>
</ul></li>
<li><a id="ind" href="typesetting.html#indents-intro">4.10 Indents</a>
<ul>
<li><a href="typesetting.html#indents-handling">4.10.1 A brief explanation of how mom handles indents</a></li>
<li><a href="typesetting.html#index-indents">4.10.2 Macro list</a></li>
</ul></li>
<li><a id="goodies" href="goodies.html#top">4.11 Goodies</a>
&ndash; aliases, transparent (comment) lines, smartquotes, caps,
underscoring/underlining, padding lines, leaders, drop
caps, superscripts, user-definable strings, changing the
escape character
<ul>
<li><a href="goodies.html#index-goodies">4.11.1 Macro list</a></li>
</ul></li>
<li><a id="escapes" href="inlines.html#top">4.12 Inline Escapes</a>
<ul>
<li><a href="inlines.html#intro-inlines">4.12.1 Introduction to inline escapes</a></li>
<li><a href="inlines.html#index-inlines">4.12.2 List of inline escapes</a></li>
<li><a href="inlines.html#inlines-mom-top">4.12.3 Mom&#8217;s personal inline escapes</a></li>
<li><a href="inlines.html#inlines-groff-top">4.12.4 Commonly-used groff inline escapes</a>
<ul>
<li><a href="inlines.html#inline-characters-groff">4.12.4.1 Special characters and symbols</a></li>
</ul></li>
</ul></li>
<li><a id="color" href="color.html#top">4.13 Coloured text</a>
<ul>
<li><a href="color.html#intro-color">4.13.1 Introduction to coloured text</a></li>
<li><a href="color.html#index-color">4.13.2 Macro list</a></li>
</ul></li>
<li><a id="graphical" href="graphical.html#top">4.14 Graphical objects</a>
&ndash; horizontal and vertical rules, boxes, ellipses (circles)
<ul>
<li><a href="graphical.html#intro-graphical">4.14.1 Introduction to graphical objects</a></li>
<li><a href="graphical.html#index-graphical">4.13.2 Macro list</a></li>
</ul></li>
</ul>
<!-- -DOCUMENT PROCESSING MACORS- -->
<h3 id="doc-proc" class="toc"><a style="color: #6e70cc" href="docprocessing.html#top">5. DOCUMENT PROCESSING WITH MOM</a></h3>
<ul class="toc">
<li><a href="docprocessing.html#docprocessing-intro">5.1 Introduction to document processing</a></li>
<li><a id="doc-defaults" href="docprocessing.html#defaults">5.2 Document defaults</a> &ndash; papersize, margins, etc.
<ul>
<li><a id="vert-ws" href="docprocessing.html#vertical-whitespace-management">5.2.1 Vertical whitespace management</a>
<ul>
<li><a href="docprocessing.html#shim">5.2.1.1 SHIM</a></li>
<li><a href="docprocessing.html#flex">5.2.1.2 FLEX</a></li>
</ul></li>
</ul></li>
<li><a id="prelim" href="docprocessing.html#setup" class="highlight">5.3 PRELIMINARY DOCUMENT SETUP</a>
<ul>
<li><a href="docprocessing.html#docprocessing-tut">5.3.1 Tutorial</a> &ndash; setting up a mom document</li>
<li><a href="docprocessing.html#reference-macros">5.3.2 The reference macros</a> &ndash; metadata mom needs to do her job
<ul>
<li><a href="docprocessing.html#title">5.3.2.1 TITLE</a></li>
<li><a href="docprocessing.html#doc-title">5.3.2.2 DOCTITLE</a></li>
<li><a href="docprocessing.html#subtitle">5.3.2.3 SUBTITLE</a></li>
<li><a href="docprocessing.html#author">5.3.2.4 AUTHOR</a></li>
<li><a href="docprocessing.html#chapter">5.3.2.5 CHAPTER</a></li>
<li><a href="docprocessing.html#chapter-title">5.3.2.6 CHAPTER_TITLE</a></li>
<li><a href="docprocessing.html#draft">5.3.2.7 DRAFT</a></li>
<li><a href="docprocessing.html#revision">5.3.2.8 REVISION</a></li>
<li><a href="docprocessing.html#copyright">5.3.2.9 COPYRIGHT</a></li>
<li><a href="docprocessing.html#misc">5.3.2.10 MISC</a></li>
<li><a href="docprocessing.html#covertitle">5.3.2.11 COVERTITLE</a></li>
<li><a href="docprocessing.html#covertitle">5.3.2.12 DOC_COVERTITLE</a></li>
<li><a href="docprocessing.html#pdftitle">5.3.2.13 PDF_TITLE</a></li>
<li><a href="docprocessing.html#toc-heading">5.3.2.14 TOC_HEADING</a></li>
</ul></li>
<li><a href="docprocessing.html#docstyle-macros">5.3.3 The docstyle macros</a> &ndash; base templates; what kind of document you&#8217;re creating, how you want it to look overall
<ul>
<li><a href="docprocessing.html#doctype">5.3.3.1 DOCTYPE</a> &ndash; the kind of document (default, chapter, named, letter)
<ul style="list-style-type: circle">
<li><a href="docprocessing.html#slides">DOCTYPE SLIDES</a></li>
</ul></li>
<li><a href="docprocessing.html#printstyle">5.3.3.2 PRINTSTYLE</a> &ndash; typeset or &#8220;typewritten, double-spaced&#8221;</li>
<li><a href="docprocessing.html#copystyle">5.3.3.3 COPYSTYLE</a> &ndash; draft or final</li>
</ul></li>
<li><a href="docprocessing.html#start-macro">5.3.4 Initiate document processing</a>
<ul>
<li><a href="docprocessing.html#start">5.3.4.1 START</a> &ndash; the required macro to initiate document processing</li>
</ul></li>
<li><a href="docprocessing.html#docheader">5.3.5 Managing the DOCHEADER</a> &ndash; title, author, etc. on first page
<ul>
<li><a href="docprocessing.html#docheader-control">5.3.5.1 DOCHEADER control</a></li>
</ul></li>
<li><a href="docprocessing.html#columns-intro">5.3.6 Setting documents in columns</a></li>
<li><a href="docprocessing.html#style-before-start">5.3.7 Establishing type and formatting parameters <span style="font-style: italic">before</span> START</a>
<ul>
<li><a href="docprocessing.html#type-before-start">5.3.7.1 Use of the typesetting macros before START</a>
<ul class="fourth-level">
<li>&ndash; <a href="docprocessing.html#include">5.3.7.1.1 Including (sourcing) style sheets and files</a></li>
<li>&ndash; <a href="docprocessing.html#color">5.3.7.1.2 Initializing colours</a></li>
</ul></li>
<li><a href="docprocessing.html#doc-lead-adjust">5.3.7.2 DOC_LEAD_ADJUST</a> &ndash; adjust document
<a href="definitions.html#leading">leading</a>
to fill pages</li>
</ul></li>
<li><a href="docprocessing.html#style-after-start">5.3.8 Changing basic type and formatting parameters <span style="font-style: italic">after</span> START</a></li>
<li><ul>
<li><a id="typemacdoc" href="docprocessing.html#behaviour">5.3.8.1 Behaviour of the typesetting macros during document processing</a></li>
<li><a href="docprocessing.html#intro-doc-param">5.3.8.2 Post-START global style-change macros</a></li>
</ul></li>
</ul></li>
<li><a id="tags" class="highlight" href="docelement.html#top">5.4 THE DOCUMENT ELEMENT TAGS</a>
<ul>
<li><a href="docelement.html#docelement-intro">5.4.1 Introduction to the document element tags</a>
<ul>
<li><a href="docelement.html#docelement-control">5.4.1.1 Control macros</a> &ndash; changing style defaults for document element tags</li>
<li><a href="docelement.html#control-macro-args">5.4.1.2 Arguments to the control macros</a></li>
</ul></li>
<li><a href="docelement.html#epigraph-intro">5.4.2 Epigraphs</a></li>
<li><a href="docelement.html#pp-intro">5.4.3 Paragraphs</a></li>
<li><a href="docelement.html#heading-intro">5.4.4 Headings</a></li>
<li><a href="docelement.html#linebreak-intro">5.4.5 Linebreaks</a> &ndash; author linebreaks (section breaks)</li>
<li><a href="docelement.html#quote-intro">5.4.6 Quotes</a> &ndash; line for line poetic quotes or unformatted, verbatim text (e.g. blocks of code)</li>
<li><a href="docelement.html#blockquote-intro">5.4.7 Blockquotes</a> &ndash; cited material</li>
<li><a href="docelement.html#code">5.4.8 Code</a> &ndash; inserting code snippets</li>
<li><a href="docelement.html#list-intro">5.4.9 Lists</a> &ndash; nested lists</li>
<li><a href="docelement.html#number-lines-intro">5.4.10 Line numbering</a></li>
<li><a href="docelement.html#footnote-intro">5.4.11 Footnotes</a></li>
<li><a href="docelement.html#endnote-intro">5.4.12 Endnotes</a></li>
<li><a href="docelement.html#margin-notes-intro">5.4.13 Margin notes</a></li>
<li><a href="docelement.html#finis-intro">5.4.14 Document termination string</a> &ndash; FINIS</li>
</ul></li>
<li><a id="images" class="highlight" href="images.html#top">5.5 GRAPHICS, FLOATS, AND PREPROCESSOR SUPPORT</a>
<ul>
<li><a href="images.html#images-intro">5.5.1 Inserting images and graphics</a></li>
<li><a href="images.html#converting">5.5.2 Image conversion and file processing</a></li>
<li><a href="images.html#pdf-image">5.5.3 PDF_IMAGE</a>
<ul>
<li><a href="images.html#pdf-image-frame">5.5.3.1 PDF_IMAGE_FRAME</a></li>
</ul></li>
<li><a href="images.html#pspic">5.5.4 PSPIC</a></li>
<li><a href="images.html#floats-intro">5.5.5 Floats</a>
<ul>
<li><a href="images.html#float">5.5.5.1 FLOAT</a></li>
</ul></li>
<li><a href="images.html#preprocessor-support">5.5.6 Preprocessor support</a>
<ul>
<li><a href="images.html#tbl">5.5.6.1 tbl support</a></li>
<li><a href="images.html#eqn">5.5.6.2 eqn support</a></li>
<li><a href="images.html#pic">5.5.6.3 pic support</a></li>
<ul style="list-style-type: disc">
<li><a href="images.html#pic-text-style">5.5.6.3.1 PIC_TEXT_STYLE</a></li>
</ul></li>
<li><a href="images.html#grap">5.5.6.4 grap support</a>
<li><a href="images.html#refer">5.5.6.4 refer support</a></li>
</ul></li>
<li><a href="images.html#captions-and-labels">5.5.7 Captions and labels</a>
<ul>
<li><a href="images.html#autolabel">5.5.7.1 AUTOLABEL</a></li>
<li><a href="images.html#caption-after-label">5.5.7.2 CAPTION_AFTER_LABEL</a></li>
<li><a href="images.html#captions-labels-sources">5.5.7.3 CAPTIONS / LABELS / SOURCES&mdash;set style parameters</a></li>
<li><a href="images.html#mla">5.5.7.4 MLA</a></li>
</ul></li>
<li><a href="images.html#lists-of">5.5.8 Lists of Figures, Tables, and Equations</a>
<ul>
<li><a href="images.html#lists-placement">5.5.8.1 Placement of Lists</a></li>
<li><a href="images.html#lists-macros">5.5.8.2 Macros to generate Lists</a></li>
<li><a href="images.html#formatting-lists">5.5.8.3 Formatting and style parameters for Lists</a>
<ul>
<li><a href="#lists-style">5.5.8.3.1 LISTS_STYLE</a></li>
</ul></li>
</ul></li>
</ul></li>
<li><a id="box" class="highlight" href="headfootpage.html#top">5.6 SHADED BACKGROUNDS AND FRAMES</a>
<ul>
<li><a href="images.html#box-intro">5.6.1 Introduction</a></li>
<li><a href="images.html#box-macro">5.6.2 The BOX macro</a></li>
<li><a href="images.html#box-notes">5.6.3 Additional notes on BOX usage and behaviour</a></li>
<li><a href="images.html#page-color">5.6.4 PAGE_COLOR</a></li>
</ul>
</li>
<li><a id="hdrftr" class="highlight" href="headfootpage.html#top">5.7 PAGE HEADERS AND FOOTERS</a>
<ul>
<li><a href="headfootpage.html#headfootpage-intro">5.7.1 Introduction</a></li>
<li><a href="headfootpage.html#description-general">5.7.2 General description of headers/footers</a></li>
<li><a href="headfootpage.html#header-style">5.7.3 Default specs for headers/footers</a></li>
<li><a href="headfootpage.html#vertical-spacing">5.7.4 Vertical placement and spacing of headers/footers</a></li>
<li><a href="headfootpage.html#headfoot-management">5.7.5 Managing page headers and footers</a></li>
<li><a href="headfootpage.html#headfoot-control">5.7.6 Control macros for headers/footers</a></li>
<li><a href="headfootpage.html#userdef-hdrftr-rv">5.7.7 User-defined, single string recto/verso headers/footers</a>
<ul>
<li><a href="headfootpage.html#userdef-hdrftr">5.7.7.1 User-defined, single string headers/footers (no recto/verso)</a></li>
</ul></li>
<li><a href="headfootpage.html#headers-and-footers-intro">5.7.8 Headers and footers on the same page</a></li>
</ul></li>
<li><a id="paginate" class="highlight" href="headfootpage.html#pagination-intro">5.8 PAGINATION</a>
<ul>
<li><a href="headfootpage.html#pagination">5.8.1 Introduction</a></li>
<li><a href="headfootpage.html#index-pagination">5.8.2 Pagination macros list</a></li>
<li><a href="headfootpage.html#blank-pages">5.8.3 Blank pages</a></li>
</ul></li>
<li><a id="rv" class="highlight" href="rectoverso.html#top">5.9 RECTO/VERSO PRINTING, COLLATING</a>
<ul>
<li><a href="rectoverso.html#rectoverso-intro">5.9.1 Introduction to recto/verso printing</a>
<ul>
<li><a href="rectoverso.html#rectoverso-list">5.9.1.1 Macro list</a></li>
</ul></li>
<li><a href="rectoverso.html#collate-intro">5.9.2 Introduction to collating</a>
<ul>
<li><a href="rectoverso.html#collate">5.9.2.1 The COLLATE macro</a></li>
</ul></li>
</ul></li>
<li><a id="cover" class="highlight" href="cover.html#top">5.10 COVER PAGES</a></li>
<li><a id="tocs" class="highlight" href="tables-of-contents.html#top">5.11 TABLES OF CONTENTS</a>
<ul>
<li><a href="tables-of-contents.html#toc-intro">5.11.1 Introduction</a> &ndash; the TOC macro</li>
<li><a href="tables-of-contents.html#toc-appearance">5.11.2 Table of contents appearance and behaviour</a></li>
<li><a href="tables-of-contents.html#pdf-output">5.11.3 PDF output</a></li>
<li><a href="tables-of-contents.html#positioning">5.11.4 Positioning the table of contents</a>
<ul>
<li><a href="tables-of-contents.html#auto-relocate-toc">5.11.2 Automatic PDF relocation of the Table of Contents</a></li>
<li><a href="tables-of-contents.html#psselect">5.11.2 Using psselect to relocate the TOC in PostScript documents</a></li>
</ul></li>
<li><a href="tables-of-contents.html#index-toc-control">5.11.5 Table of contents control macros</a></li>
</ul></li>
<li><a id="ref" class="highlight" href="refer.html#top">5.12 BIBLIOGRAPHIES AND REFERENCES</a></li>
<li><a id="letter" class="highlight" href="letters.html#top">5.13 WRITING LETTERS</a>
<ul>
<li><a href="letters.html#letters-intro">5.13.1 Introduction to writing letters</a></li>
<li><a href="letters.html#letters-tutorial">5.13.2 Tutorial on writing letters</a></li>
<li><a href="letters.html#letters-defaults">5.13.3 Default letter style</a></li>
<li><a href="letters.html#index-letters-macros">5.13.4 The letter macros</a></li>
</ul></li>
</ul>
<h3 id="quick" class="toc highlight"><a style="color: #6e70cc" href="macrolist.html#top">6. QUICK REFERENCE GUIDE</a></h3>
<h3 id="appendices" class="toc" style="margin-top: .5em;"><a style="color: #6e70cc" href="appendices.html#top">7. APPENDICES</a></h3>
<ul class="toc">
<li><a href="appendices.html#fonts">7.1 Adding fonts to groff</a>
<ul>
<li><a href="appendices.html#steps">7.1.1 Step-by-step instructions</a></li>
</ul></li>
<li><a href="appendices.html#codenotes">7.2 Some reflections on mom</a></li>
<li><a href="reserved.html">7.3 List of reserved words (macros, registers, strings)</a></li>
<li><a href="appendices.html#contact">7.4 Contact the author</a></li>
</ul>
</div>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,319 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Using mom</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="typesetting.html#top">Next: The typesetting macros</a></td>
</tr>
</table>
<h1 id="using" class="docs">Using mom</h1>
<div style="text-align: left; margin-left: 33%">
<ul class="no-enumerator" style="margin-left: -2.5em;">
<li><a href="#using-intro">Introduction</a></li>
<li><a href="#using-macros">How to input mom&#8217;s macros</a></li>
<li><a href="#viewing">Processing and viewing documents</a>
<ul>
<li class="item"><a href="#pdf">Mom and PDF</a></li>
<li class="item"><a href="#pdfmom">pdfmom</a></li>
</ul></li>
<li><a href="#previewing">Automatic previewing of documents</a></li>
</ul>
</div>
<div class="rule-short" style="margin-top: 18px;"><hr/></div>
<h2 id="using-intro" class="docs">Introduction</h2>
<p>
As explained in the section
<a href="intro.html#top">What is mom?</a>,
mom can be used in two ways: for straightforward typesetting or for
document processing. The difference between the two is that in
straightforward typesetting, every macro is a literal instruction
that determines precisely how text following it will look. Document
processing, on the other hand, uses markup tags (e.g. <kbd>.PP</kbd>
for paragraphs, <kbd>.HEADING</kbd> for different levels of heads,
<kbd>.FOOTNOTE</kbd> for footnotes, etc.) that perform typesetting
operations automatically.
</p>
<p>
You tell mom that you want to use the document processing macros
with the
<a href="docprocessing.html#start">START</a>
macro. After START, mom determines the appearance of
text following the markup tags automatically, although you, the
user, can easily change how the tags are interpreted.
</p>
<h2 id="using-macros" class="docs">How to input mom&#8217;s macros</h2>
<p>
Regardless of whether you&#8217;re preparing a term paper or making a
flyer for your lost dog, the following apply.
</p>
<ol style="margin-top: -.5em; margin-bottom: -.5em;">
<li>
You need a good text editor for inputting mom files.
<br/>
<span style="display: block; margin-top: .25em; margin-bottom: .5em;">
I cannot recommend highly enough that you use an editor that
lets you write syntax highlighting rules for mom&#8217;s
macros and
<a href="definitions.html#inlines">inline escapes</a>.
Simply colourizing macros and inlines to half-intensity can be
enough to make text stand out clearly from formatting commands.
Mom herself comes with a complete set of syntax highlighting
rules for the vim editor. A number of freely available editors
come with groff syntax highlighting rules, which are sufficient
for mom files, though not as colourful or complete as the vim
rules that ship with mom.
</span>
</li>
<li>
Macros begin with a period (dot) at the left margin of your text
editor&#8217;s screen, and must be entered in upper case (capital)
letters.
</li>
<li>
Macro
<a href="definitions.html#arguments">arguments</a>
are separated from the macro itself by spaces. Multiple
arguments to the same macro are separated from each
other by spaces. Any number of spaces may be used.
</li>
<li>
Arguments to a macro must appear on the same line as the
macro.
<br/>
<span style="display: block; margin-top: .25em; margin-bottom: .5em;">
If the argument list is very long, you may use the
backslash character (<kbd>\</kbd>) to break the line visually.
From groff&#8217;s point of view, the backslash and newline are
invisible. Thus, for example,
<span class="pre" style="margin-bottom: -2.25em">
.HEADING_STYLE 1 FAMILY Garamond FONT B SIZE +2
</span>
and
<span class="pre" style="margin-bottom: -2.25em">
.HEADING_STYLE 1 \
FAMILY Garamond \
FONT B \
SIZE +2
</span>
</span>
are exactly equivalent.
</li>
<li>
Any argument (except a
<a href="definitions.html#stringargument">string argument</a>)
that is not a digit must be entered in upper case
(capital) letters.
</li>
<li>
Any argument that requires a plus or minus sign must
have the plus or minus sign prepended to the argument
with no intervening space (e.g. <kbd>+2</kbd>).
</li>
<li>
Any argument that requires a
<a href="definitions.html#unitofmeasure">unit of measure</a>
must have the unit appended directly to the argument, with no
intervening space (e.g. <kbd>.5i</kbd>).
</li>
<li>
<a href="definitions.html#stringargument">String arguments</a>,
in the sense of this manual, must be surrounded by double-quotes
(e.g. <kbd>"text"</kbd>). Multiple
string arguments are separated from each other by spaces (with
each argument surrounded by double-quotes).
<br/>
<span style="display: block; margin-top: .25em; margin-bottom: .5em;">
If a string argument becomes
uncomfortably long, you may break it into two or more lines
with the backslash character.
<span class="pre">
.SUBTITLE "An In-Depth Consideration of the \
Implications of Forty-Two as the Answer to Life, \
The Universe, and Everything"
</span>
</span>
</li>
</ol>
<div class="box-tip">
<p class="tip">
<span class="tip">Tip:</span>
It&#8217;s important that your documents be easy to read and
understand in a text editor. One way to achieve this is to group
macros that serve a similar purpose together, and separate them from
other groups of macros with a comment line. In groff, that&#8217;s
done with <kbd>\#</kbd> (backslash-pound) or <kbd>.\"</kbd>
(period-backslash-doublequote) on a line by itself. Either
instructs groff to ignore the remainder of the line, which may or
may not contain text. Consider the following, which is a template
for starting the chapter of a book.
<br/>
<span class="pre-in-pp">
\# Reference/meta-data
.TITLE "My Pulitzer Novel"
.AUTHOR "Joe Blow"
.CHAPTER 1
\# Template
.DOCTYPE CHAPTER
.PRINTSTYLE TYPESET
\# Type style
.FAM P
.PT_SIZE 10
.LS 12
\#
.START
</span>
You may also, if you wish, add a comment to the end of a line with
<kbd>\"</kbd> (no period), like this:
<br/>
<span class="pre-in-pp">
.FAMILY P \" Maybe Garamond instead?
</span>
</p>
</div>
<h2 id="viewing" class="docs">Processing and viewing documents</h2>
<p>
The most basic command-line usage for processing a file formatted
with the mom macros is
<br/>
<span class="pre-in-pp">
groff -mom filename.mom &gt; filename.ps
</span>
which processes the .mom file and dumps the output into a
viewable/printable PostScript file.
</p>
<h3 id="pdf" class="docs">Mom and PDF</h3>
<p>
Adobe&#8217;s Portable Document Format (PDF) has largely supplanted
PostScript, of which it is a subset, as the standard for typeset
documents. While printed versions of documents in either format
will be identical, PDF documents, when viewed at the screen, may
also contain clickable links and a number of other special features.
</p>
<p>
As of version 2.0, mom supports full PDF integration. The creation
and processing of mom files into PostScript documents remains
unchanged from 1.x, but the expected and recommended format of final
documents is now PDF.
</p>
<p>
The manual,
<a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf"><span class="book-title">Producing PDFs with groff and mom</span></a>,
explains and demonstrates the PDF-specific macros that are available
in mom, as well as the use of <strong>pdfmom</strong>, the
recommended way to process mom files.
</p>
<h4 id="pdfmom" class="docs">pdfmom</h4>
<p>
Groff provides more than one way to generate PDF documents,
but when processing files formatted with the mom macros,
<strong>pdfmom</strong> is the recommended and most robust way to do
it:
<br/>
<span class="pre-in-pp">
pdfmom filename.mom &gt; filename.pdf
</span>
<strong>pdfmom</strong> is a wrapper around groff, and accepts all
groff&#8217;s command-line options as listed in the groff manpage.
Full usage is explained in the manual,
<a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf"><span class="book-title">Producing PDFs with groff and mom</span></a>.
</p>
<p>
PDF links in a document, including linked entries in the
Table of Contents, are identified by colour. When printing
documents with links, you will most likely not want the link
text coloured. The groff option, <kbd>-c</kbd>, disables colour
throughout a document; thus, when preparing a document for printing,
you should use:
<br/>
<span class="pre-in-pp">
pdfmom -c filename.mom &gt; filename.pdf
</span>
<strong>pdfmom</strong> tends to produce large files. You may
reduce their size by piping them through ps2pdf:
<br/>
<span class="pre-in-pp">
pdfmom -c filename.mom | ps2pdf - filename.pdf
</span>
Be aware, though, that files piped through ps2pdf will lose some pdf
metadata, notably the document window title set with PDF_TITLE.
</p>
<h2 id="previewing" class="docs">Automatic previewing of documents</h2>
<p>
Most PDF viewers have a &#8220;Watch File&#8221; option, which
automatically updates a displayed document whenever there&#8217;s
a change. This is useful when preparing documents that require
judgment calls. I recommend creating a keymapping in your
text editor that both saves the mom file and processes it with
<strong>pdfmom</strong>. The displayed PDF then automatically
reflects whatever changes you save to the mom file.
</p>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 33%; text-align: right;"><a href="typesetting.html#top">Next: The typesetting macros</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,434 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the Free Documentation License is included as a file called
FDL in the main directory of the groff source package.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>Mom -- Version 2.0 notes</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body style="background-color: #f5faff;">
<!-- ==================================================================== -->
<div id="top" class="page">
<!-- Navigation links -->
<table style="width: 100%;">
<tr>
<td><a href="toc.html">Back to Table of Contents</a></td>
<td style="text-align: right;"><a href="intro.html#top">Next: Introduction to mom</a></td>
</tr>
</table>
<h1 class="docs">Version 2.0 notes</h1>
<div style="width: 70%; margin: auto;">
<ol style="margin-left: -1em;">
<li><a href="#prefatory">Prefatory comments</a></li>
<li><a href="#differences">Differences between 2.0 and 1.x</a>
<ul class="no-enumerator" style="padding-left: 0">
<li><a href="#pdf-support">2.1 PDF support</a>
<ul class="no-enumerator" style="padding-left: 1em">
<li><a href="#mom-pdf">2.1.1 The manual, <span class="book-title">Producing PDFs with groff and mom</span></a></li>
<li><a href="#pdf-image">2.1.2 PDF_IMAGE</a></li>
</ul></li>
<li><a href="#covers">2.2 Covers</a></li>
<li><a href="#headings">2.3 Headings</a></li>
<li><a href="#margin-notes">2.4 Margin notes</a></li>
<li><a href="#floats">2.5 Floats</a></li>
<li><a href="#table-of-contents">2.5 Tables of contents</a></li>
</ul></li>
<li><a href="#v2.1-changes">Version 2.1 changes</a></li>
<li><a href="#v2.2-changes">Version 2.2 changes</a></li>
<li><a href="#v2.5-changes">Version 2.5 changes</a></li>
<li><a href="#pdfmom">The <strong>pdfmom</strong> wrapper around groff</a></li>
<li><a href="#install-font">The <strong>install-font.sh</strong> script</a></li>
</ol>
</div>
<div class="rule-medium"><hr/></div>
<h2 id="prefatory" class="docs">1. Prefatory comments</h2>
<p>
Version 2.0 comes about as a result of Deri James&#8217;
contribution of <strong>gropdf</strong> to <strong>groff</strong>,
and his subsequent work integrating the device with
<strong>mom</strong>.
</p>
<p>
Whereas the 1.x releases were oriented toward PostScript output,
2.0 focuses on PDF output, a bias reflected throughout this
documentation. Users are strongly encouraged to process their files
with
<a href="#pdfmom"><strong>pdfmom</strong></a>,
a wrapper around <strong>groff&nbsp;-Tpdf</strong>, in order to take
full advantage of all PDF has to offer.
</p>
<p>
While portions of mom have been rewritten, and new features
introduced, 2.0 is backwardly compatible with 1.x releases. Changes
are either transparent, or accompanied by notifications on stderr.
</p>
<p>
The implementation of nested heads has been completely rethought,
as has the manner of styling of them. There are no limits on
how deep the nesting can go. The 1.x macros <kbd>HEAD</kbd>,
<kbd>SUBHEAD</kbd>, and <kbd>SUBSUBHEAD</kbd> may still be used, but
must be re-designed with the new <kbd>HEADING_STYLE</kbd> macro
if their 1.x defaults are not desired.
</p>
<p>
In conjunction with the changes to nested heads, Table of Contents
generation has also been rethought. Greater flexibility in the
inclusion of toc entry numbering been added. Like nested heads,
there&#8217;s a new macro <kbd>TOC_ENTRY_STYLE</kbd> that permits
styling of each level in the toc hierarchy separately. The default
overall layout has also been significantly improved, achieving a
level of typographical elegance formerly lacking. Best of all, the
Table of Contents can now be repositioned to the correct spot at the
top of a document from within the mom source file.
</p>
<p>
When mom files are processed with <strong>pdfmom</strong>, a PDF
outline for the Contents panel of PDF viewers is automatically
generated. In addition, entries in the Table of Contents
are clickable links when a document is viewed at the screen.
<strong>pdfmom</strong> also permits setting a document&#8217;s
papersize within the source file without the corresponding need for
<kbd>-P-p&lt;papersize&gt;</kbd> on the command line.
</p>
<h3 id="install-font" class="docs">The install-font.sh script</h3>
<p>
Lastly, while not strictly part of mom, a bash script,
<strong>install-font.sh</strong>, has been posted at the
<a href="https://www.schaffter.ca/mom/">mom site</a>.
The script significantly eases the installation of new
groff families and fonts, with conversion to .pfa
and .t42 being performed by <strong>fontforge</strong>.
</p>
<h2 id="differences" class="docs">2. Differences between v2.0 and v1.x</h2>
<h3 id="pdf-support" class="docs">2.1. PDF support</h3>
<p>
PDF support has been added, with features including the automatic
generation of PDF outlines, embedding of images in PDF format (via
the
<a href="images.html#pdf-image">PDF_IMAGE</a>
macro) and PDF linking (internal and external).
</p>
<h4 id="mom-pdf" class="docs">2.1.1. Producing PDFs with groff and mom</h4>
<p>
A manual in PDF format,
<span class="book-title">Producing PDFs with groff and mom</span>,
has been added to the documentation. The file,
<strong>mom-pdf.pdf</strong> can be found in
<br/>
<span class="pre-in-pp">
/usr/local/share/doc/groff-&lt;version&gt;/pdf/
</span>
or
<br/>
<span class="pre-in-pp">
/usr/share/doc/groff-base/pdf/
</span>
or at
<br/>
<span class="pre-in-pp">
<a href="http://www.schaffter.ca/mom/momdoc/mom-pdf.pdf">http://www.schaffter.ca/mom/momdoc/mom-pdf.pdf</a>
</span>
PDF usage, and all associated macros except
<a href="#pdf-image">PDF_IMAGE</a>,
are fully explained in the manual, which should be considered an
integral part of the present documentation. In addition, the mom
source file for the manual can be found in
<br/>
<span class="pre-in-pp">
/usr/local/share/doc/groff-&lt;version&gt;/examples/mom
</span>
or
<br/>
<span class="pre-in-pp">
/usr/share/doc/groff-base/examples/mom/
</span>
and provides an excellent demonstration of mom usage.
</p>
<h4 id="pdf-image" class="docs">2.1.2. PDF_IMAGE</h4>
<p>
A new macro for embedding PDF images has been added,
<a href="images.html#pdf-image">PDF_IMAGE</a>.
</p>
<p>
PDF_IMAGE functions similarly to PSPIC and accepts the same
arguments. Differences in implementation are that PDF_IMAGE
requires the image dimensions (the bounding box) to be supplied.
Instructions for getting the bounding box are included in the
documentation entry for PDF_IMAGE. Two additional options,
<kbd>SCALE</kbd> and <kbd>ADJUST</kbd>, allow scaling of the image
and optical centering.
</p>
<h3 id="covers" class="docs">2.2. Covers</h3>
<p>
Arguments to
<a href="cover.html#cover">COVER</a>
and
<a href="cover.html#doc-cover">DOC_COVER</a>
may now be given in any order.
</p>
<h3 id="headings" class="docs">2.3. Headings</h3>
<p>
The 1.x macros HEAD, SUBHEAD, SUBSUBHEAD, are now deprecated and
have been replaced by the single macro
<a href="docelement.html#heading">HEADING <kbd>&lt;n&gt;</kbd></a>,
where <kbd>&lt;n&gt;</kbd> is the heading level. The deprecated
macros may still be used, and conform in style to their original
defaults; they are, however, wrappers around HEADING levels 1
&#8211; 3. Both the wrappers and HEADING itself can take a
<kbd>NAMED&nbsp;&lt;id&gt;</kbd> argument, specifying a PDF link
destination.
</p>
<p>
Styling of headings is managed by the single macro <a
href="docelement.html#heading">HEADING_STYLE &lt;n&gt;</a> where
<kbd>&lt;n&gt;</kbd> conforms to a heading level. The control
macros for HEAD, SUBHEAD and SUBSUBHEAD have been removed. Users
wishing to style the wrappers must use HEADING_STYLE.
</p>
<p>
PARAHEAD is no longer valid. Paragraph heads in 2.0 are created
by passing the <kbd>PARAHEAD</kbd> argument to HEADING. Mom
will abort with an informational message whenever she encounters
<kbd>.PARAHEAD</kbd>.
</p>
<h3 id="margin-notes" class="docs">2.4. Margin notes</h3>
<p>
The macro for setting margin note parameters,
<a href="docelement.html#mn-init">MN_INIT</a>,
has been re-written such that each parameter now has the form
<kbd>&lt;PARAMETER&gt; &lt;value&gt;</kbd>. This differs
from 1.x where parameters were entered without a preceding
<kbd>&lt;PARAMETER&gt;</kbd> flag. Parameters may be entered in any
order. Any that are skipped are set to default values. Documents
created with 1.x will have to have their <kbd>MN_INIT</kbd> updated
accordingly.
</p>
<h3 id="floats" class="docs">2.5. Floats</h3>
<p>
A
<a href="images.html#floats-intro">FLOAT</a>
macro has been added, which functions similarly to the <kbd>ms</kbd>
macros&#8217; <kbd>.KF/.KE</kbd>, i.e., the contents of the float are
output immediately if there&#8217;s room on the page, otherwise
normal text processing continues and the contents are output at the
top of the next page. An <kbd>ADJUST</kbd> argument to FLOAT allows
for optical centering.
</p>
<h3 id="table-of-contents" class="docs">2.6. Tables of contents</h3>
<p>
The default look of the Table of Contents has been overhauled to
produce a more typographically pleasing result. All control macros
for TOC title and entry styles have been removed, replaced by
<a href="tables-of-contents.html#toc-title-style">TOC_TITLE_STYLE</a>
and
<a href="tables-of-contents.html#toc-title-style">TOC_ENTRY_STYLE <kbd>&lt;n&gt;</kbd></a>
where <kbd>&lt;n&gt;</kbd> corresponds to a heading level. Both
macros permit setting any or all of the style parameters for TOC
titles (i.e. chapters or major sections/divisions of a collated
document) and TOC entries (nested heading levels) at once.
Documents created with 1.x that contain TOCs will need to have their
TOC style updated if the new defaults are unsatisfactory.
</p>
<p>
Two new TOC control macros have been added,
<a href="tables-of-contents.html#space-toc-items">SPACE_TOC_ITEMS</a>
and
<a href="tables-of-contents.html#auto-relocate-toc">AUTO_RELOCATE_TOC</a>.
SPACE_TOC_ITEMS groups TOC entry levels and separates them with a
discrete amount of whitespace. This leads to improved legibility,
and is highly recommended even though it is not mom&#8217;s
default. AUTO_RELOCATE_TOC intelligently repositions the Table
of Contents to the top of a document when the mom source file is
processed with
<a href="pdfmom">pdfmom</a>.
</p>
<h2 id="v2.1-changes" class="docs">3. Version 2.1 changes</h2>
<p> Version 2.1 adds these features: </p> <ul style="margin-top: -.5em; width: 90%">
<li>expansion of cover, docheader, page header, and heading
control macros to permit caps, smallcaps, color, and
underscoring</li>
<li>the ability to style every element appearing in docheaders and
automatically-generated cover/title pages separately</li>
<li>macros to place images on cover/title pages</li>
<li>a new macro COVERTEXT that allows adding text (e.g. an
Abstract) to automatically-generated cover/title pages or to
create cover/title pages entirely by hand</li>
<li>separate indent control macros for QUOTES and BLOCKQUOTES</li>
<li>pseudo-smallcaps, including a control macro to choose the
size, weight, and width of the small caps</li>
<li>new &lt;element&gt;_STYLE macros that allow setting
parameters for &lt;element&gt; with a single macro using
keyword/value pairs</li>
</ul>
<p>
The following changes have been made:
</p>
<ul style="margin-top: -.5em; width: 90%">
<li>MISC_AUTOLEAD (including COVER_MISC_AUTOLEAD and
DOC_COVER_MISC_AUTOLEAD) has been replaced in favour of MISC_LEAD,
which takes an absolute leading value rather than one derived
from the point size.</li>
<li>COVER_UNDERLINE and DOC_COVER_UNDERLINE have been
removed in favour of COVER_DOCTYPE_UNDERLINE and
DOC_COVER_DOCTYPE_UNDERLINE.</li>
<li>DOCTYPE NAMED <kbd>&lt;string&gt;</kbd> no longer accepts a
<kbd>color</kbd> argument; setting the colour for
<kbd>&lt;string&gt;</kbd> is accomplished with DOCTYPE_COLOR
<kbd>&lt;color&gt;</kbd>. In addition, the string now has a
complete set of control macros.</li>
<li>Default underscoring of the DOCTYPE NAMED string has been
removed, both in the docheader and on cover/title pages.</li>
<li>No cover/title page data persists, however formatting for the
elements on them does.</li>
</ul>
<h2 id="v2.2-changes" class="docs">4. Version 2.2 changes</h2>
<p>
Version 2.2 adds these features:
</p>
<ul style="margin-top: -.5em; width: 90%">
<li>flex-spacing, an alternative to mom&#8217;s default shimming
policy; flex-spacing balances vertical whitespace on the page by
distributing any excess equally at sensible points so that running
text always fills the page to the bottom margin (see
<a href="docprocessing.html#vertical-whitespace-management">
vertical whitespace management</a>)
</li>
<li>improvements to auto-labelling, such that it is now possible
to link symbolically to auto-labelled preprocessor material and
PDF images (note that you must be running groff 1.22.4 or higher
for this feature)
</li>
</ul>
<h2 id="v2.5-changes" class="docs">5. Version 2.5 changes</h2>
<p>
Version 2.5 adds shaded backgrounds and frames that span pages
appropriately when necessary, and a macro to set page or slide
background colour.
</p>
<h2 id="v2.6-changes" class="docs">6. Version 2.6 changes</h2>
<p>
Version 2.6 improves Table of Contents handling so that entries may
span multiple lines. PDF outline page numbers now map correctly to
printed page numbers.
</p>
<h2 id="pdfmom" class="docs">6. pdfmom</h2>
<p>
Deri James has provided <strong>pdfmom</strong>, a wrapper around
groff that processes mom source files with all the PDF bells and
whistles. Its use is highly recommended. Usage is explained in the
manual,
<a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf">
<span class="book-title">Producing PDFs with groff and mom</span>
</a>.
A significant convenience of pdfmom is that it can, with the
<kbd>-Tps</kbd> flag, be used to pass processing over to Keith
Marshall&#8217;s <strong>pdfroff</strong>. This is useful when
processing files that contain PostScript images embedded with
<a href="images.html#pspic">PSPIC</a>.
pdfmom, without the flag, uses groff&#8217;s PDF device
(<strong>gropdf</strong>), which only recognizes PDF images that
have been embedded with
<a href="images.html#pdf-image">PDF_IMAGE</a>.
</p>
<h2 id="install-font" class="docs">7. install-font.sh</h2>
<p>
A bash script, <strong>install-font.sh</strong>, has been posted at the
<a href="http://www.schaffter.ca/mom/mom-01.html">mom site</a>.
There&#8217;s nothing mom-specific about the script, and it is not
an official part of groff.
</p>
<p>
Installing groff fonts is a multi-step procedure, which, while not
difficult, can be a nuisance. install-font.sh takes
care of all the details, including converting fonts to formats
acceptable to <strong>grops</strong> and <strong>gropdf</strong>,
creating and installing the groff fonts in the appropriate
directories, updating the download files, and installing the
original fonts in a system-wide directory, if desired.
</p>
<div class="rule-long"><hr/></div>
<!-- Navigation links -->
<table style="width: 100%; margin-top: 12px;">
<tr>
<td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
<td style="width: 20%; text-align: center;"><a href="#top">Top</a></td>
<td style="width: 46%; text-align: right;"><a href="intro.html">Next: Introduction to mom</a></td>
</tr>
</table>
</div>
<div class="bottom-spacer"><br/></div>
</body>
</html>

View file

@ -0,0 +1,90 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-1.html</title>
</head>
<hr>
[ <a href="pic-2.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>1. Introduction to PIC
<a name="1. Introduction to PIC"></a>
</h2>
<h3>1.1. Why PIC?
<a name="1.1. Why PIC?"></a>
</h3>
<p style="margin-top: 1em">The <b>pic</b> language provides
an easy way to write procedural box-and-arrow diagrams to be
included in <b>troff</b> documents. The language is
sufficiently flexible to be quite useful for state charts,
Petri-net diagrams, flow charts, simple circuit schematics,
jumper layouts, and other kinds of illustration involving
repetitive uses of simple geometric forms and splines.
Because these descriptions are procedural and object-based,
they are both compact and easy to modify.</p>
<p style="margin-top: 1em">The phrase &ldquo;GNU pic&rdquo;
may refer to either of two <b>pic</b> implementations
distributed by the Free Software Foundation and intended to
accept the same input language. The <i>gpic</i>(1)
implementation is for use with the <i>groff</i>(1)
implementation of <b>troff</b>. The <i>pic2plot</i>(1)
implementation runs standalone and is part of the
<b>plotutils</b> package. Because both implementations are
widely available in source form for free, they are good bets
for writing very portable documentation.</p>
<h3>1.2. PIC Versions
<a name="1.2. PIC Versions"></a>
</h3>
<p style="margin-top: 1em">The original 1984
pre-<i>ditroff</i>(1) version of <b>pic</b> is long
obsolete. The rewritten 1991 version is still available as
part of the Documenter&rsquo;s Work Bench module of System
V.</p>
<p style="margin-top: 1em">Where differences between
Documenter&rsquo;s Work Bench (1991) <b>pic</b> and GNU
<b>pic</b> need to be described, original <b>pic</b> is
referred to as &ldquo;DWB pic&rdquo;. Details on the history
of the program are given at the end of this document.</p>
<p style="margin-top: 1em">The <b>pic2plot</b> program does
not require the rest of the <i>groff</i>(1) toolchain to
render graphics. It can display <b>pic</b> diagrams in an
X&nbsp;window, or generate output plots in a large number of
other formats. These formats include: PNG, PBM, PGM, PPM,
GIF, SVG, Adobe Illustrator format, idraw-editable
Postscript, the WebCGM format for Web-based vector graphics,
the format used by the <b>xfig</b> drawing editor, the
Hewlett-Packard PCL&nbsp;5 printer language, the
Hewlett-Packard Graphics Language (by default, HP-GL/2), the
ReGIS (remote graphics instruction set) format developed by
DEC, Tektronix format, and device-independent GNU graphics
metafile format.</p>
<p style="margin-top: 1em">In this document, <i>gpic</i>(1)
and <i>pic2plot</i>(1) extensions are marked as such.</p>
<hr>
[ <a href="pic-2.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,422 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-10.html</title>
</head>
<hr>
[ <a href="pic-9.html">prev</a> | <a href="pic-11.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>10. Describing locations
<a name="10. Describing locations"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">The
location of points can be described in many different ways.
All these forms are interchangeable as for as the <b>pic</b>
language syntax is concerned; where you can use one, any of
the others that would make semantic sense are
allowed.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
special label <b>Here</b> always refers to the current
position.</font></p>
<h3>10.1. Absolute Coordinates
<a name="10.1. Absolute Coordinates"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
simplest is absolute coordinates in inches; <b>pic</b> uses
a Cartesian system with (0,0) at the lower left corner of
the virtual drawing surface for each picture (that is,
X&nbsp;increases to the right and Y&nbsp;increases upward).
An absolute location may always be written in the
conventional form as two comma-separated numbers surrounded
by parentheses (and this is recommended for clarity). In
contexts where it creates no ambiguity, the pair of X and
Y&nbsp;coordinates suffices without parentheses.</font></p>
<p style="margin-top: 1em"><font color="#000000">It is a
good idea to avoid absolute coordinates, however. They tend
to make picture descriptions difficult to understand and
modify. Instead, there are quite a number of ways to specify
locations relative to <b>pic</b> objects and previous
locations.</font></p>
<p style="margin-top: 1em"><font color="#000000">Another
possibility of surprise is the fact that <b>pic</b> crops
the picture to the smallest bounding box before writing it
out. For example, if you have a picture consisting of a
small box with its lower left corner at (2,2) and another
small box with its upper right corner at (5,5), the width
and height of the image are both 3&nbsp;units and
not&nbsp;5. To get the origin at (0,0) included, simply add
an invisible object to the picture, positioning the
object&rsquo;s left corner at (0,0).</font></p>
<h3>10.2. Locations Relative to Objects
<a name="10.2. Locations Relative to Objects"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The symbol
<b>Here</b> always refers to the position of the last object
drawn or the destination of the last <b>move</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Alone and
unqualified, a <b>last circle</b> or any other way of
specifying a closed-object or arc location refers as a
position to the geometric center of the object. Unqualified,
the name of a line or spline object refers to the position
of the object start.</font></p>
<p style="margin-top: 1em"><font color="#000000">Also,
<b>pic</b> objects have quite a few named locations
associated with them. One of these is the object center,
which can be indicated (redundantly) with the suffix
<b>.center</b> (or just <b>.c</b>). Thus, <b>last circle
.center</b> is equivalent to <b>last circle</b>.</font></p>
<h4>10.2.1. Locations Relative to Closed Objects
<a name="10.2.1. Locations Relative to Closed Objects"></a>
</h4>
<p style="margin-top: 1em"><font color="#000000">Every
closed object (box, circle, ellipse, or block composite)
also has eight compass points associated with it;</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-32.png" alt="Image img/pic-32.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-1: Compass points</font></p>
<p style="margin-top: 1em"><font color="#000000">these are
the locations where eight compass rays from the geometric
center would intersect the figure. So when we say <b>last
circle .s</b> we are referring to the south compass point of
the last circle drawn. The explanation of Figure 8-3&rsquo;s
program is now complete.</font></p>
<p style="margin-top: 1em"><font color="#000000">(In case
you dislike compass points, the names <b>.top</b>,
<b>.bottom</b>, <b>.left</b> and <b>.right</b> are synonyms
for <b>.n</b>, <b>.s</b>, <b>.e</b>, and <b>.w</b>
respectively; they can even be abbreviated to <b>.t</b>,
<b>.b</b>, <b>.l</b> and <b>.r</b>).</font></p>
<p style="margin-top: 1em"><font color="#000000">The names
<b>center</b>, <b>top</b>, <b>bottom</b>, <b>left</b>,
<b>right</b>, <b>north</b>, <b>south</b>, <b>east</b>, and
<b>west</b> can also be used (without the leading dot) in a
prefix form marked by <b>of</b>; thus, <b>center of last
circle</b> and <b>top of 2nd last ellipse</b> are both valid
object references. Finally, the names <b>left</b> and
<b>right</b> can be prefixed with <b>upper</b> and
<b>lower</b> which both have the obvious meaning.</font></p>
<p style="margin-top: 1em"><font color="#000000">Arc
objects also have compass points; they are the compass
points of the implied circle.</font></p>
<p style="margin-top: 1em"><font color="#000000">Non-closed
objects (line, arrow, or spline) have compass points too,
but the locations of them are completely arbitrary. In
particular, different <b>pic</b> implementations return
different locations.</font></p>
<h4>10.2.2. Locations Relative to Open Objects
<a name="10.2.2. Locations Relative to Open Objects"></a>
</h4>
<p style="margin-top: 1em"><font color="#000000">Every open
object (line, arrow, arc, or spline) has three named points:
<b>.start</b>, <b>.center</b> (or <b>.c</b>), and
<b>.end</b>. They can also be used without leading dots in
the <b>of</b> prefix form. The center of an arc is the
center of its circle, but the center of a line, path, or
spline is halfway between its endpoints.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-33.png" alt="Image img/pic-33.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-2: Special points on open objects</font></p>
<h5>10.2.2.1. Locations Relative to Polygons
<a name="10.2.2.1. Locations Relative to Polygons"></a>
</h5>
<p style="margin-top: 1em"><font color="#000000">Polygons
have three types of reference points: <i>vertices</i>
(<b>.vertex</b>, <b>.ver</b>, <b>.v</b>), <i>midpoints</i>
of edges between the vertices (<b>.midpoint</b>,
<b>.mid</b>), and a <i>center</i> (<b>.center</b>,
<b>.c</b>). Reference points can be used without leading
dots in the <b>of</b> prefix form. The center of a polygon
is the centroid, and may give unexpected results for
non-simple polygons.</font></p>
<p style="margin-top: 1em"><font color="#000000">GNU
<b>pic</b> numbers vertices and midpoints in drawing order
starting from <b>1</b>. Express them in the forms <b>.v</b>
<i>expr</i> or <b>.v</b> `<i>expr</i>'. The latter is
required when the vertex/point expression is followed by an
additional expression, as <b>pic</b> otherwise attempts to
reduce them to a single expression. For example,</font></p>
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">for
i = 1 to n do { <br>
circle rad 0.05 fill 1 at last polygon.vi <br>
} <br>
circle rad 0.05 fill 1 at last polygon.mid `1' +
(0.0,0.1)</font></p>
<p style="margin-top: 1em"><font color="#000000">would draw
a dot 0.1i above the mid-point of the first edge at the
default scale, and one at each vertex for a polygon with n
vertices.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-34.png" alt="Image img/pic-34.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-3: Special points on polygons</font></p>
<h3>10.3. Ways of Composing Positions
<a name="10.3. Ways of Composing Positions"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">Once you
have two positions to work with, there are several ways to
combine them to specify new positions.</font></p>
<h4>10.3.1. Vector Sums and Displacements
<a name="10.3.1. Vector Sums and Displacements"></a>
</h4>
<p style="margin-top: 1em"><font color="#000000">Positions
may be added or subtracted to yield a new position (to be
more precise, you can only add a position and an expression
pair; the latter must be on the right side of the addition
or subtraction sign). The result is the conventional vector
sum or difference of coordinates. For example, <b>last box
.ne + (0.1, 0)</b> is a valid position. This example
illustrates a common use, to define a position slightly
offset from a named one (say, for captioning
purposes).</font></p>
<h4>10.3.2. Interpolation Between Positions
<a name="10.3.2. Interpolation Between Positions"></a>
</h4>
<p style="margin-top: 1em"><font color="#000000">A position
may be interpolated between any two positions. The syntax is
&lsquo;<i>fraction</i> <b>of the way between</b>
<i>position1</i> <b>and</b> <i>position2</i>&rsquo;. For
example, you can say <b>1/3 of the way between Here and last
ellipse .ne</b>. The fraction may be in
numerator/denominator form or may be an ordinary number
(values are <i>not</i> restricted to [0,1]). As an
alternative to this verbose syntax, you can say
&lsquo;<i>fraction</i> <b>&lt;</b><i>position1</i> <b>,</b>
<i>position2</i><b>&gt;</b>&rsquo;; thus, the example could
also be written as <b>1/3 &lt;Here, last
ellipse&gt;</b>.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-35.png" alt="Image img/pic-35.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-3: <b>P: 1/3 of the way between last arrow .start and
last arrow .end</b></font></p>
<p style="margin-top: 1em"><font color="#000000">This
facility can be used, for example, to draw double
connections.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-36.png" alt="Image img/pic-36.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-4: Doubled arrows</font></p>
<p style="margin-top: 1em"><font color="#000000">You can
get Figure 10-4 from the following program:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
A: box &quot;yin&quot;; move; <br>
B: box &quot;yang&quot;; <br>
arrow right at 1/4 &lt;A.e,A.ne&gt;; <br>
arrow left at 1/4 &lt;B.w,B.sw&gt;; <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">Note the
use of the short form for interpolating points.</font></p>
<h4>10.3.3. Projections of Points
<a name="10.3.3. Projections of Points"></a>
</h4>
<p style="margin-top: 1em"><font color="#000000">Given two
positions <i>p</i> and <i>q</i>, the position
<b>(</b><i>p</i><b>,</b> <i>q</i><b>)</b> has the
X&nbsp;coordinate of <i>p</i> and the Y coordinate of
<i>q</i>. This can be helpful in placing an object at one of
the corners of the virtual box defined by two other
objects.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-37.png" alt="Image img/pic-37.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-5: Using (<i>x</i>, <i>y</i>) composition</font></p>
<h3>10.4. Using Locations
<a name="10.4. Using Locations"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">There are
four ways to use locations; <b>at</b>, <b>from</b>,
<b>to</b>, and <b>with</b>. All four are object modifiers;
that is, you use them as suffixes to a drawing
command.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>at</b> modifier says to draw a closed object or arc with
its center at the following location, or to draw a
line/spline/arrow starting at the following
location.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>to</b> modifier can be used alone to specify a move
destination. The <b>from</b> modifier can be used alone in
the same way as <b>at</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>from</b> and <b>to</b> modifiers can be used with a
<b>line</b> or <b>arc</b> command to specify start and end
points of the object. In conjunction with named locations,
this offers a very flexible mechanism for connecting
objects. For example, the following program</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
box &quot;from&quot; <br>
move 0.75; <br>
ellipse &quot;to&quot; <br>
arc cw from 1/3 of the way \ <br>
between last box .n and last box .ne to last ellipse .n;
<br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">yields:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-38.png" alt="Image img/pic-38.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-6: A tricky connection specified with English-like
syntax</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>with</b> modifier allows you to identify a named
attachment point of an object (or a position within the
object) with another point. This is very useful for
connecting objects in a natural way. For an example,
consider these two programs:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-39.png" alt="Image img/pic-39.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-7: Using the <b>with</b> modifier for
attachments</font></p>
<h3>10.5. The &lsquo;chop&rsquo; Modifier
<a name="10.5. The &lsquo;chop&rsquo; Modifier"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">When
drawing lines between circles that don&rsquo;t intersect
them at a compass point, it is useful to be able to shorten
a line by the radius of the circle at either or both ends.
Consider the following program:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
circle &quot;x&quot; <br>
circle &quot;y&quot; at 1st circle - (0.4, 0.6) <br>
circle &quot;z&quot; at 1st circle + (0.4, -0.6) <br>
arrow from 1st circle to 2nd circle chop <br>
arrow from 2nd circle to 3rd circle chop <br>
arrow from 3rd circle to 1st circle chop <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">It yields
the following:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-40.png" alt="Image img/pic-40.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
10-8: The <b>chop</b> modifier</font></p>
<p style="margin-top: 1em"><font color="#000000">Notice
that the <b>chop</b> attribute moves arrowheads rather than
stepping on them. By default, the <b>chop</b> modifier
shortens both ends of the line by <b>circlerad</b>. By
suffixing it with a number you can change the amount of
chopping.</font></p>
<p style="margin-top: 1em"><font color="#000000">If you say
<b>line ... chop</b> <i>r1</i> <b>chop</b> <i>r2</i> with
<i>r1</i> and <i>r2</i> both numbers, you can vary the
amount of chopping at both ends. You can use this in
combination with trigonometric functions to write code that
deals with more complex intersections.</font></p>
<hr>
[ <a href="pic-9.html">prev</a> | <a href="pic-11.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,180 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-11.html</title>
</head>
<hr>
[ <a href="pic-10.html">prev</a> | <a href="pic-12.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>11. Object Groups
<a name="11. Object Groups"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">There are
two different ways to group objects in <b>pic</b>; <i>brace
grouping</i> and <i>block composites</i>.</font></p>
<h3>11.1. Brace Grouping
<a name="11.1. Brace Grouping"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
simpler method is simply to group a set of objects within
curly bracket or brace characters. On exit from this
grouping, the current position and direction are restored to
their value when the opening brace was
encountered.</font></p>
<h3>11.2. Block Composites
<a name="11.2. Block Composites"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">A block
composite object is created a series of commands enclosed by
square brackets. The composite can be treated for most
purposes like a single closed object, with the size and
shape of its bounding box. Here is an example. The program
fragment</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">A:
[ <br>
circle; <br>
line up 1 at last circle .n; <br>
line down 1 at last circle .s; <br>
line right 1 at last circle .e; <br>
line left 1 at last circle .w; <br>
box dashed with .nw at last circle .se + (0.2, -0.2); <br>
Caption: center of last box; <br>
]</font></p>
<p style="margin-top: 1em"><font color="#000000">yields the
block in figure 11-1, which we show both with and without
its attachment points. The block&rsquo;s location becomes
the value of <b>A</b>.</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-41.png" alt="Image img/pic-41.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
11-1: A sample composite object</font></p>
<p style="margin-top: 1em"><font color="#000000">To refer
to one of the composite&rsquo;s attachment points, you can
say (for example) <b>A .s</b>. For purposes of object
naming, composites are a class. You could write <b>last []
.s</b> as an equivalent reference, usable anywhere a
location is needed. This construction is very important for
putting together large, multi-part diagrams.</font></p>
<p style="margin-top: 1em"><font color="#000000">Blocks are
also a variable-scoping mechanism, like a <i>groff</i>(1)
environment. All variable assignments done inside a block
are undone at the end of it. To get at values within a
block, write a name of the block followed by a dot, followed
by the label you want. For example, we could refer the
center of the box in the above composite as <b>last []
.Caption</b> or <b>A.Caption</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">This kind
of reference to a label can be used in any way any other
location can be. For example, if we added <b>&quot;Hi!&quot;
at A.Caption</b> the result would look like this:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-42.png" alt="Image img/pic-42.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
11-2: Adding a caption using interior labeling</font></p>
<p style="margin-top: 1em"><font color="#000000">You can
also use interior labels in either part of a <b>with</b>
modifier. This means that the example composite could be
placed relative to its caption box by a command containing
<b>with A.Caption at</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Note that
both width and height of the block composite object are
always positive:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-43.png" alt="Image img/pic-43.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
11-3: Composite block objects always have positive width and
height</font></p>
<p style="margin-top: 1em"><font color="#000000">Blocks may
be nested. This means you can use block attachment points to
build up complex diagrams hierarchically, from the inside
out. Note that <b>last</b> and the other sequential naming
mechanisms don&rsquo;t look inside blocks, so if you have a
program that looks like</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
P: [box &quot;foo&quot;; ellipse &quot;bar&quot;]; <br>
Q: [</font></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">[box &quot;baz&quot;; ellipse
&quot;quxx&quot;]</font></p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">&quot;random
text&quot;;</font></p> </td></tr>
</table>
<p style="margin-left:28%;"><font color="#000000">] <br>
arrow from 2nd last []; <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">the arrow
in the last line is attached to object <b>P</b>, not object
<b>Q</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">In DWB
<b>pic</b>, only references one level deep into enclosed
blocks were permitted. GNU <b>gpic</b> removes this
restriction.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
combination of block variable scoping, assignability of
labels and the macro facility that we&rsquo;ll describe
later on can be used to simulate functions with local
variables (just wrap the macro body in block
braces).</font></p>
<hr>
[ <a href="pic-10.html">prev</a> | <a href="pic-12.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,68 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-12.html</title>
</head>
<hr>
[ <a href="pic-11.html">prev</a> | <a href="pic-13.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>12. Style Variables
<a name="12. Style Variables"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">There are
a number of global style variables in <b>pic</b> that can be
used to change its overall behavior. We&rsquo;ve mentioned
several of them in previous sections. They&rsquo;re all
described here. For each variable, the default is
given.</font></p>
<p align="center"><font color="#000000"><img src="img/pic-44.png" alt="Image img/pic-44.png"></font></p>
<p style="margin-top: 1em"><font color="#000000">Any of
these variables can be set with a simple assignment
statement. For example:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-45.png" alt="Image img/pic-45.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">F
i g u r e 1 2 - 1 : <b>b o x h t = 1 ; b o x w i d = 0 . 3 ;
m o v e w i d = 0 . 2 ; b o x ; m o v e ; b o x ; m o v e ;
b o x ; m o v e ; b o x ;</b></font></p>
<p style="margin-top: 1em"><font color="#000000">In GNU
<b>pic</b>, setting the <b>scale</b> variable re-scales all
size-related state variables so that their values remain
equivalent in the new units.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
command <b>reset</b> resets all style variables to their
defaults. You can give it a list of variable names as
arguments (optionally separated by commas), in which case it
resets only those.</font></p>
<p style="margin-top: 1em"><font color="#000000">State
variables retain their values across pictures until
reset.</font></p>
<hr>
[ <a href="pic-11.html">prev</a> | <a href="pic-13.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,130 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-13.html</title>
</head>
<hr>
[ <a href="pic-12.html">prev</a> | <a href="pic-14.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>13. Expressions, Variables, and Assignment
<a name="13. Expressions, Variables, and Assignment"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">A number
is a valid expression, of course (all numbers are stored
internally as floating-point). Decimal-point notation is
acceptable; in GNU <b>gpic</b>, scientific notation in
C&rsquo;s &lsquo;e&rsquo; format (like 5e-2) is
accepted.</font></p>
<p style="margin-top: 1em"><font color="#000000">Anywhere a
number is expected, the language also accepts a variable.
Variables may be the built-in style variable described in
the last section, or new variables created by
assignment.</font></p>
<p style="margin-top: 1em"><font color="#000000">DWB
<b>pic</b> supports only the ordinary assignment via
<b>=</b>, which defines the variable (on the left side of
the equal sign) in the current block if it is not already
defined there, and then changes the value (on the right
side) in the current block. The variable is not visible
outside of the block. This is similar to the
C&nbsp;programming language where a variable within a block
shadows a variable with the same name outside of the
block.</font></p>
<p style="margin-top: 1em"><font color="#000000">GNU
<b>gpic</b> supports an alternate form of assignment using
<b>:=</b>. The variable must already be defined, and the
value is assigned to that variable without creating a
variable local to the current block. For example,
this</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">x=5
<br>
y=5 <br>
[ <br>
x:=3 <br>
y=3 <br>
] <br>
print x &quot; &quot; y</font></p>
<p style="margin-top: 1em"><font color="#000000">prints
<b>3 5</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">You can
use the height, width, radius, and x and y coordinates of
any object or corner in expressions. If <b>A</b> is an
object label or name, all the following are
valid:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">A.x
# x coordinate of the center of A <br>
A.ne.y # y coordinate of the northeast corner of A <br>
A.wid # the width of A <br>
A.ht # and its height <br>
2nd last circle.rad # the radius of the 2nd last
circle</font></p>
<p style="margin-top: 1em"><font color="#000000">Note the
second expression, showing how to extract a corner
coordinate.</font></p>
<p style="margin-top: 1em"><font color="#000000">Basic
arithmetic resembling those of C operators are available;
<b>+</b>, <b>*</b>, <b>-</b>, <b>/</b>, and <b>%</b>. So is
<b>ˆ</b> for exponentiation. Grouping is permitted in the
usual way using parentheses. GNU <b>gpic</b> allows logical
operators to appear in expressions; <b>!</b> (logical
negation, not factorial), <b>&amp;&amp;</b>, <b>||</b>,
<b>==</b>, <b>!=</b>, <b>&gt;=</b>, <b>&lt;=</b>,
<b>&lt;</b>, <b>&gt;</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Various
built-in functions are supported:
<b>sin(</b><i>x</i><b>)</b>, <b>cos(</b><i>x</i><b>)</b>,
<b>log(</b><i>x</i><b>)</b>, <b>exp(</b><i>x</i><b>)</b>,
<b>sqrt(</b><i>x</i><b>)</b>,
<b>max(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
<b>atan2(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
<b>min(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
<b>int(</b><i>x</i><b>)</b>, <b>rand()</b>, and
<b>srand()</b>. Both <b>exp</b> and <b>log</b> are
base&nbsp;10; <b>int</b> does integer truncation;
<b>rand()</b> returns a random number in [0-1), and
<b>srand()</b> sets the seed for a new sequence of
pseudo-random numbers to be returned by <b>rand()</b>
(<b>srand()</b> is a GNU extension).</font></p>
<p style="margin-top: 1em"><font color="#000000">GNU
<b>gpic</b> also documents a one-argument form or rand,
<b>rand(</b><i>x</i><b>)</b>, which returns a random number
between 1 and <i>x</i>, but this is deprecated and may be
removed in a future version.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
function <b>sprintf()</b> behaves like a C <i>sprintf</i>(3)
function that only takes %%, %e, %E, %f, %g, and %G
conversion specifications.</font></p>
<hr>
[ <a href="pic-12.html">prev</a> | <a href="pic-14.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,161 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-14.html</title>
</head>
<hr>
[ <a href="pic-13.html">prev</a> | <a href="pic-15.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>14. Macros
<a name="14. Macros"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">You can
define macros in <b>pic</b>, with up to 32 arguments (up to
16 on EBCDIC platforms). This is useful for diagrams with
repetitive parts. In conjunction with the scope rules for
block composites, it effectively gives you the ability to
write functions.</font></p>
<p style="margin-top: 1em"><font color="#000000">The syntax
is</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>define</b>
<i>name</i> <b>{</b> <i>replacement text</i>
<b>}</b></font></p>
<p style="margin-top: 1em"><font color="#000000">This
defines <i>name</i> as a macro to be replaced by the
replacement text (not including the braces). The macro may
be called as</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><i>name</i><b>(</b><i>arg1,
arg2, ... argn</i><b>)</b></font></p>
<p style="margin-top: 1em"><font color="#000000">The
arguments (if any) are substituted for tokens <b>$1</b>,
<b>$2</b> ... <b>$n</b> appearing in the replacement
text.</font></p>
<p style="margin-top: 1em"><font color="#000000">As an
example of macro use, consider this:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
# Plot a single jumper in a box, $1 is the on-off state.
<br>
define jumper { [ <br>
shrinkfactor = 0.8; <br>
Outer: box invis wid 0.45 ht 1;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
Count on end ] to reset these <br>
boxwid = Outer.wid * shrinkfactor / 2; <br>
boxht = Outer.ht * shrinkfactor / 2;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">box
fill (!$1) with .s at center of Outer; <br>
box fill ($1) with .n at center of Outer; <br>
] }</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
Plot a block of six jumpers. <br>
define jumperblock { <br>
jumper($1); <br>
jumper($2); <br>
jumper($3); <br>
jumper($4); <br>
jumper($5); <br>
jumper($6);</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">jwidth
= last [].Outer.wid; <br>
jheight = last [].Outer.ht;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">box
with .nw at 6th last [].nw wid 6*jwidth ht
jheight;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
Use {} to avoid changing position from last box draw. <br>
# This is necessary so move in any direction works as
expected <br>
{&quot;Jumpers in state $1$2$3$4$5$6&quot; at last box .s +
(0,-0.2);} <br>
}</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
Sample macro invocations. <br>
jumperblock(1,1,0,0,1,0); <br>
move; <br>
jumperblock(1,0,1,0,1,1); <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">It yields
the following:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-46.png" alt="Image img/pic-46.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
14-1: Sample use of a macro</font></p>
<p style="margin-top: 1em"><font color="#000000">This macro
example illustrates how you can combine [], brace grouping,
and variable assignment to write true functions.</font></p>
<p style="margin-top: 1em"><font color="#000000">One detail
the example above does not illustrate is the fact that macro
argument parsing is not token-oriented. If you call
<b>jumper(&nbsp;1&nbsp;)</b>, the value of $1 is
<b>&quot;&nbsp;1&nbsp;&quot;</b>. You could even call
<b>jumper(big&nbsp;string)</b> to give $1 the value
<b>&quot;big&nbsp;string&quot;</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">If you
want to pass in a coordinate pair, you can avoid getting
tripped up by the comma by wrapping the pair in
parentheses.</font></p>
<p style="margin-top: 1em"><font color="#000000">Macros
persist through pictures. To undefine a macro, say
<b>undef</b> <i>name</i>; for example,</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">undef
jumper <br>
undef jumperblock</font></p>
<p style="margin-top: 1em"><font color="#000000">would
undefine the two macros in the jumper block
example.</font></p>
<hr>
[ <a href="pic-13.html">prev</a> | <a href="pic-15.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,184 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-15.html</title>
</head>
<hr>
[ <a href="pic-14.html">prev</a> | <a href="pic-16.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>15. Import/Export Commands
<a name="15. Import/Export Commands"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">Commands
that import or export data between <b>pic</b> and its
environment are described here.</font></p>
<h3>15.1. File and Table Insertion
<a name="15.1. File and Table Insertion"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
statement</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
<i>filename</i></font></p>
<p style="margin-top: 1em"><font color="#000000">inserts
the contents of <i>filename</i> in the <b>pic</b> input
stream. Any <b>.PS</b>/<b>.PE</b> pair in the file is
ignored. You can use this to include pre-generated
images.</font></p>
<p style="margin-top: 1em"><font color="#000000">A variant
of this statement replicates the <b>copy thru</b> feature of
<i>grap</i>(1). The call</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
<i>filename</i> thru <i>macro</i></font></p>
<p style="margin-top: 1em"><font color="#000000">calls
<i>macro</i> (which may be either a name or replacement
text) on the arguments obtained by breaking each line of the
file into blank-separated fields. The macro may have up to
9&nbsp;arguments. The replacement text may be delimited by
braces or by a pair of instances of any character not
appearing in the rest of the text.</font></p>
<p style="margin-top: 1em"><font color="#000000">If you
write</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
thru <i>macro</i></font></p>
<p style="margin-top: 1em"><font color="#000000">omitting
the filename, lines to be parsed are taken from the input
source up to the next <b>.PE</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">In either
of the last two <b>copy</b> commands, GNU <b>gpic</b>
permits a trailing &lsquo;<b>until</b> <i>word</i>&rsquo;
clause to be added which terminates the copy when the first
word matches the argument (the default behavior is therefore
equivalent to <b>until .PE</b>).</font></p>
<p style="margin-top: 1em"><font color="#000000">Accordingly,
the command</font></p>
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">.PS
<br>
copy thru % circle at ($1,$2) % until &quot;END&quot; <br>
1 2 <br>
3 4 <br>
5 6 <br>
END <br>
box <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">is
equivalent to</font></p>
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">.PS
<br>
circle at (1,2) <br>
circle at (3,4) <br>
circle at (5,6) <br>
box <br>
.PE</font></p>
<h3>15.2. Debug Messages
<a name="15.2. Debug Messages"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
command <b>print</b> accepts any number of arguments,
catenates their output forms, and writes the result to
standard error. Each argument must be an expression, a
position, or a text string.</font></p>
<h3>15.3. Escape to Post-Processor
<a name="15.3. Escape to Post-Processor"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">If you
write</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>command</b>
<i>arg</i>...</font></p>
<p style="margin-top: 1em"><font color="#000000"><b>pic</b>
concatenates the arguments and pass them through as a line
to troff or TeX. Each <i>arg</i> must be an expression, a
position, or text. This has a similar effect to a line
beginning with <b>.</b> or <b>\</b>, but allows the values
of variables to be passed through.</font></p>
<p style="margin-top: 1em"><font color="#000000">For
example,</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
x = 14 <br>
command &quot;.ds string x is &quot; x &quot;.&quot; <br>
.PE <br>
\*[string]</font></p>
<p style="margin-top: 1em"><font color="#000000">prints</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">x
is 14.</font></p>
<h3>15.4. Executing Shell Commands
<a name="15.4. Executing Shell Commands"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
command</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">sh
{ <i>anything...</i> }</font></p>
<p style="margin-top: 1em"><font color="#000000">macro-expands
the text in braces, then executes it as a shell command.
This could be used to generate images or data tables for
later inclusion. The delimiters shown as {} here may also be
two copies of any one character not present in the shell
command text. In either case, the body may contain balanced
{} pairs. Strings in the body may contain balanced or
unbalanced braces in any case.</font></p>
<hr>
[ <a href="pic-14.html">prev</a> | <a href="pic-16.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,112 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-16.html</title>
</head>
<hr>
[ <a href="pic-15.html">prev</a> | <a href="pic-17.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>16. Control-flow constructs
<a name="16. Control-flow constructs"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">The
<b>pic</b> language provides conditionals and looping. For
example,</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">pi
= atan2(0,-1); <br>
for i = 0 to 2 * pi by 0.1 do { <br>
&quot;-&quot; at (i/2, 0); <br>
&quot;.&quot; at (i/2, sin(i)/2); <br>
&quot;:&quot; at (i/2, cos(i)/2); <br>
}</font></p>
<p style="margin-top: 1em"><font color="#000000">which
yields this:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-47.png" alt="Image img/pic-47.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
16-1: Plotting with a <b>for</b> loop</font></p>
<p style="margin-top: 1em"><font color="#000000">The syntax
of the <b>for</b> statement is:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>for</b>
<i>variable</i> <b>=</b> <i>expr1</i> <b>to</b> <i>expr2</i>
[<b>by</b> [<b>*</b>]<i>expr3</i>] <b>do</b> <i>X body
X</i></font></p>
<p style="margin-top: 1em"><font color="#000000">The
semantics are as follows: Set <i>variable</i> to
<i>expr1</i>. While the value of <i>variable</i> is less
than or equal to <i>expr2</i>, do <i>body</i> and increment
<i>variable</i> by <i>expr3</i>; if <b>by</b> is not given,
increment <i>variable</i> by&nbsp;1. If <i>expr3</i> is
prefixed by&nbsp;<b>*</b> then <i>variable</i> is multiplied
instead by <i>expr3</i>. The value of <i>expr3</i> can be
negative for the additive case; <i>variable</i> is then
tested whether it is greater than or equal to <i>expr2</i>.
For the multiplicative case, <i>expr3</i> must be greater
than zero. If the constraints aren&rsquo;t met, the loop
isn&rsquo;t executed. <i>X</i> can be any character not
occurring in <i>body</i>; or the two <i>X</i>s may be paired
braces (as in the <b>sh</b> command).</font></p>
<p style="margin-top: 1em"><font color="#000000">The syntax
of the <b>if</b> statement is as follows:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>if</b>
<i>expr</i> <b>then</b> <i>X if-true X</i> [<b>else</b> <i>Y
if-false Y</i>]</font></p>
<p style="margin-top: 1em"><font color="#000000">Its
semantics are as follows: Evaluate <i>expr</i>; if it is
non-zero then do <i>if-true</i>, otherwise do
<i>if-false</i>. <i>X</i> can be any character not occurring
in <i>if-true</i>. <i>Y</i> can be any character not
occurring in <i>if-false</i>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Eithe or
both of the <i>X</i> or <i>Y</i> pairs may instead be
balanced pairs of braces ({ and&nbsp;}) as in the <b>sh</b>
command. In either case, the <i>if-true</i> may contain
balanced pairs of braces. None of these delimiters are seen
inside strings.</font></p>
<p style="margin-top: 1em"><font color="#000000">All the
usual relational operators my be used in conditional
expressions; <b>!</b> (logical negation, not factorial),
<b>&amp;&amp;</b>, <b>||</b>, <b>==</b>, <b>!=</b>,
<b>&gt;=</b>, <b>&lt;=</b>, <b>&lt;</b>,
<b>&gt;</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">String
comparison is also supported using <b>==</b> and <b>!=</b>.
String comparisons may need to be parenthesized to avoid
syntactic ambiguities.</font></p>
<hr>
[ <a href="pic-15.html">prev</a> | <a href="pic-17.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,208 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-17.html</title>
</head>
<hr>
[ <a href="pic-16.html">prev</a> | <a href="pic-18.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>17. Interface To [gt]roff
<a name="17. Interface To [gt]roff"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">The output
of <b>pic</b> is <b>[gt]roff</b> drawing commands. The GNU
<i>gpic</i>(1) command warns that it relies on drawing
extensions present in <i>groff</i>(1) that are not present
in <i>troff</i>(1).</font></p>
<h3>17.1. Scaling Arguments
<a name="17.1. Scaling Arguments"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The DWB
<i>pic</i>(1) program accepts one or two arguments to
<b>.PS</b>, which is interpreted as a width and height in
inches to which the results of <i>pic</i>(1) should be
scaled (width and height scale independently). If there is
only one argument, it is interpreted as a width to scale the
picture to, and height is scaled by the same
proportion.</font></p>
<p style="margin-top: 1em"><font color="#000000">GNU
<b>gpic</b> is less general; it accepts a single width to
scale to, or a zero width and a maximum height to scale to.
With two non-zero arguments, it scales to the maximum
height.</font></p>
<h3>17.2. How Scaling is Handled
<a name="17.2. How Scaling is Handled"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">When
<b>pic</b> processes a picture description on input, it
passes <b>.PS</b>, <b>.PE</b>, <b>.PF</b>, and <b>.PY</b>
through to the postprocessor. The <b>.PS</b> gets decorated
with two numeric arguments which are the X and
Y&nbsp;dimensions of the picture in inches. The
post-processor can use these to reserve space for the
picture and center it.</font></p>
<p style="margin-top: 1em"><font color="#000000">The GNU
incarnation of the <b>ms</b> macro package, for example,
includes the following definitions:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.de
PS <br>
.br <br>
.sp \\n[DD]u <br>
.ie \\n[.$]&lt;2 .@error bad arguments to PS (not
preprocessed with pic?) <br>
.el \{\</font></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="11%">
<p><font color="#000000">.</font></p></td>
<td width="78%">
<p><font color="#000000">ds@need (u;\\$1)+1v</font></p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="11%">
<p><font color="#000000">.</font></p></td>
<td width="78%">
<p><font color="#000000">in
+(u;\\n[.l]-\\n[.i]-\\$2/2&gt;?0)</font></p> </td></tr>
</table>
<p style="margin-left:28%;"><font color="#000000">.\} <br>
.. <br>
.de PE <br>
.par@reset <br>
.sp \\n[DD]u+.5m <br>
..</font></p>
<p style="margin-top: 1em"><font color="#000000">Equivalent
definitions of these and of <b>.PF</b> and <b>.PY</b> are
supplied by GNU <i>pic</i>(1) if you use the &minus;mpic
option; this should make it usable with macro packages other
than <i>ms</i>.</font></p>
<p style="margin-top: 1em"><font color="#000000">If
<b>.PF</b> is used instead of <b>.PE</b>, the <b>troff</b>
position is restored to what it was at the picture start
(Kernighan notes that the&nbsp;F stands for
&ldquo;flyback&rdquo;). GNU <i>pic</i>(1) supports
<b>.PY</b> as a synonym of <b>.PF</b> to work around a name
space collision with the <i>mm</i> macro package, which uses
the same name for a page footer management macro. Use
<b>.PF</b> preferentially unless a similar problem faces
your document.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
invocation</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>.PS
&lt;</b><i>file</i></font></p>
<p style="margin-top: 1em"><font color="#000000">causes the
contents of <i>file</i> to replace the <b>.PS</b> line. This
feature is deprecated; use &lsquo;<b>copy</b>
<i>file</i>&rsquo; instead.</font></p>
<h3>17.3. PIC and [gt]roff commands
<a name="17.3. PIC and [gt]roff commands"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">By
default, input lines that begin with a period are passed to
the postprocessor, embedded at the corresponding point in
the output. Messing with horizontal or vertical spacing is
an obvious recipe for bugs, but point size and font changes
are usually safe.</font></p>
<p style="margin-top: 1em"><font color="#000000">Point
sizes and font changes are also safe within text strings, as
long as they are undone before the end of string.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
enablement of output line filling by <b>[gt]roff</b> is
preserved across pictures.</font></p>
<h3>17.4. PIC and EQN
<a name="17.4. PIC and EQN"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
Kernighan paper notes that there is a subtle problem with
complicated equations inside <b>pic</b> pictures; they come
out wrong if <i>eqn</i>(1) has to leave extra vertical space
for the equation. If your equation involves more than
subscripts and superscripts, you must add to the beginning
of each equation the extra information <b>space&nbsp;0</b>.
He gives the following example:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">arrow
<br>
box &quot;$space 0 {H( omega )} over {1 - H( omega )}$&quot;
<br>
arrow</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-48.png" alt="Image img/pic-48.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
17-1: Equations within pictures</font></p>
<h3>17.5. Absolute Positioning of Pictures
<a name="17.5. Absolute Positioning of Pictures"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">A
<b>pic</b> picture is positioned vertically by troff at the
current position. The topmost position possible on a page is
not the paper edge but a position which is one baseline
lower so that the first row of glyphs is visible. To make a
picture really start at the paper edge you have to make the
baseline-to-baseline distance zero, this is, you must set
the vertical spacing to&nbsp;0 (using <b>.vs</b>) before
starting the picture.</font></p>
<hr>
[ <a href="pic-16.html">prev</a> | <a href="pic-18.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,113 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-18.html</title>
</head>
<hr>
[ <a href="pic-17.html">prev</a> | <a href="pic-19.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>18. Interface to TeX
<a name="18. Interface to TeX"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">TeX mode
is enabled by the <b>&minus;t</b> option. In TeX mode, pic
defines a vbox called <b>\graph</b> for each picture; the
name can be changed with the pseudo-variable <b>figname</b>
(which is actually a specially parsed command). You must
yourself print that vbox using, for example, the
command</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">\centerline{\box\graph}</font></p>
<p style="margin-top: 1em"><font color="#000000">Actually,
since the vbox has a height of zero (it is defined with
\vtop) this produces slightly more vertical space above the
picture than below it;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">\centerline{\raise
1em\box\graph}</font></p>
<p style="margin-top: 1em"><font color="#000000">would
avoid this.</font></p>
<p style="margin-top: 1em"><font color="#000000">To make
the vbox having a positive height and a depth of zero (as
used e.g. by LaTeX&rsquo;s graphics.sty), define the
following macro in your document:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">\def\gpicbox#1{%
<br>
\vbox{\unvbox\csname #1\endcsname\kern 0pt}}</font></p>
<p style="margin-top: 1em"><font color="#000000">Now you
can simply say <b>\gpicbox{graph}</b> instead of
\box\graph.</font></p>
<p style="margin-top: 1em"><font color="#000000">You must
use a TeX driver that supports the <b>tpic</b> specials,
version&nbsp;2.</font></p>
<p style="margin-top: 1em"><font color="#000000">Lines
beginning with <b>\</b> are passed through transparently; a
<b>%</b> is added to the end of the line to avoid unwanted
spaces. You can safely use this feature to change fonts or
to change the value of <b>\baselineskip</b>. Anything else
may well produce undesirable results; use at your own risk.
Lines beginning with a period are not given any special
treatment.</font></p>
<p style="margin-top: 1em"><font color="#000000">The TeX
mode of <i>pic</i>(1) does <i>not</i> translate <b>troff</b>
font and size changes included in text strings!</font></p>
<p style="margin-top: 1em"><font color="#000000">Here an
example how to use <b>figname</b>.</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
figname = foo; <br>
... <br>
.PE</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
figname = bar; <br>
... <br>
.PE</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">\centerline{\box\foo
\hss \box\bar}</font></p>
<p style="margin-top: 1em"><font color="#000000">Use this
feature sparsingly and only if really needed: A different
name means a new box register in TeX, and the maximum number
of box registers is only 256. Also be careful not to use a
predefined TeX or LaTeX macro name as an argument to
<b>figname</b> since this inevitably causes an
error.</font></p>
<hr>
[ <a href="pic-17.html">prev</a> | <a href="pic-19.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,48 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-19.html</title>
</head>
<hr>
[ <a href="pic-18.html">prev</a> | <a href="pic-20.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>19. Obsolete Commands
<a name="19. Obsolete Commands"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">GNU
<i>gpic</i>(1) has a command</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>plot</b>
<i>expr</i>
[<b>&quot;</b><i>text</i><b>&quot;</b>]</font></p>
<p style="margin-top: 1em"><font color="#000000">This is a
text object which is constructed by using <i>text</i> as a
format string for sprintf with an argument of <i>expr</i>.
If <i>text</i> is omitted a format string of
<b>&quot;%g&quot;</b> is used. Attributes can be specified
in the same way as for a normal text object. Be very careful
that you specify an appropriate format string; <b>pic</b>
does only very limited checking of the string. This is
deprecated in favour of <b>sprintf</b>.</font></p>
<hr>
[ <a href="pic-18.html">prev</a> | <a href="pic-20.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,68 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-2.html</title>
</head>
<hr>
[ <a href="pic-1.html">prev</a> | <a href="pic-3.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>2. Invoking PIC
<a name="2. Invoking PIC"></a>
</h2>
<p style="margin-top: 1em">Every <b>pic</b> description is
a little program describing drawing actions. The
<b>[gtn]roff</b>-dependent versions compile the program by
<i>pic</i>(1) into <i>gtroff</i>(1) macros; the
<i>pic2plot</i>(1) implementation uses a plotting library to
draw the picture directly. Programs that process or display
<i>gtroff</i>(1) output need not know or care that parts of
the image began life as <b>pic</b> descriptions.</p>
<p style="margin-top: 1em">The <i>pic</i>(1) program tries
to translate anything between <b>.PS</b> and <b>.PE</b>
markers, and passes through everything else. The normal
definitions of <b>.PS</b> and <b>.PE</b> in the <i>ms</i>
macro package and elsewhere have also the side-effect of
centering the <b>pic</b> output on the page.</p>
<h3>2.1. PIC Error Messages
<a name="2.1. PIC Error Messages"></a>
</h3>
<p style="margin-top: 1em">If you make a mistake in
<b>pic</b> input such that the program cannot interpret what
you mean, <i>gpic</i>(1) issues a diagnostic message in the
format prescribed by the GNU Coding Standards. A typical
error message looks like</p>
<p style="margin-left:9%; margin-top: 1em">pic:<i>file</i>:<i>nnn</i>:
syntax error before '<i>token</i>' <br>
pic:<i>file</i>:<i>nnn</i>: giving up on this picture</p>
<p style="margin-top: 1em">where <i>file</i> is the name of
the file being processed, <i>nnn</i> is a line number within
that file, and <i>token</i> is a symbol in the <b>pic</b>
language (often a keyword) near (usually just after) the
error location.</p>
<hr>
[ <a href="pic-1.html">prev</a> | <a href="pic-3.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,284 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-20.html</title>
</head>
<hr>
[ <a href="pic-19.html">prev</a> | <a href="pic-21.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>20. Some Larger Examples
<a name="20. Some Larger Examples"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">Here are a
few larger examples, with complete source code. One of our
earlier examples is generated in an instructive way using a
for loop:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
# Draw a demonstration up left arrow with grid box overlay
<br>
define gridarrow <br>
{ <br>
move right 0.1 <br>
[ <br>
{arrow up left $1;} <br>
box wid 0.5 ht 0.5 dotted with .nw at last arrow .end; <br>
for i = 2 to ($1 / 0.5) do <br>
{ <br>
box wid 0.5 ht 0.5 dotted with .sw at last box .se; <br>
} <br>
move down from last arrow .center; <br>
[ <br>
sprintf(&quot;\fBarrow up left %g\fP&quot;, $1) <br>
] <br>
] <br>
move right 0.1 from last [] .e; <br>
} <br>
gridarrow(0.5); <br>
gridarrow(1); <br>
gridarrow(1.5); <br>
gridarrow(2); <br>
undef gridarrow <br>
.PE</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-49.png" alt="Image img/pic-49.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
20-1: Diagonal arrows (dotted boxes show the implied
0.5-inch grid)</font></p>
<p style="margin-top: 1em"><font color="#000000">Here&rsquo;s
an example concocted to demonstrate layout of a large,
multiple-part pattern:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
define filter {box ht 0.25 rad 0.125} <br>
lineht = 0.25; <br>
Top: [ <br>
right; <br>
box &quot;\fBms\fR&quot; &quot;sources&quot;; <br>
move; <br>
box &quot;\fBHTML\fR&quot; &quot;sources&quot;; <br>
move; <br>
box &quot;\fBlinuxdoc-sgml\fP&quot; &quot;sources&quot; wid
1.5; <br>
move; <br>
box &quot;\fBTexinfo\fP&quot;
&quot;sources&quot;;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">line
down from 1st box .s lineht; <br>
A: line down; <br>
line down from 2nd box .s; filter &quot;\fBhtml2ms\fP&quot;;
<br>
B: line down; <br>
line down from 3rd box .s; filter &quot;\fBformat\fP&quot;;
<br>
C: line down; <br>
line down from 4th box .s; filter
&quot;\fBtexi2roff\fP&quot;; <br>
D: line down; <br>
] <br>
move down 1 from last [] .s; <br>
Anchor: box wid 1 ht 0.75 &quot;\fBms\fR&quot;
&quot;intermediate&quot; &quot;form&quot;; <br>
arrow from Top.A.end to Anchor.nw; <br>
arrow from Top.B.end to 1/3 of the way between Anchor.nw and
Anchor.ne; <br>
arrow from Top.C.end to 2/3 of the way between Anchor.nw and
Anchor.ne; <br>
arrow from Top.D.end to Anchor.ne <br>
{ <br>
# PostScript column <br>
move to Anchor .sw; <br>
line down left then down -&gt;; <br>
filter &quot;\fBpic\fP&quot;; <br>
arrow; <br>
filter &quot;\fBeqn\fP&quot;; <br>
arrow; <br>
filter &quot;\fBtbl\fP&quot;; <br>
arrow; <br>
filter &quot;\fBgroff\fP&quot;; <br>
arrow; <br>
box &quot;PostScript&quot;;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
HTML column <br>
move to Anchor .se; <br>
line down right then down -&gt;; <br>
A: filter dotted &quot;\fBpic2img\fP&quot;; <br>
arrow; <br>
B: filter dotted &quot;\fBeqn2html\fP&quot;; <br>
arrow; <br>
C: filter dotted &quot;\fBtbl2html\fP&quot;; <br>
arrow; <br>
filter &quot;\fBms2html\fP&quot;; <br>
arrow; <br>
box &quot;HTML&quot;;</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">#
Nonexistence caption <br>
box dashed wid 1 at B + (2,0) &quot;These tools&quot;
&quot;don&rsquo;t yet exist&quot;; <br>
line chop 0 chop 0.1 dashed from last box .nw to A.e -&gt;;
<br>
line chop 0 chop 0.1 dashed from last box .w to B.e -&gt;;
<br>
line chop 0 chop 0.1 dashed from last box .sw to C.e -&gt;;
<br>
} <br>
.PE</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-50.png" alt="Image img/pic-50.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
20-2: Hypothetical production flow for dual-mode
publishing</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-51.png" alt="Image img/pic-51.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
20-3: Three-dimensional Boxes</font></p>
<p style="margin-top: 1em"><font color="#000000">Here the
source code for figure 20-3:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
# a three-dimensional block <br>
# <br>
# tblock(&lt;width&gt;, &lt;height&gt;,
&lt;text&gt;)</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">define
tblock { [ <br>
box ht $2 wid $1 \ <br>
color &quot;gold&quot; outlined &quot;black&quot; \ <br>
xslanted 0 yslanted 0 \ <br>
$3; <br>
box ht .1 wid $1 \ <br>
color &quot;yellow&quot; outlined &quot;black&quot; \ <br>
xslanted .1 yslanted 0 \ <br>
with .sw at last box .nw; <br>
box ht $2 wid .1 \ <br>
color &quot;goldenrod&quot; outlined &quot;black&quot; \
<br>
xslanted 0 yslanted .1 \ <br>
with .nw at 2nd last box .ne; <br>
] }</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">tblock(1,
.5, &quot;Master&quot; &quot;1&quot;); <br>
move -.1 <br>
tblock(.5, 1, &quot;Slave&quot;); <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">Here is a
flow chart with source code to demonstrate how a polygon
attaches to other objects:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
down; <br>
h = 0.25; <br>
w = 0.375; <br>
l = 0.75; <br>
r = 0.1; <br>
box rad r fill 0.3 outlined &quot;green&quot;; <br>
&quot;Start&quot; at last box; <br>
arrow down l from last box.s; <br>
polygon \</font></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">down h right w \</font></p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">then down h left w \</font></p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">then up h left w \</font></p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">with .v1 at last arrow.end
\</font></p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="89%">
<p><font color="#000000">fill 0.3 outlined
&quot;blue&quot;;</font></p> </td></tr>
</table>
<p style="margin-left:28%;"><font color="#000000">&quot;Done?&quot;
at last polygon.c; <br>
arrow down l from last polygon.v3 &quot; Yes&quot; ljust;
<br>
box rad r fill 0.3 outlined &quot;green&quot;; <br>
&quot;End&quot; at last box.c; <br>
move to last polygon.v2; <br>
line right &quot;&quot; &quot;No&quot;; <br>
arrow up l - h/2 then left lineht + w; <br>
.PE</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-52.png" alt="Image img/pic-52.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
20-3: Flowchart for demonstrating polygon
attachment</font></p>
<hr>
[ <a href="pic-19.html">prev</a> | <a href="pic-21.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,875 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-21.html</title>
</head>
<hr>
[ <a href="pic-20.html">prev</a> | <a href="pic-22.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>21. PIC Reference
<a name="21. PIC Reference"></a>
</h2>
<p style="margin-top: 1em">This is an annotated grammar of
<b>pic</b>.</p>
<h3>21.1. Lexical Items
<a name="21.1. Lexical Items"></a>
</h3>
<p style="margin-top: 1em">In general, <b>pic</b> is a
free-format, token-oriented language that ignores whitespace
outside strings. But certain lines and constructs are
specially interpreted at the lexical level:</p>
<p style="margin-top: 1em">A comment begins with <b>#</b>
and continues to <b>\n</b> (comments may also follow text in
a line). A line beginning with a period or backslash may be
interpreted as text to be passed through to the
post-processor, depending on command-line options. An
end-of-line backslash is interpreted as a request to
continue the line; the backslash and following newline are
ignored.</p>
<p style="margin-left:28%; margin-top: 1em">Here are the
grammar terminals:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="7%">
<p style="margin-top: 1em"><small>INT</small></p></td>
<td width="4%"></td>
<td width="44%">
<p style="margin-top: 1em">A positive integer.</p></td>
<td width="34%">
</td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>NUMBER</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%"></td>
<td width="2%"></td>
<td width="78%">
<p>A floating point numeric constant. May contain a decimal
point or be expressed in scientific notation in the style of
<i>printf</i>(3)&rsquo;s %e escape. A trailing
&lsquo;i&rsquo; or &lsquo;I&rsquo; (indicating the unit
&lsquo;inch&rsquo;) is ignored.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p style="margin-top: 1em"><small>TEXT</small></p></td>
<td width="2%"></td>
<td width="78%">
<p style="margin-top: 1em">A string enclosed in double
quotes. A double quote within <small>TEXT</small> must be
preceded by a backslash. Instead of <small>TEXT</small> you
can use</p></td></tr>
</table>
<p style="margin-left:46%; margin-top: 1em">sprintf ( TEXT
[, &lt;expr&gt; ...] )</p>
<p style="margin-left:37%; margin-top: 1em">except after
the &lsquo;until&rsquo; and &lsquo;last&rsquo; keywords, and
after all ordinal keywords (&lsquo;th&rsquo; and
friends).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="18%">
<p style="margin-top: 1em"><small>VARIABLE</small></p></td>
<td width="71%">
</td></tr>
</table>
<p style="margin-left:37%;">A string starting with a
character from the set [a-z], optionally followed by one or
more characters of the set [a-zA-Z0-9_]. (Values of
variables are preserved across pictures.)</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="11%">
<p style="margin-top: 1em"><small>LABEL</small></p></td>
<td width="78%">
<p style="margin-top: 1em">A string starting with a
character from the set [A-Z], optionally followed by one or
more characters of the set [a-zA-Z0-9_].</p></td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>COMMAND-LINE</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="78%">
<p>A line starting with a command character
(&lsquo;.&rsquo; in groff mode, &lsquo;\&rsquo; in TeX
mode).</p> </td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>BALANCED-TEXT</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="78%">
<p>A string either enclosed by &lsquo;{&rsquo; and
&lsquo;}&rsquo; or with <i>X</i> and <i>X</i>, where
<i>X</i> doesn&rsquo;t occur in the string.</p></td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>BALANCED-BODY</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="78%">
<p>Delimiters as in <small>BALANCED-TEXT</small> ; the body
is interpreted as
&lsquo;<b>&lang;command&rang;...</b>&rsquo;.</p> </td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>FILENAME</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="78%">
<p>The name of a file. This has the same semantics as
<small>TEXT</small> .</p></td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em"><small>MACRONAME</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="57%">
<p>Either <small>VARIABLE</small> or <small>LABEL</small>
.</p> </td>
<td width="21%">
</td></tr>
</table>
<h3>21.2. Semi-Formal Grammar
<a name="21.2. Semi-Formal Grammar"></a>
</h3>
<p style="margin-top: 1em">Tokens not enclosed in
&lang;&rang; are literals, except:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">1.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em"><b>\n</b> is a newline.</p></td></tr>
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">2.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em">Three dots is a suffix meaning
&lsquo;replace with 0 or more repetitions of the preceding
element(s).</p> </td></tr>
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">3.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em">An enclosure in square brackets
has its usual meaning of &lsquo;this clause is
optional&rsquo;.</p> </td></tr>
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">4.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em">Square-bracket-enclosed portions
within tokens are optional. Thus, &lsquo;h[eigh]t&rsquo;
matches either &lsquo;height&rsquo; or &lsquo;ht&rsquo;.</p></td></tr>
</table>
<p style="margin-top: 1em">If one of these special tokens
has to be referred to literally, it is surrounded with
single quotes.</p>
<p style="margin-top: 1em">The top-level <b>pic</b> object
is a picture.</p>
<p style="margin-left:28%; margin-top: 1em">&lt;picture&gt;
::= <br>
.PS [NUMBER [NUMBER]]\n <br>
&lt;statement&gt; ... <br>
.PE \n</p>
<p style="margin-top: 1em">The arguments, if present,
represent the width and height of the picture, causing
<b>pic</b> to attempt to scale it to the given dimensions in
inches. In no case, however, the X and Y&nbsp;dimensions of
the picture exceed the values of the style variables
<b>maxpswid</b> and <b>maxpsheight</b> (which default to the
normal 8.5i by 11i page size).</p>
<p style="margin-top: 1em">If the ending &lsquo;.PE&rsquo;
is replaced by &lsquo;.PF&rsquo; or &lsquo;.PY&rsquo;, the
page vertical position is restored to its value at the time
&lsquo;.PS&rsquo; was encountered. Another alternate form of
invocation is &lsquo;.PS&nbsp;&lt; <small>FILENAME</small>
&rsquo;, which replaces the &lsquo;.PS&rsquo; line with a
file to be interpreted by <b>pic</b> (but this feature is
deprecated).</p>
<p style="margin-top: 1em">The &lsquo;.PS&rsquo;,
&lsquo;.PE&rsquo;, &lsquo;.PF&rsquo;, and &lsquo;.PY&rsquo;
macros to perform centering and scaling are normally
supplied by the post-processor.</p>
<p style="margin-top: 1em">In the following, either
&lsquo;|&rsquo; or a new line starts an alternative.</p>
<p style="margin-left:28%; margin-top: 1em">&lt;statement&gt;
::= <br>
&lt;command&gt; ; <br>
&lt;command&gt; \n <br>
&lt;command&gt; ::= <br>
&lt;primitive&gt; [&lt;attribute&gt;] <br>
LABEL : [;] &lt;command&gt; <br>
LABEL : [;] &lt;command&gt; [&lt;position&gt;] <br>
{ &lt;command&gt; ... } <br>
VARIABLE [:] = &lt;any-expr&gt; <br>
figname = MACRONAME <br>
up | down | left | right <br>
COMMAND-LINE <br>
command &lt;print-arg&gt; ... <br>
print &lt;print-arg&gt; ... <br>
sh BALANCED-TEXT <br>
copy FILENAME <br>
copy [FILENAME] thru MACRONAME [until TEXT] <br>
copy [FILENAME] thru BALANCED-BODY [until TEXT] <br>
for VARIABLE = &lt;expr&gt; to &lt;expr&gt; [by [*]
&lt;expr&gt;] do BALANCED-BODY <br>
if &lt;any-expr&gt; then BALANCED-BODY [else BALANCED-BODY]
<br>
reset [VARIABLE [[,] VARIABLE ...]] <br>
&lt;print-arg&gt; ::= <br>
TEXT <br>
&lt;expr&gt; <br>
&lt;position&gt;</p>
<p style="margin-top: 1em">The current position and
direction are saved on entry to a <br>
&lsquo;{&nbsp;...&nbsp;}&rsquo; construction and restored on
exit from it.</p>
<p style="margin-top: 1em">Note that in &lsquo;if&rsquo;
constructions, newlines can only occur in
<small>BALANCED-BODY</small> . This means that</p>
<p style="margin-left:28%; margin-top: 1em">if <br>
{ ... } <br>
else <br>
{ ... }</p>
<p style="margin-top: 1em">fails. You have to use the
braces on the same line as the keywords:</p>
<p style="margin-left:28%; margin-top: 1em">if { <br>
... <br>
} else { <br>
... <br>
}</p>
<p style="margin-top: 1em">This restriction doesn&rsquo;t
hold for the body after the &lsquo;do&rsquo; in a
&lsquo;for&rsquo; construction.</p>
<p style="margin-top: 1em">At the beginning of each
picture, &lsquo;figname&rsquo; is reset to the vbox name
&lsquo;graph&rsquo;; this command has only a meaning in TeX
mode. While the grammar rules allow digits and the
underscore in the value of &lsquo;figname&rsquo;, TeX
normally accepts uppercase and lowercase letters only as box
names (you have to use &lsquo;\csname&rsquo; if you really
need to circumvent this limitation).</p>
<p style="margin-left:28%; margin-top: 1em">&lt;any-expr&gt;
::= <br>
&lt;expr&gt; <br>
&lt;text-expr&gt; <br>
&lt;any-expr&gt; &lt;logical-op&gt; &lt;any-expr&gt; <br>
! &lt;any-expr&gt; <br>
&lt;logical-op&gt; ::= <br>
== | != | &amp;&amp; | &rsquo;||&rsquo; <br>
&lt;text-expr&gt; ::= <br>
TEXT == TEXT <br>
TEXT != TEXT</p>
<p style="margin-top: 1em">Logical operators are handled
specially by <b>pic</b> since they can deal with text
strings also. <b>pic</b> uses <i>strcmp</i>(3) to test for
equality of strings; an empty string is considered as
&lsquo;false&rsquo; for &lsquo;&amp;&amp;&rsquo; and
&lsquo;||&rsquo;.</p>
<p style="margin-left:28%; margin-top: 1em">&lt;primitive&gt;
::= <br>
box # closed object &mdash; rectangle <br>
circle # closed object &mdash; circle <br>
ellipse # closed object &mdash; ellipse <br>
polygon # closed object &mdash; polygon <br>
arc # open object &mdash; quarter-circle <br>
line # open object &mdash; line <br>
arrow # open object &mdash; line with arrowhead <br>
spline # open object &mdash; spline curve <br>
move <br>
TEXT TEXT ... # text within invisible box <br>
plot &lt;expr&gt; TEXT # formatted text <br>
&rsquo;[&rsquo; &lt;command&gt; ... &rsquo;]&rsquo;</p>
<p style="margin-top: 1em">Drawn objects within
&lsquo;[&nbsp;...&nbsp;]&rsquo; are treated as a single
composite object with a rectangular shape (that of the
bounding box of all the elements). Variable and label
assignments within a block are local to the block. Current
direction of motion is restored to the value at start of
block upon exit. Position is <i>not</i> restored (unlike
&lsquo;{&nbsp;}&rsquo;); instead, the current position
becomes the exit position for the current direction on the
block&rsquo;s bounding box.</p>
<p style="margin-left:28%; margin-top: 1em">&lt;attribute&gt;
::= <br>
h[eigh]t &lt;expr&gt; # set height of closed figure <br>
wid[th] &lt;expr&gt; # set width of closed figure <br>
rad[ius] &lt;expr&gt; # set radius of circle/arc <br>
diam[eter] &lt;expr&gt; # set diameter of circle/arc <br>
up [&lt;expr&gt;] # move up <br>
down [&lt;expr&gt;] # move down <br>
left [&lt;expr&gt;] # move left <br>
right [&lt;expr&gt;] # move right <br>
from &lt;position&gt; # set from position of open figure
<br>
to &lt;position&gt; # set to position of open figure <br>
at &lt;position&gt; # set center of open figure <br>
with &lt;path&gt; # fix corner/named point at specified
location <br>
with &lt;position&gt; # fix position of object at specified
location <br>
by &lt;expr-pair&gt; # set object&rsquo;s attachment point
<br>
then # sequential segment composition <br>
dotted [&lt;expr&gt;] # set dotted line style <br>
dashed [&lt;expr&gt;] # set dashed line style <br>
thick[ness] &lt;expr&gt; # set thickness of lines <br>
chop [&lt;expr&gt;] # chop end(s) of segment <br>
&rsquo;-&gt;&rsquo; | &rsquo;&lt;-&rsquo; |
&rsquo;&lt;-&gt;&rsquo; # decorate with arrows <br>
invis[ible] # make primitive invisible <br>
solid # set solid line style <br>
fill[ed] [&lt;expr&gt;] # fill closed figure with optional
density <br>
xscaled &lt;expr&gt; # slant box into x direction <br>
yscaled &lt;expr&gt; # slant box into y direction <br>
colo[u]r[ed] TEXT # set fill and outline color for figure
<br>
outline[d] TEXT # set outline color for figure <br>
shaded TEXT # set fill color for figure <br>
same # copy size of previous object <br>
cw | ccw # set orientation of curves <br>
ljust | rjust # adjust text horizontally <br>
above | below # adjust text vertically <br>
aligned # align parallel to object <br>
TEXT TEXT ... # text within object <br>
&lt;expr&gt; # motion in the current direction</p>
<p style="margin-top: 1em">Missing attributes are supplied
from defaults; inappropriate ones are silently ignored. For
lines, splines, and arcs, height and width refer to
arrowhead size.</p>
<p style="margin-top: 1em">The &lsquo;at&rsquo; primitive
sets the center of the current object. The
&lsquo;with&rsquo; attribute fixes the specified feature of
the given object to a specified location. (Note that
&lsquo;with&rsquo; is incorrectly described in the Kernighan
paper.)</p>
<p style="margin-top: 1em">The &lsquo;by&rsquo; primitive
is not documented in the tutorial portion of the Kernighan
paper, and should probably be considered unreliable.</p>
<p style="margin-top: 1em">The primitive
&lsquo;arrow&rsquo; is a synonym for
&lsquo;line&nbsp;-&gt;&rsquo;.</p>
<p style="margin-top: 1em">Text is normally an attribute of
some object, in which case successive strings are vertically
stacked and centered on the object&rsquo;s center by
default. Standalone text is treated as though placed in an
invisible box.</p>
<p style="margin-top: 1em">A text item consists of a string
or sprintf-expression, optionally followed by positioning
information. Text (or strings specified with
&lsquo;sprintf&rsquo;) may contain font changes, size
changes, and local motions, provided those changes are
undone before the end of the current item. Text may also
contain \-escapes denoting special characters. The base font
and specific set of escapes supported is implementation
dependent, but supported escapes always include the
following:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fR, \f1</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Roman style (the
default)</p> </td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fI, \f2</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Italic style</p></td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fB, \f3</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Bold style</p></td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fP</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Revert to previous style; only
works one level deep, does not stack.</p></td></tr>
</table>
<p style="margin-top: 1em">Color names are dependent on the
pic implementation, but in all modern versions color names
recognized by the X&nbsp;window system are supported.</p>
<p style="margin-top: 1em">A position is an (x,y)
coordinate pair. There are lots of different ways to specify
positions:</p>
<p style="margin-left:28%; margin-top: 1em">&lt;position&gt;
::= <br>
&lt;position-not-place&gt; <br>
&lt;place&gt; <br>
( &lt;position&gt; ) <br>
&lt;position-not-place&gt; ::= <br>
&lt;expr-pair&gt; <br>
&lt;position&gt; + &lt;expr-pair&gt; <br>
&lt;position&gt; - &lt;expr-pair&gt; <br>
( &lt;position&gt; , &lt;position&gt; ) <br>
&lt;expr&gt; [of the way] between &lt;position&gt; and
&lt;position&gt; <br>
&lt;expr&gt; &rsquo;&lt;&rsquo; &lt;position&gt; ,
&lt;position&gt; &rsquo;&gt;&rsquo; <br>
&lt;expr-pair&gt; ::= <br>
&lt;expr&gt; , &lt;expr&gt; <br>
( expr-pair ) <br>
&lt;place&gt; ::= <br>
&lt;label&gt; <br>
&lt;label&gt; &lt;corner&gt; <br>
&lt;label&gt; &lt;reference-point&gt; <br>
&lt;corner&gt; [of] &lt;label&gt; <br>
&lt;reference-point&gt; of &lt;label&gt; <br>
Here <br>
&lt;label&gt; ::= <br>
LABEL [. LABEL ...] <br>
&lt;nth-primitive&gt; <br>
&lt;corner&gt; ::= <br>
.n | .e | .w | .s <br>
.ne | .se | .nw | .sw <br>
.c[enter] | .start | .end <br>
.t[op] | .b[ot[tom]] | .l[eft] | .r[ight] <br>
left | right | &lt;top-of&gt; | &lt;bottom-of&gt; <br>
&lt;north-of&gt; | &lt;south-of&gt; | &lt;east-of&gt; |
&lt;west-of&gt; <br>
&lt;center-of&gt; | &lt;start-of&gt; | &lt;end-of&gt; <br>
upper left | lower left | upper right | lower right <br>
&lt;reference-point&gt; ::= <br>
.v[er[tex]] &lt;expr&gt; <br>
.v[er[tex]] ` &lt;expr&gt; ' <br>
.mid[point] &lt;expr&gt; <br>
.mid[point] ` &lt;expr&gt; ' <br>
&lt;<i>xxx</i>-of&gt; ::= <i><br>
xxx</i> # followed by &lsquo;of&rsquo; <br>
&lt;nth-primitive&gt; ::= <br>
&lt;ordinal&gt; &lt;object-type&gt; <br>
[&lt;ordinal&gt;] last &lt;object-type&gt; <br>
&lt;ordinal&gt; ::= <br>
INT th <br>
INT st | INT nd | INT rd <br>
` &lt;any-expr&gt; 'th <br>
&lt;object-type&gt; ::= <br>
box <br>
circle <br>
ellipse <br>
polygon <br>
arc <br>
line <br>
arrow <br>
spline <br>
&rsquo;[]&rsquo; <br>
TEXT</p>
<p style="margin-top: 1em">As Kernighan notes, &ldquo;since
barbarisms like <b>1th</b> and <b>3th</b> are barbaric,
synonyms like <b>1st</b> and <b>3rd</b> are accepted as
well.&rdquo; Objects of a given type are numbered from 1
upward in order of declaration; the <b>last</b> modifier
counts backward.</p>
<p style="margin-top: 1em">The &ldquo;'th&rdquo; form
(which allows you to select a previous object with an
expression, as opposed to a numeric literal) is not
documented in DWB&rsquo;s <i>pic</i>(1).</p>
<p style="margin-top: 1em">The &lang;<i>xxx</i>-of&rang;
rule is special: The lexical parser checks whether
<i>xxx</i> is followed by the token &lsquo;of&rsquo; without
eliminating it so that the grammar parser can still see
&lsquo;of&rsquo;. Valid examples of specifying a place with
corner and label are thus</p>
<p style="margin-left:28%; margin-top: 1em">A .n <br>
.n of A <br>
.n A <br>
north of A</p>
<p style="margin-top: 1em">while</p>
<p style="margin-left:28%; margin-top: 1em">north A <br>
A north</p>
<p style="margin-top: 1em">both cause a syntax error. (DWB
<b>pic</b> also allows the weird form
&lsquo;A&nbsp;north&nbsp;of&rsquo;.)</p>
<p style="margin-top: 1em">Here the special rules for the
&lsquo;with&rsquo; keyword using a path:</p>
<p style="margin-left:28%; margin-top: 1em">&lt;path&gt;
::= <br>
&lt;relative-path&gt; <br>
( &lt;relative-path&gt; , &lt;relative-path&gt; ) <br>
&lt;relative-path&gt; ::= <br>
&lt;corner&gt; <br>
. LABEL [. LABEL ...] [&lt;corner&gt;]</p>
<p style="margin-top: 1em">The following style variables
control output:</p>
<p align="center"><img src="img/pic-53.png" alt="Image img/pic-53.png"></p>
<p style="margin-top: 1em">Any of these can be set by
assignment, or reset using the <b>reset</b> statement. Style
variables assigned within &lsquo;[&nbsp;]&rsquo; blocks are
restored to their beginning-of-block value on exit;
top-level assignments persist across pictures. Dimensions
are divided by <b>scale</b> on output.</p>
<p style="margin-top: 1em">All <b>pic</b> expressions are
evaluated in floating point; units are always inches (a
trailing &lsquo;i&rsquo; or &lsquo;I&rsquo; is ignored).
Expressions have the following simple grammar, with
semantics very similar to C&nbsp;expressions:</p>
<p style="margin-left:28%; margin-top: 1em">&lt; <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
: <br>
: <br>
= <br>
V <br>
A <br>
R <br>
I <br>
A <br>
B <br>
L <br>
E <br>
N <br>
U <br>
M <br>
B <br>
E <br>
R <br>
&lt; <br>
p <br>
l <br>
a <br>
c <br>
e <br>
&gt; <br>
&lt; <br>
p <br>
l <br>
a <br>
c <br>
e <br>
- <br>
a <br>
t <br>
t <br>
r <br>
i <br>
b <br>
u <br>
t <br>
e <br>
&gt; <br>
&lt; <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
&lt; <br>
o <br>
p <br>
&gt; <br>
&lt; <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
- <br>
&lt; <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
( <br>
&lt; <br>
a <br>
n <br>
y <br>
- <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
) <br>
! <br>
&lt; <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
&lt; <br>
f <br>
u <br>
n <br>
c <br>
1 <br>
&gt; <br>
( <br>
&lt; <br>
a <br>
n <br>
y <br>
- <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
) <br>
&lt; <br>
f <br>
u <br>
n <br>
c <br>
2 <br>
&gt; <br>
( <br>
&lt; <br>
a <br>
n <br>
y <br>
- <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
, <br>
&lt; <br>
a <br>
n <br>
y <br>
- <br>
e <br>
x <br>
p <br>
r <br>
&gt; <br>
) <br>
r <br>
a <br>
n <br>
d <br>
( <br>
) <br>
&lt;place-attribute&gt; <br>
.x | .y | .h[eigh]t | .wid[th] | .rad <br>
&lt;op&gt; ::= <br>
+ | - | * | / | % | ˆ | &rsquo;&lt;&rsquo; |
&rsquo;&gt;&rsquo; | &rsquo;&lt;=&rsquo; |
&rsquo;&gt;=&rsquo; <br>
&lt;func1&gt; ::= <br>
sin | cos | log | exp | sqrt | int | rand | srand <br>
&lt;func2&gt; ::= <br>
atan2 | max | min</p>
<p style="margin-top: 1em">Both <b>exp</b> and <b>log</b>
are base 10; <b>int</b> does integer truncation; and
<b>rand()</b> returns a random number in [0-1).</p>
<p style="margin-top: 1em">There are <b>define</b> and
<b>undef</b> statements which are not part of the grammar
(they behave as pre-processor macros to the language). These
may be used to define pseudo-functions.</p>
<p style="margin-left:28%; margin-top: 1em"><b>define</b>
<i>name</i> <b>{</b> <i>replacement-text</i> <b>}</b></p>
<p style="margin-top: 1em">This defines <i>name</i> as a
macro to be replaced by the replacement text (not including
the braces). The macro may be called as</p>
<p style="margin-left:28%; margin-top: 1em"><i>name</i><b>(</b><i>arg1,
arg2, ..., argn</i><b>)</b></p>
<p style="margin-top: 1em">The arguments (if any) are
substituted for tokens $1, $2 ... $n appearing in the
replacement text. To undefine a macro, say <b>undef</b>
<i>name</i>, specifying the name to be undefined.</p>
<hr>
[ <a href="pic-20.html">prev</a> | <a href="pic-22.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,66 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-22.html</title>
</head>
<hr>
[ <a href="pic-21.html">prev</a> | <a href="pic-23.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>22. History and Acknowledgements
<a name="22. History and Acknowledgements"></a>
</h2>
<p style="margin-top: 1em">Original <b>pic</b> was written
to go with Joseph Ossanna&rsquo;s original <i>troff</i>(1)
by Brian Kernighan, and later re-written by Kernighan with
substantial enhancements (apparently as part of the
evolution of <i>troff</i>(1) into <i>ditroff</i>(1) to
generate device-independent output).</p>
<p style="margin-top: 1em">The language had been inspired
by some earlier graphics languages including <b>ideal</b>
and <b>grap</b>. Kernighan credits Chris van Wyk (the
designer of <b>ideal</b>) with many of the ideas that went
into <b>pic</b>.</p>
<p style="margin-top: 1em">The <b>pic</b> language was
originally described by Brian Kernighan in Bell Labs
Computing Science Technical Report #116 (you can obtain a
PostScript copy of the revised version, [1], by sending a
mail message to <i>netlib@research.att.com</i> with a body
of &lsquo;send 116 from research/cstr&rsquo;). There have
been two revisions, in 1984 and 1991.</p>
<p style="margin-top: 1em">The document you are reading
effectively subsumes Kernighan&rsquo;s description; it was
written to fill in lacun&aelig; in the exposition and
integrate in descriptions of the GNU <i>gpic</i>(1) and
<i>pic2plot</i>(1) features.</p>
<p style="margin-top: 1em">The GNU <b>gpic</b>
implementation was written by James Clark
&lang;<i>jjc@jclark.com</i>&rang;.</p>
<p style="margin-top: 1em">The GNU <b>pic2plot</b>
implementation is based on James Clark&rsquo;s parser code
and maintained by Robert Maier, principal author of
<b>plotutils</b>.</p>
<hr>
[ <a href="pic-21.html">prev</a> | <a href="pic-23.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,59 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-23.html</title>
</head>
<hr>
[ <a href="pic-22.html">prev</a> | <a href="pic.html">top</a> ]
<hr>
<h2>23. Bibliography
<a name="23. Bibliography"></a>
</h2>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">1.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em">Kernighan, B. W. <b>PIC &mdash;
A Graphics Language for Typesetting (Revised User
Manual)</b>. Bell Labs Computing Science Technical Report
#116, December 1991.</p></td></tr>
<tr valign="top" align="left">
<td width="4%">
<p style="margin-top: 1em">2.</p></td>
<td width="7%"></td>
<td width="89%">
<p style="margin-top: 1em">Van Wyk, C. J. <b>A high-level
language for specifying pictures</b>. <i>ACM Transactions On
Graphics</i> 1,2 (1982) 163-182.</p></td></tr>
</table>
<hr>
[ <a href="pic-22.html">prev</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,214 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-3.html</title>
</head>
<hr>
[ <a href="pic-2.html">prev</a> | <a href="pic-4.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>3. Basic PIC Concepts
<a name="3. Basic PIC Concepts"></a>
</h2>
<p style="margin-top: 1em">Pictures are described
procedurally, as collections of objects connected by
motions. Normally, <b>pic</b> tries to string together
objects left-to-right in the sequence they are described,
joining them at visually natural points. Here is an example
illustrating the flow of data in <b>pic</b> processing:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-1.png" alt="Image img/pic-1.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-1: Flow
of <b>pic</b> data</p>
<p style="margin-top: 1em">This was produced from the
following <b>pic</b> program:</p>
<p style="margin-left:9%; margin-top: 1em">.PS <br>
ellipse &quot;document&quot;; <br>
arrow; <br>
box width 0.6 &quot;\fIgpic\/\fP(1)&quot; <br>
arrow; <br>
box width 1.1 &quot;\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)&quot;
&quot;(optional)&quot; dashed; <br>
arrow; <br>
box width 0.6 &quot;\fIgtroff\/\fP(1)&quot;; <br>
arrow; <br>
ellipse &quot;PostScript&quot; <br>
.PE</p>
<p style="margin-top: 1em">This little program illustrates
several <b>pic</b> basics. Firstly, we see how to invoke
three object types; ellipses, arrows, and boxes. We see how
to declare text lines to go within an object (and that text
can have font changes in it). We see how to change the line
style of an object from solid (the default) to dashed. And
we see that a box can be made wider than its default size to
accommodate more text (we&rsquo;ll discuss this facility in
detail in the next section).</p>
<p style="margin-top: 1em">We also get to see
<b>pic</b>&rsquo;s simple syntax. Statements are ended by
newlines or semicolons. String quotes are required around
all text arguments, whether or not they contain spaces. In
general, the order of command arguments and modifiers like
&ldquo;width 1.2&rdquo; or &ldquo;dashed&rdquo;
doesn&rsquo;t matter, except that the order of text
arguments is significant.</p>
<p style="margin-top: 1em">Here are all but two of the
basic <b>pic</b> objects at their default sizes:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-2.png" alt="Image img/pic-2.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-2: Basic
<b>pic</b> objects</p>
<p style="margin-top: 1em">The missing simple object types
are <i>spline</i> and <i>polygon</i>. There is also a way to
collect objects into <i>block composites</i> which allows
you to treat the whole group as a single object (resembling
a box) for many purposes. We&rsquo;ll describe all of these
later on.</p>
<p style="margin-top: 1em">The box, ellipse, circle, and
block composite objects are <i>closed</i>; lines, arrows,
arcs and splines are <i>open</i>. Polygons are a special
case drawn using the syntax of open objects, but with most
of the attributes of closed objects. This distinction is
often important in explaining command modifiers.</p>
<p style="margin-top: 1em">Figure 3-2 was produced by the
following <b>pic</b> program, which introduces some more
basic concepts:</p>
<p style="margin-left:9%; margin-top: 1em">.PS <br>
box &quot;box&quot;; <br>
move; <br>
line &quot;line&quot; &quot;&quot;; <br>
move; <br>
arrow &quot;arrow&quot; &quot;&quot;; <br>
move; <br>
circle &quot;circle&quot;; <br>
move; <br>
ellipse &quot;ellipse&quot;; <br>
move; <br>
arc; down; move; &quot;arc&quot; <br>
.PE</p>
<p style="margin-top: 1em">The first thing to notice is the
<i>move</i> command, which moves a default distance (1/2
inch) in the current movement direction.</p>
<p style="margin-top: 1em">Secondly, see how we can also
decorate lines and arrows with text. The line and arrow
commands each take two arguments here, specifying text to go
above and below the object. If you wonder why one argument
would not do, contemplate the output of <b>arrow
&quot;ow!&quot;</b>:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-3.png" alt="Image img/pic-3.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-3: Text
centered on an arrow</p>
<p style="margin-top: 1em">When a command takes one text
string, <b>pic</b> tries to place it at the object&rsquo;s
geometric center. As you add more strings, <b>pic</b> treats
them as a vertical block to be centered. The program</p>
<p style="margin-left:9%; margin-top: 1em">line
&quot;1&quot;; <br>
line &quot;1&quot; &quot;2&quot;; <br>
line &quot;1&quot; &quot;2&quot; &quot;3&quot;; <br>
line &quot;1&quot; &quot;2&quot; &quot;3&quot;
&quot;4&quot;; <br>
line &quot;1&quot; &quot;2&quot; &quot;3&quot; &quot;4&quot;
&quot;5&quot;;</p>
<p style="margin-top: 1em">for example, gives you this:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-4.png" alt="Image img/pic-4.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-4:
Effects of multiple text arguments</p>
<p style="margin-top: 1em">The last line of Figure
3-2&rsquo;s program, &lsquo;<b>arc; down; move;
&quot;arc&quot;</b>&rsquo;, describing the captioned arc,
introduces several new ideas. Firstly, we see how to change
the direction in which objects are joined. Had we written
<b>arc; move; &quot;arc&quot;</b>, omitting <b>down</b> the
caption would have been joined to the top of the arc, like
this:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-5.png" alt="Image img/pic-5.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-5:
Result of <b>arc; move; &quot;arc&quot;</b></p>
<p style="margin-top: 1em">This is because drawing an arc
changes the default direction to the one its exit end points
at. To reinforce this point, consider:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-6.png" alt="Image img/pic-6.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-6:
Result of <b>arc cw; move; &quot;arc&quot;</b></p>
<p style="margin-top: 1em">All we&rsquo;ve done differently
here is specify &ldquo;cw&rdquo; for a clockwise arc
(&ldquo;ccw&rdquo; specifies counter-clockwise direction).
Observe how it changes the default direction to down, rather
than up.</p>
<p style="margin-top: 1em">Another good way to see this via
with the following program:</p>
<p style="margin-left:9%; margin-top: 1em">line; arc; arc
cw; line</p>
<p style="margin-top: 1em">which yields:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-7.png" alt="Image img/pic-7.png"></p>
<p align="center" style="margin-top: 1em">Figure 3-7:
Result of <b>line; arc; arc cw; line</b></p>
<p style="margin-top: 1em">Notice that we did not have to
specify &ldquo;up&rdquo; for the second arc to be joined to
the end of the first.</p>
<p style="margin-top: 1em">Finally, observe that a string,
alone, is treated as text to be surrounded by an invisible
box of a size either specified by width and height
attributes or by the defaults <b>textwid</b> and
<b>textht</b>. Both are initially zero (because we
don&rsquo;t know the default font size).</p>
<hr>
[ <a href="pic-2.html">prev</a> | <a href="pic-4.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,168 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-4.html</title>
</head>
<hr>
[ <a href="pic-3.html">prev</a> | <a href="pic-5.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>4. Sizes and Spacing
<a name="4. Sizes and Spacing"></a>
</h2>
<p style="margin-top: 1em">Sizes are specified in inches.
If you don&rsquo;t like inches, it&rsquo;s possible to set a
global style variable <b>scale</b> that changes the unit.
Setting <b>scale = 2.54</b> effectively changes the internal
unit to centimeters (all other size variable values are
scaled correspondingly).</p>
<h3>4.1. Default Sizes of Objects
<a name="4.1. Default Sizes of Objects"></a>
</h3>
<p style="margin-top: 1em">Here are the default sizes for
<b>pic</b> objects:</p>
<p align="center"><img src="img/pic-8.png" alt="Image img/pic-8.png"></p>
<p style="margin-top: 1em">The simplest way to think about
these defaults is that they make the other basic objects fit
snugly into a default-sized box.</p>
<p style="margin-top: 1em"><i>pic2plot</i>(1) does not
necessarily emit a physical inch for each virtual inch in
its drawing coordinate system. Instead, it draws on a canvas
8&nbsp;virtual inches by 8&nbsp;virtual inches wide. If its
output page size is &ldquo;letter&rdquo;, these virtual
inches will map to real ones. Specifying a different page
size (such as, say, &ldquo;a4&rdquo;) will scale virtual
inches so they are output as one eighth of the page width.
Also, <i>pic2plot</i>(1) centers all images by default,
though the <b>&minus;n</b> option can be used to prevent
this.</p>
<h3>4.2. Objects Do Not Stretch!
<a name="4.2. Objects Do Not Stretch!"></a>
</h3>
<p style="margin-top: 1em">Text is rendered in the current
font with normal troff line spacing. Boxes, circles, and
ellipses do <i>not</i> automatically resize to fit enclosed
text. Thus, if you say <b>box &quot;this text far too long
for a default box&quot;</b> you&rsquo;ll get this:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-9.png" alt="Image img/pic-9.png"></p>
<p align="center" style="margin-top: 1em">F i g u r e 4 - 1
: B o x e s d o n o t a u t o m a t i c a l l y r e s i z
e</p>
<p style="margin-top: 1em">which is probably not the effect
you want.</p>
<h3>4.3. Resizing Boxes
<a name="4.3. Resizing Boxes"></a>
</h3>
<p style="margin-top: 1em">To change the box size, you can
specify a box width with the &ldquo;width&rdquo;
modifier:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-10.png" alt="Image img/pic-10.png"></p>
<p align="center" style="margin-top: 1em">Figure 4-2:
Result of <b>box width 3 &quot;text far too
long&quot;</b></p>
<p style="margin-top: 1em">This modifier takes a dimension
in inches. There is also a &ldquo;height&rdquo; modifier
that changes a box&rsquo;s height. The <b>width</b> keyword
may be abbreviated to <b>wid</b>; the <b>height</b> keyword
to <b>ht</b>.</p>
<h3>4.4. Resizing Other Object Types
<a name="4.4. Resizing Other Object Types"></a>
</h3>
<p style="margin-top: 1em">To change the size of a circle,
give it a <b>rad[ius]</b> or <b>diam[eter]</b> modifier;
this changes the radius or diameter of the circle, according
to the numeric argument that follows.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-11.png" alt="Image img/pic-11.png"></p>
<p align="center" style="margin-top: 1em">Figure 4-3:
Circles with increasing radii</p>
<p style="margin-top: 1em">The <b>move</b> command can also
take a dimension, which just tells it how many inches to
move in the current direction.</p>
<p style="margin-top: 1em">Ellipses are sized to fit in the
rectangular box defined by their axes, and can be resized
with <b>width</b> and <b>height</b> like boxes.</p>
<p style="margin-top: 1em">You can also change the radius
of curvature of an arc with <b>rad[ius]</b> (which specifies
the radius of the circle of which the arc is a segment).
Larger values yield flatter arcs.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-12.png" alt="Image img/pic-12.png"></p>
<p align="center" style="margin-top: 1em">Figure 4-4:
<b>arc rad</b> with increasing radii</p>
<p style="margin-top: 1em">Observe that because an arc is
defined as a quarter circle, increasing the radius also
increases the size of the arc&rsquo;s bounding box.</p>
<h3>4.5. The &lsquo;same&rsquo; Keyword
<a name="4.5. The &lsquo;same&rsquo; Keyword"></a>
</h3>
<p style="margin-top: 1em">In place of a dimension
specification, you can use the keyword <b>same</b>. This
gives the object the same size as the previous one of its
type. As an example, the program</p>
<p style="margin-left:28%; margin-top: 1em">.PS <br>
box; box wid 1 ht 1; box same; box <br>
.PE</p>
<p style="margin-top: 1em">gives you</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-13.png" alt="Image img/pic-13.png"></p>
<p align="center" style="margin-top: 1em">Figure 4-5: The
<b>same</b> keyword</p>
<hr>
[ <a href="pic-3.html">prev</a> | <a href="pic-5.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,120 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-5.html</title>
</head>
<hr>
[ <a href="pic-4.html">prev</a> | <a href="pic-6.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>5. Generalized Lines and Splines
<a name="5. Generalized Lines and Splines"></a>
</h2>
<h3>5.1. Diagonal Lines
<a name="5.1. Diagonal Lines"></a>
</h3>
<p style="margin-top: 1em">It is possible to specify
diagonal lines or arrows by adding multiple <b>up</b>,
<b>down</b>, <b>left</b>, and <b>right</b> modifiers to the
line object. Any of these can have a multiplier. To
understand the effects, think of the drawing area as being
gridded with standard-sized boxes.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-14.png" alt="Image img/pic-14.png"></p>
<p align="center" style="margin-top: 1em">Figure 5-1:
Diagonal arrows (dotted boxes show the implied 0.5-inch
grid)</p>
<h3>5.2. Multi-Segment Line Objects
<a name="5.2. Multi-Segment Line Objects"></a>
</h3>
<p style="margin-top: 1em">A &ldquo;line&rdquo; or
&ldquo;arrow&rdquo; object may actually be a path consisting
of any number of segments of varying lengths and directions.
To describe a path, connect several line or arrow commands
with the keyword <b>then</b>.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-15.png" alt="Image img/pic-15.png"></p>
<p align="center" style="margin-top: 1em">Figure 5-2:
<b>line right 1 then down .5 left 1 then right 1</b></p>
<p style="margin-top: 1em">If a path starts with
<b>then</b>, the first segment is assumed to be into the
current direction, using the default length.</p>
<h3>5.3. Spline Objects
<a name="5.3. Spline Objects"></a>
</h3>
<p style="margin-top: 1em">If you start a path with the
<b>spline</b> keyword, the path vertices are treated as
control points for a spline curve fit.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-16.png" alt="Image img/pic-16.png"></p>
<p align="center" style="margin-top: 1em">Figure 5-3:
<b>spline right 1 then down .5 left 1 then right 1</b></p>
<p style="margin-top: 1em">You can describe many
natural-looking but irregular curves this way. For
example:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-17.png" alt="Image img/pic-17.png"></p>
<p align="center" style="margin-top: 1em">Figure 5-4: Two
more spline examples</p>
<p style="margin-top: 1em">Note the arrow decorations.
Arrowheads can be applied naturally to any path-based
object, line or spline. We&rsquo;ll see how in the next
section.</p>
<h3>5.4. Polygon Objects
<a name="5.4. Polygon Objects"></a>
</h3>
<p style="margin-top: 1em">GNU <b>gpic</b> supports
arbitrary polygons constructed with the same syntax as
multi-segment lines. The final line segment connecting back
to the starting point is included automatically and should
be omitted.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-18.png" alt="Image img/pic-18.png"></p>
<p align="center" style="margin-top: 1em">Figure 5-5:
<b>polygon up 1 then down 0.5 right 1</b></p>
<p style="margin-top: 1em">Polygons are decorated like
closed objects as described in the next section.</p>
<hr>
[ <a href="pic-4.html">prev</a> | <a href="pic-6.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,328 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-6.html</title>
</head>
<hr>
[ <a href="pic-5.html">prev</a> | <a href="pic-7.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>6. Decorating Objects
<a name="6. Decorating Objects"></a>
</h2>
<h3>6.1. Text Special Effects
<a name="6.1. Text Special Effects"></a>
</h3>
<p style="margin-top: 1em">All <b>pic</b> implementations
support the following font-styling escapes within text
objects:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fR, \f1</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Roman style (the
default)</p> </td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fI, \f2</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Italic style</p></td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fB, \f3</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Set Bold style</p></td></tr>
<tr valign="top" align="left">
<td width="18%">
<p style="margin-top: 1em">\fP</p></td>
<td width="4%"></td>
<td width="78%">
<p style="margin-top: 1em">Revert to previous style; only
works one level deep, does not stack.</p></td></tr>
</table>
<p style="margin-top: 1em">In the <b>pic</b>
implementations that are preprocessors for a toolchain that
include <b>[gtn]roff</b>, text objects may also contain
<b>[gtn]roff</b> vertical- and horizontal-motion escapes
such as \h or \v. Troff special glyphs are also available.
All \-escapes will be passed through to the postprocessing
stage and have their normal effects. The base font family is
set by the <b>[gtn]roff</b> environment at the time the
picture is rendered.</p>
<p style="margin-top: 1em"><b>pic2plot</b> replaces
<b>[gtn]roff</b> horizontal- and vertical-motion escapes
with \-escapes of its own. Troff special glyphs are not
available, but in most back ends Latin-1 special characters
and a square-root radical will be. See the <b>pic2plot</b>
documentation for full details.</p>
<h3>6.2. Dashed Objects
<a name="6.2. Dashed Objects"></a>
</h3>
<p style="margin-top: 1em">We&rsquo;ve already seen that
the modifier <b>dashed</b> can change the line style of an
object from solid to dashed. GNU <b>gpic</b> permits you to
dot or dash ellipses, circles, and arcs (and splines in TeX
mode only); some versions of DWB may only permit dashing of
lines and boxes. It&rsquo;s possible to change the dash
interval by specifying a number after the modifier.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-19.png" alt="Image img/pic-19.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-1:
Dashed objects</p>
<h3>6.3. Dotted Objects
<a name="6.3. Dotted Objects"></a>
</h3>
<p style="margin-top: 1em">Another available qualifier is
<b>dotted</b>. GNU <b>gpic</b> permits you to dot or dash
ellipses, circles, and arcs (and splines in TeX mode only);
some versions of DWB may only permit dashing of lines and
boxes. It too can be suffixed with a number to specify the
interval between dots:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-20.png" alt="Image img/pic-20.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-2:
Dotted objects</p>
<h3>6.4. Rounding Box Corners
<a name="6.4. Rounding Box Corners"></a>
</h3>
<p style="margin-top: 1em">It is also possible, in GNU
<b>gpic</b> only, to modify a box so it has rounded
corners:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-21.png" alt="Image img/pic-21.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-3:
<b>box rad</b> with increasing radius values</p>
<p style="margin-top: 1em">Radius values higher than half
the minimum box dimension are silently truncated to that
value.</p>
<h3>6.5. Slanted Boxes
<a name="6.5. Slanted Boxes"></a>
</h3>
<p style="margin-top: 1em">GNU <b>gpic</b> supports slanted
boxes:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-22.png" alt="Image img/pic-22.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-4:
Various slanted boxes.</p>
<p style="margin-top: 1em">The <b>xslanted</b> and
<b>yslanted</b> attributes specify the x and y&nbsp;offset,
respectively, of the box&rsquo;s upper right corner from its
default position.</p>
<h3>6.6. Arrowheads
<a name="6.6. Arrowheads"></a>
</h3>
<p style="margin-top: 1em">Lines and arcs can be decorated
as well. Any line or arc (and any spline as well) can be
decorated with arrowheads by adding one or more as
modifiers:</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-23.png" alt="Image img/pic-23.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-5:
Double-headed line made with <b>line &lt;- -&gt;</b></p>
<p style="margin-top: 1em">In fact, the <b>arrow</b>
command is just shorthand for <b>line -&gt;</b>. And there
is a double-head modifier &lt;-&gt;, so the figure above
could have been made with <b>line &lt;-&gt;</b>.</p>
<p style="margin-top: 1em">Arrowheads have a <b>width</b>
attribute, the distance across the rear; and a <b>height</b>
attribute, the length of the arrowhead along the shaft.</p>
<p style="margin-top: 1em">Arrowhead style is controlled by
the style variable <b>arrowhead</b>. The DWB and GNU
versions interpret it differently. DWB defaults to open
arrowheads and an <b>arrowhead</b> value of&nbsp;2; the
Kernighan paper says a value of&nbsp;7 makes solid
arrowheads. GNU <b>gpic</b> defaults to solid arrowheads and
an <b>arrowhead</b> value of&nbsp;1; a value of&nbsp;0
produces open arrowheads. Note that solid arrowheads are
always filled with the current outline color.</p>
<h3>6.7. Line Thickness
<a name="6.7. Line Thickness"></a>
</h3>
<p style="margin-top: 1em">It&rsquo;s also possible to
change the line thickness of an object (this is a GNU
extension, DWB <b>pic</b> doesn&rsquo;t support it). The
default thickness of the lines used to draw objects is
controlled by the <b>linethick</b> variable. This gives the
thickness of lines in points. A negative value means use the
default thickness: in TeX output mode, this means use a
thickness of 8 milliinches; in TeX output mode with the
<b>-c</b> option, this means use the line thickness
specified by <b>.ps</b> lines; in troff output mode, this
means use a thickness proportional to the pointsize. A zero
value means draw the thinnest possible line supported by the
output device. Initially it has a value of -1. There is also
a <b>thickness</b> attribute (which can be abbreviated to
<b>thick</b>). For example, <b>circle thickness 1.5</b>
would draw a circle using a line with a thickness of 1.5
points. The thickness of lines is not affected by the value
of the <b>scale</b> variable, nor by any width or height
given in the <b>.PS</b> line.</p>
<h3>6.8. Invisible Objects
<a name="6.8. Invisible Objects"></a>
</h3>
<p style="margin-top: 1em">The modifier <b>invis[ible]</b>
makes an object entirely invisible. This used to be useful
for positioning text in an invisible object that is properly
joined to neighboring ones. Newer DWB versions and GNU
<b>pic</b> treat stand-alone text in exactly this way.</p>
<h3>6.9. Filled Objects
<a name="6.9. Filled Objects"></a>
</h3>
<p style="margin-top: 1em">It is possible to fill boxes,
circles, ellipses, and polygons. The modifier
<b>fill[ed]</b> accomplishes this. You can suffix it with a
fill value; the default is given by the style variable
<b>fillval</b>.</p>
<p style="margin-top: 1em">DWB <b>pic</b> and <b>gpic</b>
have opposite conventions for fill values and different
defaults. DWB <b>fillval</b> defaults to 0.3 and smaller
values are darker; GNU <b>fillval</b> uses 0 for white and 1
for black.</p>
<p align="center" style="margin-top: 1em"><img src="img/pic-24.png" alt="Image img/pic-24.png"></p>
<p align="center" style="margin-top: 1em">Figure 6-6:
<b>circle fill; move; circle fill 0.4; move; circle fill
0.9;</b></p>
<p style="margin-top: 1em">GNU <b>gpic</b> makes some
additional guarantees. A fill value greater than 1 can also
be used: this means fill with the shade of gray that is
currently being used for text and lines. Normally this is
black, but output devices may provide a mechanism for
changing this. The invisible attribute does not affect the
filling of objects. Any text associated with a filled object
is added after the object has been filled, so that the text
is not obscured by the filling.</p>
<h3>6.10. Colored Objects
<a name="6.10. Colored Objects"></a>
</h3>
<p style="margin-top: 1em">As a GNU extension, three
additional modifiers are available to specify colored
objects. <b>outline</b> sets the color of the outline,
<b>shaded</b> the fill color, and <b>color</b> sets both.
All three keywords expect a suffix specifying the color.
Example:</p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-25.png" alt="Image img/pic-25.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
6-7: <b>box color &quot;yellow&quot;; arrow color
&quot;cyan&quot;; circle shaded &quot;green&quot; outline
&quot;black&quot;;</b></font></p>
<p style="margin-top: 1em"><font color="#000000">Alternative
spellings are <b>colour</b>, <b>colored</b>,
<b>coloured</b>, and <b>outlined</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Predefined
color names for <i>[gtn]roff</i>-based <b>pic</b>
implementations are defined in the device macro files, for
example ps.tmac; additional colors can be defined with the
<b>.defcolor</b> request (see the manual page of GNU
<i>troff</i>(1) for more details). Currently, color support
is not available at all in TeX mode.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<i>pic2plot</i>(1) carries with its own set of color names,
essentially those recognized by the X&nbsp;window system
with &ldquo;grey&rdquo; accepted as a variant of
&ldquo;gray&rdquo;.</font></p>
<p style="margin-top: 1em"><font color="#000000"><b>pic</b>
assumes that at the beginning of a picture both glyph and
fill color are set to the default value.</font></p>
<hr>
[ <a href="pic-5.html">prev</a> | <a href="pic-7.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,67 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-7.html</title>
</head>
<hr>
[ <a href="pic-6.html">prev</a> | <a href="pic-8.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>7. More About Text Placement
<a name="7. More About Text Placement"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">By
default, text is centered at the geometric center of the
object it is associated with. The modifier <b>ljust</b>
causes the left end to be at the specified point (which
means that the text lies to the right of the specified
place!), the modifier <b>rjust</b> puts the right end at the
place. The modifiers <b>above</b> and <b>below</b> center
the text one half line space in the given
direction.</font></p>
<p style="margin-top: 1em"><font color="#000000">Text
attributes can be combined:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-26.png" alt="Image img/pic-26.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
7-1: Text attributes</font></p>
<p style="margin-top: 1em"><font color="#000000">What
actually happens is that <i>n</i> text strings are centered
in a box that is <b>textwid</b> wide by <b>textht</b> high.
Both these variables are initially zero (that is
<b>pic</b>&rsquo;s way of not making assumptions about
<i>[tg]roff</i>(1)&rsquo;s default point size).</font></p>
<p style="margin-top: 1em"><font color="#000000">In GNU
<b>gpic</b>, objects can have an <b>aligned</b> attribute.
This only works if the postprocessor is <b>grops</b> or
<b>gropdf</b>. Any text associated with an object having the
<b>aligned</b> attribute is rotated about the center of the
object so that it is aligned in the direction from the start
point to the end point of the object. Note that this
attribute has no effect for objects whose start and end
points are coincident.</font></p>
<hr>
[ <a href="pic-6.html">prev</a> | <a href="pic-8.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,102 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-8.html</title>
</head>
<hr>
[ <a href="pic-7.html">prev</a> | <a href="pic-9.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>8. More About Direction Changes
<a name="8. More About Direction Changes"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">We&rsquo;ve
already seen how to change the direction in which objects
are composed from rightward to downward. Here are some more
illustrative examples:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-27.png" alt="Image img/pic-27.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
8-1: Effects of different motion directions (right and
left)</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-28.png" alt="Image img/pic-28.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
8-2: Effects of different motion directions (up and
down)</font></p>
<p style="margin-top: 1em"><font color="#000000">Something
that may appear surprising happens if you change directions
in the obvious way:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-29.png" alt="Image img/pic-29.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
8-3: <b>box; arrow; circle; down; arrow;
ellipse</b></font></p>
<p style="margin-top: 1em"><font color="#000000">You might
have expected that program to yield this:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-30.png" alt="Image img/pic-30.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
8-4: More intuitive?</font></p>
<p style="margin-top: 1em"><font color="#000000">But, in
fact, to get Figure 8.3 you have to do this:</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
box; <br>
arrow; <br>
circle; <br>
move to last circle .s; <br>
down; <br>
arrow; <br>
ellipse <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">Why is
this? Because the exit point for the current direction is
already set when you draw the object. The second arrow in
Figure 8.2 dropped downward from the circle&rsquo;s
attachment point for an object to be joined to the
right.</font></p>
<p style="margin-top: 1em"><font color="#000000">The
meaning of the command <b>move to last circle .s</b> should
be obvious. In order to see how it generalizes, we&rsquo;ll
need to go into detail on two important topics; locations
and object names.</font></p>
<hr>
[ <a href="pic-7.html">prev</a> | <a href="pic-9.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,123 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>pic-9.html</title>
</head>
<hr>
[ <a href="pic-8.html">prev</a> | <a href="pic-10.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>9. Naming Objects
<a name="9. Naming Objects"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">The most
natural way to name locations in <b>pic</b> is relative to
objects. In order to do this, you have to be able to name
objects. The <b>pic</b> language has rich facilities for
this that try to emulate the syntax of English.</font></p>
<h3>9.1. Naming Objects By Order Of Drawing
<a name="9.1. Naming Objects By Order Of Drawing"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
simplest (and generally the most useful) way to name an
object is with a <b>last</b> clause. It needs to be followed
by an object type name; <b>box</b>, <b>circle</b>,
<b>ellipse</b>, <b>line</b>, <b>arrow</b>, <b>spline</b>,
<b>&quot;&quot;</b>, or <b>[]</b> (the last type refers to a
<i>composite object</i> which we&rsquo;ll discuss later).
So, for example, the <b>last circle</b> clause in the
program attached to Figure 9.1.3 refers to the last circle
drawn.</font></p>
<p style="margin-top: 1em"><font color="#000000">More
generally, objects of a given type are implicitly numbered
(starting from&nbsp;1). You can refer to (say) the third
ellipse in the current picture with <b>3rd ellipse</b>, or
to the first box as <b>1st box</b>, or to the fifth text
string (which isn&rsquo;t an attribute to another object) as
<b>5th &quot;&quot;</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Objects
are also numbered backward by type from the last one. You
can say <b>2nd last box</b> to get the second-to-last box,
or <b>3rd last ellipse</b> to get the third-to-last
ellipse.</font></p>
<p style="margin-top: 1em"><font color="#000000">In places
where <i>n</i><b>th</b> is allowed,
<b>`</b><i>expr</i><b>'th</b> is also allowed. Note that
<b>'th</b> is a single token: no space is allowed between
the <b>'</b> and the <b>th</b>. For example,</font></p>
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">for
i = 1 to 4 do { <br>
line from `i'th box.nw to `i+1'th box.se <br>
}</font></p>
<h3>9.2. Naming Objects With Labels
<a name="9.2. Naming Objects With Labels"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">You can
also specify an object by referring to a label. A label is a
word (which must begin with a capital letter) followed by a
colon; you declare it by placing it immediately before the
object drawing command. For example, the program</font></p>
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
<br>
A: box &quot;first&quot; &quot;object&quot; <br>
move; <br>
B: ellipse &quot;second&quot; &quot;object&quot; <br>
move; <br>
arrow right at A .r; <br>
.PE</font></p>
<p style="margin-top: 1em"><font color="#000000">declares
labels <b>A</b> and <b>B</b> for its first and second
objects. Here&rsquo;s what that looks like:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic-31.png" alt="Image img/pic-31.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
9-1: Example of label use</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>at</b> statement in the fourth line uses the label
<b>A</b> (the behavior of <b>at</b> is explained in the next
section). We&rsquo;ll see later on that labels are most
useful for referring to block composite objects.</font></p>
<p style="margin-top: 1em"><font color="#000000">Labels are
not constants but variables (you can view colon as a sort of
assignment). You can say something like <b>A: A + (1,0);</b>
and the effect is to reassign the label <b>A</b> to
designate a position one inch to the right of its old
value.</font></p>
<hr>
[ <a href="pic-8.html">prev</a> | <a href="pic-10.html">next</a> | <a href="pic.html">top</a> ]
<hr>

View file

@ -0,0 +1,113 @@
<!-- Creator : groff version 1.24.1 -->
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>Making Pictures With GNU PIC</title>
</head>
<body>
<h1 align="center">Making Pictures With GNU PIC</h1>
<a href="pic-1.html#1. Introduction to PIC">1. Introduction to PIC</a><br>
<a href="pic-1.html#1.1. Why PIC?">1.1. Why PIC?</a><br>
<a href="pic-1.html#1.2. PIC Versions">1.2. PIC Versions</a><br>
<a href="pic-2.html#2. Invoking PIC">2. Invoking PIC</a><br>
<a href="pic-2.html#2.1. PIC Error Messages">2.1. PIC Error Messages</a><br>
<a href="pic-3.html#3. Basic PIC Concepts">3. Basic PIC Concepts</a><br>
<a href="pic-4.html#4. Sizes and Spacing">4. Sizes and Spacing</a><br>
<a href="pic-4.html#4.1. Default Sizes of Objects">4.1. Default Sizes of Objects</a><br>
<a href="pic-4.html#4.2. Objects Do Not Stretch!">4.2. Objects Do Not Stretch!</a><br>
<a href="pic-4.html#4.3. Resizing Boxes">4.3. Resizing Boxes</a><br>
<a href="pic-4.html#4.4. Resizing Other Object Types">4.4. Resizing Other Object Types</a><br>
<a href="pic-4.html#4.5. The &lsquo;same&rsquo; Keyword">4.5. The &lsquo;same&rsquo; Keyword</a><br>
<a href="pic-5.html#5. Generalized Lines and Splines">5. Generalized Lines and Splines</a><br>
<a href="pic-5.html#5.1. Diagonal Lines">5.1. Diagonal Lines</a><br>
<a href="pic-5.html#5.2. Multi-Segment Line Objects">5.2. Multi-Segment Line Objects</a><br>
<a href="pic-5.html#5.3. Spline Objects">5.3. Spline Objects</a><br>
<a href="pic-5.html#5.4. Polygon Objects">5.4. Polygon Objects</a><br>
<a href="pic-6.html#6. Decorating Objects">6. Decorating Objects</a><br>
<a href="pic-6.html#6.1. Text Special Effects">6.1. Text Special Effects</a><br>
<a href="pic-6.html#6.2. Dashed Objects">6.2. Dashed Objects</a><br>
<a href="pic-6.html#6.3. Dotted Objects">6.3. Dotted Objects</a><br>
<a href="pic-6.html#6.4. Rounding Box Corners">6.4. Rounding Box Corners</a><br>
<a href="pic-6.html#6.5. Slanted Boxes">6.5. Slanted Boxes</a><br>
<a href="pic-6.html#6.6. Arrowheads">6.6. Arrowheads</a><br>
<a href="pic-6.html#6.7. Line Thickness">6.7. Line Thickness</a><br>
<a href="pic-6.html#6.8. Invisible Objects">6.8. Invisible Objects</a><br>
<a href="pic-6.html#6.9. Filled Objects">6.9. Filled Objects</a><br>
<a href="pic-6.html#6.10. Colored Objects">6.10. Colored Objects</a><br>
<a href="pic-7.html#7. More About Text Placement">7. More About Text Placement</a><br>
<a href="pic-8.html#8. More About Direction Changes">8. More About Direction Changes</a><br>
<a href="pic-9.html#9. Naming Objects">9. Naming Objects</a><br>
<a href="pic-9.html#9.1. Naming Objects By Order Of Drawing">9.1. Naming Objects By Order Of Drawing</a><br>
<a href="pic-9.html#9.2. Naming Objects With Labels">9.2. Naming Objects With Labels</a><br>
<a href="pic-10.html#10. Describing locations">10. Describing locations</a><br>
<a href="pic-10.html#10.1. Absolute Coordinates">10.1. Absolute Coordinates</a><br>
<a href="pic-10.html#10.2. Locations Relative to Objects">10.2. Locations Relative to Objects</a><br>
<a href="pic-10.html#10.2.1. Locations Relative to Closed Objects">10.2.1. Locations Relative to Closed Objects</a><br>
<a href="pic-10.html#10.2.2. Locations Relative to Open Objects">10.2.2. Locations Relative to Open Objects</a><br>
<a href="pic-10.html#10.2.2.1. Locations Relative to Polygons">10.2.2.1. Locations Relative to Polygons</a><br>
<a href="pic-10.html#10.3. Ways of Composing Positions">10.3. Ways of Composing Positions</a><br>
<a href="pic-10.html#10.3.1. Vector Sums and Displacements">10.3.1. Vector Sums and Displacements</a><br>
<a href="pic-10.html#10.3.2. Interpolation Between Positions">10.3.2. Interpolation Between Positions</a><br>
<a href="pic-10.html#10.3.3. Projections of Points">10.3.3. Projections of Points</a><br>
<a href="pic-10.html#10.4. Using Locations">10.4. Using Locations</a><br>
<a href="pic-10.html#10.5. The &lsquo;chop&rsquo; Modifier">10.5. The &lsquo;chop&rsquo; Modifier</a><br>
<a href="pic-11.html#11. Object Groups">11. Object Groups</a><br>
<a href="pic-11.html#11.1. Brace Grouping">11.1. Brace Grouping</a><br>
<a href="pic-11.html#11.2. Block Composites">11.2. Block Composites</a><br>
<a href="pic-12.html#12. Style Variables">12. Style Variables</a><br>
<a href="pic-13.html#13. Expressions, Variables, and Assignment">13. Expressions, Variables, and Assignment</a><br>
<a href="pic-14.html#14. Macros">14. Macros</a><br>
<a href="pic-15.html#15. Import/Export Commands">15. Import/Export Commands</a><br>
<a href="pic-15.html#15.1. File and Table Insertion">15.1. File and Table Insertion</a><br>
<a href="pic-15.html#15.2. Debug Messages">15.2. Debug Messages</a><br>
<a href="pic-15.html#15.3. Escape to Post-Processor">15.3. Escape to Post-Processor</a><br>
<a href="pic-15.html#15.4. Executing Shell Commands">15.4. Executing Shell Commands</a><br>
<a href="pic-16.html#16. Control-flow constructs">16. Control-flow constructs</a><br>
<a href="pic-17.html#17. Interface To [gt]roff">17. Interface To [gt]roff</a><br>
<a href="pic-17.html#17.1. Scaling Arguments">17.1. Scaling Arguments</a><br>
<a href="pic-17.html#17.2. How Scaling is Handled">17.2. How Scaling is Handled</a><br>
<a href="pic-17.html#17.3. PIC and [gt]roff commands">17.3. PIC and [gt]roff commands</a><br>
<a href="pic-17.html#17.4. PIC and EQN">17.4. PIC and EQN</a><br>
<a href="pic-17.html#17.5. Absolute Positioning of Pictures">17.5. Absolute Positioning of Pictures</a><br>
<a href="pic-18.html#18. Interface to TeX">18. Interface to TeX</a><br>
<a href="pic-19.html#19. Obsolete Commands">19. Obsolete Commands</a><br>
<a href="pic-20.html#20. Some Larger Examples">20. Some Larger Examples</a><br>
<a href="pic-21.html#21. PIC Reference">21. PIC Reference</a><br>
<a href="pic-21.html#21.1. Lexical Items">21.1. Lexical Items</a><br>
<a href="pic-21.html#21.2. Semi-Formal Grammar">21.2. Semi-Formal Grammar</a><br>
<a href="pic-22.html#22. History and Acknowledgements">22. History and Acknowledgements</a><br>
<a href="pic-23.html#23. Bibliography">23. Bibliography</a><br>
<hr>
</body>
</html>
<p align="center"><i>Eric S. Raymond</i> <br>
&lang;<i>esr@snark.thyrsus.com</i>&rang;</p>
<p align="center" style="margin-top: 1em"><i>ABSTRACT</i></p>
<p style="margin-top: 1em">The <b>pic</b> language is a
<b>troff</b> extension that makes it easy to create and
alter box-and-arrow diagrams of the kind frequently used in
technical papers and textbooks. This paper is both an
introduction to and reference for <i>gpic</i>(1), the
implementation distributed by the Free Software Foundation
for use with <i>groff</i>(1). It also catalogs other
implementations and explains the differences among them.</p>