Debian Codegraph @

contrib/mom/momdoc/using.html

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 This file is part of groff, the GNU roff type-setting system.
4
5 Copyright (C) 2004-2020 Free Software Foundation, Inc.
6 Written by Peter Schaffter ([email protected]).
7
8 Permission is granted to copy, distribute and/or modify this document
9 under the terms of the GNU Free Documentation License, Version 1.3 or
10 any later version published by the Free Software Foundation; with no
11 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
12 Texts.
13
14 A copy of the Free Documentation License is included as a file called
15 FDL in the main directory of the groff source package.
16 -->
17
18 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
19 <html xmlns="http://www.w3.org/1999/xhtml">
20
21 <head>
22 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
23 <title>Using mom</title>
24 <link rel="stylesheet" type="text/css" href="stylesheet.css" />
25 </head>
26
27 <body style="background-color: #f5faff;">
28
29 <!-- ==================================================================== -->
30
31 <div id="top" class="page">
32
33 <!-- Navigation links -->
34 <table style="width: 100%;">
35 <tr>
36 <td><a href="toc.html">Back to Table of Contents</a></td>
37 <td style="text-align: right;"><a href="typesetting.html#top">Next: The typesetting macros</a></td>
38 </tr>
39 </table>
40
41 <h1 id="using" class="docs">Using mom</h1>
42
43 <div style="text-align: left; margin-left: 33%">
44 <ul class="no-enumerator" style="margin-left: -2.5em;">
45 <li><a href="#using-intro">Introduction</a></li>
46 <li><a href="#using-macros">How to input mom&#8217;s macros</a></li>
47 <li><a href="#viewing">Processing and viewing documents</a>
48 <ul>
49 <li class="item"><a href="#pdf">Mom and PDF</a></li>
50 <li class="item"><a href="#pdfmom">pdfmom</a></li>
51 </ul></li>
52 <li><a href="#previewing">Automatic previewing of documents</a></li>
53 </ul>
54 </div>
55
56 <div class="rule-short" style="margin-top: 18px;"><hr/></div>
57
58 <h2 id="using-intro" class="docs">Introduction</h2>
59
60 <p>
61 As explained in the section
62 <a href="intro.html#top">What is mom?</a>,
63 mom can be used in two ways: for straightforward typesetting or for
64 document processing. The difference between the two is that in
65 straightforward typesetting, every macro is a literal instruction
66 that determines precisely how text following it will look. Document
67 processing, on the other hand, uses markup tags (e.g. <kbd>.PP</kbd>
68 for paragraphs, <kbd>.HEADING</kbd> for different levels of heads,
69 <kbd>.FOOTNOTE</kbd> for footnotes, etc.) that perform typesetting
70 operations automatically.
71 </p>
72
73 <p>
74 You tell mom that you want to use the document processing macros
75 with the
76 <a href="docprocessing.html#start">START</a>
77 macro. After START, mom determines the appearance of
78 text following the markup tags automatically, although you, the
79 user, can easily change how the tags are interpreted.
80 </p>
81
82 <h2 id="using-macros" class="docs">How to input mom&#8217;s macros</h2>
83
84 <p>
85 Regardless of whether you&#8217;re preparing a term paper or making a
86 flyer for your lost dog, the following apply.
87 </p>
88
89 <ol style="margin-top: -.5em; margin-bottom: -.5em;">
90 <li>
91 You need a good text editor for inputting mom files.
92 <br/>
93 <span style="display: block; margin-top: .25em; margin-bottom: .5em;">
94 I cannot recommend highly enough that you use an editor that
95 lets you write syntax highlighting rules for mom&#8217;s
96 macros and
97 <a href="definitions.html#inlines">inline escapes</a>.
98 Simply colourizing macros and inlines to half-intensity can be
99 enough to make text stand out clearly from formatting commands.
100 Mom herself comes with a complete set of syntax highlighting
101 rules for the vim editor. A number of freely available editors
102 come with groff syntax highlighting rules, which are sufficient
103 for mom files, though not as colourful or complete as the vim
104 rules that ship with mom.
105 </span>
106 </li>
107 <li>
108 Macros begin with a period (dot) at the left margin of your text
109 editor&#8217;s screen, and must be entered in upper case (capital)
110 letters.
111 </li>
112 <li>
113 Macro
114 <a href="definitions.html#arguments">arguments</a>
115 are separated from the macro itself by spaces. Multiple
116 arguments to the same macro are separated from each
117 other by spaces. Any number of spaces may be used.
118 </li>
119 <li>
120 Arguments to a macro must appear on the same line as the
121 macro.
122 <br/>
123 <span style="display: block; margin-top: .25em; margin-bottom: .5em;">
124 If the argument list is very long, you may use the
125 backslash character (<kbd>\</kbd>) to break the line visually.
126 From groff&#8217;s point of view, the backslash and newline are
127 invisible. Thus, for example,
128 <span class="pre" style="margin-bottom: -2.25em">
129 .HEADING_STYLE 1 FAMILY Garamond FONT B SIZE +2
130 </span>
131 and
132 <span class="pre" style="margin-bottom: -2.25em">
133 .HEADING_STYLE 1 \
134 FAMILY Garamond \
135 FONT B \
136 SIZE +2
137 </span>
138 </span>
139 are exactly equivalent.
140 </li>
141 <li>
142 Any argument (except a
143 <a href="definitions.html#stringargument">string argument</a>)
144 that is not a digit must be entered in upper case
145 (capital) letters.
146 </li>
147 <li>
148 Any argument that requires a plus or minus sign must
149 have the plus or minus sign prepended to the argument
150 with no intervening space (e.g. <kbd>+2</kbd>).
151 </li>
152 <li>
153 Any argument that requires a
154 <a href="definitions.html#unitofmeasure">unit of measure</a>
155 must have the unit appended directly to the argument, with no
156 intervening space (e.g. <kbd>.5i</kbd>).
157 </li>
158 <li>
159 <a href="definitions.html#stringargument">String arguments</a>,
160 in the sense of this manual, must be surrounded by double-quotes
161 (e.g. <kbd>"text"</kbd>). Multiple
162 string arguments are separated from each other by spaces (with
163 each argument surrounded by double-quotes).
164 <br/>
165 <span style="display: block; margin-top: .25em; margin-bottom: .5em;">
166 If a string argument becomes
167 uncomfortably long, you may break it into two or more lines
168 with the backslash character.
169 <span class="pre">
170 .SUBTITLE "An In-Depth Consideration of the \
171 Implications of Forty-Two as the Answer to Life, \
172 The Universe, and Everything"
173 </span>
174 </span>
175 </li>
176 </ol>
177
178 <div class="box-tip">
179 <p class="tip">
180 <span class="tip">Tip:</span>
181 It&#8217;s important that your documents be easy to read and
182 understand in a text editor. One way to achieve this is to group
183 macros that serve a similar purpose together, and separate them from
184 other groups of macros with a comment line. In groff, that&#8217;s
185 done with <kbd>\#</kbd> (backslash-pound) or <kbd>.\"</kbd>
186 (period-backslash-doublequote) on a line by itself. Either
187 instructs groff to ignore the remainder of the line, which may or
188 may not contain text. Consider the following, which is a template
189 for starting the chapter of a book.
190 <br/>
191 <span class="pre-in-pp">
192 \# Reference/meta-data
193 .TITLE "My Pulitzer Novel"
194 .AUTHOR "Joe Blow"
195 .CHAPTER 1
196 \# Template
197 .DOCTYPE CHAPTER
198 .PRINTSTYLE TYPESET
199 \# Type style
200 .FAM P
201 .PT_SIZE 10
202 .LS 12
203 \#
204 .START
205 </span>
206 You may also, if you wish, add a comment to the end of a line with
207 <kbd>\"</kbd> (no period), like this:
208 <br/>
209 <span class="pre-in-pp">
210 .FAMILY P \" Maybe Garamond instead?
211 </span>
212 </p>
213 </div>
214
215 <h2 id="viewing" class="docs">Processing and viewing documents</h2>
216
217 <p>
218 The most basic command-line usage for processing a file formatted
219 with the mom macros is
220 <br/>
221 <span class="pre-in-pp">
222 groff -mom filename.mom &gt; filename.ps
223 </span>
224 which processes the .mom file and dumps the output into a
225 viewable/printable PostScript file.
226 </p>
227
228 <h3 id="pdf" class="docs">Mom and PDF</h3>
229
230 <p>
231 Adobe&#8217;s Portable Document Format (PDF) has largely supplanted
232 PostScript, of which it is a subset, as the standard for typeset
233 documents. While printed versions of documents in either format
234 will be identical, PDF documents, when viewed at the screen, may
235 also contain clickable links and a number of other special features.
236 </p>
237
238 <p>
239 As of version 2.0, mom supports full PDF integration. The creation
240 and processing of mom files into PostScript documents remains
241 unchanged from 1.x, but the expected and recommended format of final
242 documents is now PDF.
243 </p>
244
245 <p>
246 The manual,
247 <a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf"><span class="book-title">Producing PDFs with groff and mom</span></a>,
248 explains and demonstrates the PDF-specific macros that are available
249 in mom, as well as the use of <strong>pdfmom</strong>, the
250 recommended way to process mom files.
251 </p>
252
253 <h4 id="pdfmom" class="docs">pdfmom</h4>
254
255 <p>
256 Groff provides more than one way to generate PDF documents,
257 but when processing files formatted with the mom macros,
258 <strong>pdfmom</strong> is the recommended and most robust way to do
259 it:
260 <br/>
261 <span class="pre-in-pp">
262 pdfmom filename.mom &gt; filename.pdf
263 </span>
264 <strong>pdfmom</strong> is a wrapper around groff, and accepts all
265 groff&#8217;s command-line options as listed in the groff manpage.
266 Full usage is explained in the manual,
267 <a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf"><span class="book-title">Producing PDFs with groff and mom</span></a>.
268 </p>
269
270 <p>
271 PDF links in a document, including linked entries in the
272 Table of Contents, are identified by colour. When printing
273 documents with links, you will most likely not want the link
274 text coloured. The groff option, <kbd>-c</kbd>, disables colour
275 throughout a document; thus, when preparing a document for printing,
276 you should use:
277 <br/>
278 <span class="pre-in-pp">
279 pdfmom -c filename.mom &gt; filename.pdf
280 </span>
281 <strong>pdfmom</strong> tends to produce large files. You may
282 reduce their size by piping them through ps2pdf:
283 <br/>
284 <span class="pre-in-pp">
285 pdfmom -c filename.mom | ps2pdf - filename.pdf
286 </span>
287 Be aware, though, that files piped through ps2pdf will lose some pdf
288 metadata, notably the document window title set with PDF_TITLE.
289 </p>
290
291 <h2 id="previewing" class="docs">Automatic previewing of documents</h2>
292
293 <p>
294 Most PDF viewers have a &#8220;Watch File&#8221; option, which
295 automatically updates a displayed document whenever there&#8217;s
296 a change. This is useful when preparing documents that require
297 judgment calls. I recommend creating a keymapping in your
298 text editor that both saves the mom file and processes it with
299 <strong>pdfmom</strong>. The displayed PDF then automatically
300 reflects whatever changes you save to the mom file.
301 </p>
302
303 <div class="rule-long"><hr/></div>
304
305 <!-- Navigation links -->
306 <table style="width: 100%; margin-top: 12px;">
307 <tr>
308 <td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
309 <td style="width: 33%; text-align: center;"><a href="#top">Top</a></td>
310 <td style="width: 33%; text-align: right;"><a href="typesetting.html#top">Next: The typesetting macros</a></td>
311 </tr>
312 </table>
313
314 </div>
315
316 <div class="bottom-spacer"><br/></div>
317
318 </body>
319 </html>