Debian Codegraph @

upstream/fedora-rawhide/man5/groff_tmac.5

raw
1 .TH groff_tmac 5 "2026-03-03" "groff 1.24.0"
2 .SH Name
3 groff_tmac \- macro files in the GNU
4 .I roff
5 typesetting system
6 .
7 .
8 .\" ====================================================================
9 .\" Legal Terms
10 .\" ====================================================================
11 .\"
12 .\" Copyright 2000-2024 Free Software Foundation, Inc.
13 .\"
14 .\" This file is part of groff, the GNU roff typesetting system.
15 .\"
16 .\" Permission is granted to copy, distribute and/or modify this
17 .\" document under the terms of the GNU Free Documentation License,
18 .\" Version 1.3 or any later version published by the Free Software
19 .\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
20 .\" and with no Back-Cover Texts.
21 .\"
22 .\" A copy of the Free Documentation License is included as a file
23 .\" called FDL in the main directory of the groff source package.
24 .
25 .
26 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
27 .do nr *groff_groff_tmac_5_man_C \n[.cp]
28 .cp 0
29 .
30 .\" Define fallback for groff 1.23's MR macro if the system lacks it.
31 .nr do-fallback 0
32 .if !\n(.f .nr do-fallback 1 \" mandoc
33 .if \n(.g .if !d MR .nr do-fallback 1 \" older groff
34 .if !\n(.g .nr do-fallback 1 \" non-groff *roff
35 .if \n[do-fallback] \{\
36 . de MR
37 . ie \\n(.$=1 \
38 . I \%\\$1
39 . el \
40 . IR \%\\$1 (\\$2)\\$3
41 . .
42 .\}
43 .rr do-fallback
44 .
45 .\" This man page employs an unusual character.
46 .if !c \[u2717] .char \[u2717] X
47 .
48 .
49 .\" TODO: Consider parallelizing with our Texinfo node "Macro Packages".
50 .\" ====================================================================
51 .SH Description
52 .\" ====================================================================
53 .
54 Definitions of macros,
55 strings,
56 and registers for use in a
57 .MR roff 7
58 document can be collected into
59 .IR "macro files" ,
60 .I roff
61 input files designed to produce no output themselves but instead ease
62 the preparation of other
63 .I roff
64 documents.
65 .
66 There is no syntactical difference between a macro file and any other
67 .I roff
68 document;
69 only its purpose distinguishes it.
70 .
71 When a macro file is installed at a standard location,
72 named according to a certain convention,
73 and suitable for use by a general audience,
74 it is termed a
75 .IR "macro package" .
76 .
77 The \[lq]tmac\[rq] name originated in early Unix culture as an
78 abbreviation of
79 .RI \[lq] troff \" generic
80 macros\[rq].
81 .
82 .
83 .P
84 Macro packages can be loaded by supplying the
85 .B \-m
86 option to
87 .MR \%troff 1
88 or a
89 .I groff
90 front end.
91 .
92 A macro file's name must have the form
93 .RI name .tmac
94 (or
95 .IR tmac. name)
96 and be placed in a
97 .RI \[lq] tmac
98 directory\[rq] to be loadable with the
99 .RB \[lq] \-m
100 .IR name \[rq]
101 option.
102 .
103 Section \[lq]Environment\[rq] of
104 .MR \%troff 1
105 lists these directories.
106 .
107 Alternatively,
108 a
109 .I groff
110 document requiring a macro file can load it with the
111 .B mso
112 (\[lq]macro source\[rq]) request.
113 .
114 .
115 .P
116 Macro files are named for their most noteworthy application,
117 but a macro file need not define any macros.
118 .
119 It can restrict itself to defining registers and strings or invoking
120 other
121 .I groff
122 requests.
123 .
124 It can even be empty.
125 .
126 .
127 .P
128 Encode macro files in
129 ISO\~646:1991\~IRV (US-ASCII)
130 or ISO\~Latin-1 (8859-1).
131 .
132 To prepare for a future
133 .I groff
134 release supporting UTF-8 input,
135 restrict files to ISO 646 codes.
136 .
137 .
138 .MR \%soelim 1
139 by design does not interpret
140 .B mso
141 requests,
142 and the encodings used by documents employing a macro file can vary.
143 .
144 .
145 .\" ====================================================================
146 .SH "Macro packages"
147 .\" ====================================================================
148 .
149 Some macro packages
150 (\[lq]major\[rq] or \[lq]full-service\[rq])
151 assume responsibility for page layout
152 and other critical functions;
153 others
154 (\[lq]supplemental\[rq] or \[lq]auxiliary\[rq])
155 do not.
156 .
157 GNU
158 .I roff
159 provides most major macro packages found in AT&T and BSD Unix systems,
160 an additional full-service package,
161 and many supplemental packages.
162 .
163 Multiple full-service macro packages cannot be used by the same
164 document.
165 .
166 Auxiliary packages can,
167 in general,
168 be freely combined,
169 though attention to their use of the
170 .I groff
171 language name spaces for identifiers
172 (particularly registers,
173 macros,
174 strings,
175 and diversions)
176 should be paid.
177 .
178 Name space management challenged AT&T
179 .I troff \" AT&T
180 users;
181 GNU
182 .IR troff 's \" GNU
183 support for arbitrarily long identifiers affords few excuses for name
184 collisions,
185 apart from attempts at compatibility with the demands of historical
186 documents.
187 .
188 .
189 .\" ====================================================================
190 .SS "Man pages"
191 .\" ====================================================================
192 .
193 Two full-service macro packages are specialized for formatting Unix
194 reference manuals;
195 they do not support features like footnotes or multiple columnation.
196 .
197 .TP 9n \" "mandoc" + 2n + hand-tuned for PDF
198 .I an
199 constructs man pages in a format introduced by Seventh Edition Unix
200 (1979).
201 .
202 Its macro interface is small,
203 and the package widely used;
204 see
205 .MR groff_man 7 .
206 .
207 .
208 .TP
209 .I doc
210 constructs man pages in a format introduced by 4.3BSD-Reno (1990).
211 .
212 It provides many more features than
213 .IR an ,
214 but is also larger,
215 more complex,
216 and not as widely adopted;
217 see
218 .MR groff_mdoc 7 .
219 .
220 .
221 .P
222 Because readers of man pages often do not know in advance which macros
223 are used to format a given document,
224 a wrapper is available.
225 .
226 .
227 .TP 9n \" "mandoc" + 2n + hand-tuned for PDF
228 .I \%andoc
229 recognizes a document's use of
230 .I an
231 or
232 .I doc
233 and loads the corresponding macro package.
234 .
235 Multiple man pages,
236 in either format,
237 can be handled;
238 .I \%andoc
239 reloads each macro package as necessary.
240 .
241 .
242 .\" ====================================================================
243 .SS "General full-service packages"
244 .\" ====================================================================
245 .
246 The following packages each support composition of documents of any
247 kind,
248 from single-page memos to lengthy monographs.
249 .
250 They are similar in functionality;
251 select one that suits your taste.
252 .
253 .
254 .TP
255 .I me
256 originates in 2BSD (1978);
257 see
258 .MR groff_me 7 .
259 .
260 .
261 .TP
262 .I mm
263 originates in Programmer's Workbench (PWB) Unix 1.0 (1977);
264 see
265 .MR groff_mm 7 .
266 .
267 .
268 .TP
269 .I mom
270 was contributed to
271 .I groff
272 in 2002,
273 and freely exercises its many extended features.
274 .
275 See
276 .MR groff_mom 7 .
277 .
278 .
279 .TP
280 .I ms
281 originates in Sixth Edition Unix (1975);
282 see
283 .MR groff_ms 7 .
284 .
285 .
286 .\" ====================================================================
287 .SS "Localization packages"
288 .\" ====================================================================
289 .
290 For Western languages,
291 an auxiliary package for localization
292 sets the hyphenation mode and loads hyphenation patterns
293 and exceptions.
294 .
295 Localization files can also adjust the date format and provide
296 translations of strings used by some of the full-service macro packages;
297 alter the input encoding
298 (see the next section);
299 and change the amount of supplemental inter-sentence space.
300 .
301 For Eastern languages,
302 the localization file defines character classes and sets flags on them.
303 .
304 By default,
305 .I troffrc
306 loads the localization file for English.
307 .
308 .
309 .TP
310 .I trans
311 loads localized strings used by various macro packages after their
312 localized forms have been prepared by a localization macro file.
313 .
314 .
315 .P
316 .I groff
317 provides the following localization files.
318 .
319 .
320 .TP
321 .I cs
322 Czech;
323 localizes
324 .IR man ,
325 .IR me ,
326 .IR mm ,
327 .IR mom ,
328 and
329 .IR ms .
330 .
331 Sets the input encoding to Latin-2 by loading
332 .IR latin2.tmac .
333 .
334 .
335 .TP
336 .I de
337 .TQ
338 .I den
339 German;
340 localizes
341 .IR man ,
342 .IR me ,
343 .IR mm ,
344 .IR mom ,
345 and
346 .IR ms .
347 .
348 Sets the input encoding to Latin-1 by loading
349 .IR latin1.tmac .
350 .
351 .
352 .IP
353 .I de.tmac
354 selects hyphenation patterns for traditional orthography,
355 and
356 .I den.tmac
357 does the same for the new orthography
358 (\[lq]Recht\%schreib\%reform\[rq]).
359 .
360 .
361 .TP
362 .I en
363 English.
364 .
365 Sets the input encoding to Latin-1 by loading
366 .IR latin1.tmac .
367 .
368 .
369 .TP
370 .I es
371 Spanish;
372 localizes
373 .IR man ,
374 .IR me ,
375 .IR mm ,
376 .IR mom ,
377 and
378 .IR ms .
379 .
380 Sets the input encoding to Latin-9 by loading
381 .IR latin9.tmac .
382 .
383 .
384 .TP
385 .I fr
386 French;
387 localizes
388 .IR man ,
389 .IR me ,
390 .IR mm ,
391 .IR mom ,
392 and
393 .IR ms .
394 .
395 Sets the input encoding to Latin-9 by loading
396 .IR latin9.tmac .
397 .
398 .
399 .TP
400 .I it
401 Italian;
402 localizes
403 .IR man ,
404 .IR me ,
405 .IR mm ,
406 .IR mom ,
407 and
408 .IR ms .
409 .
410 Sets the input encoding to Latin-1 by loading
411 .IR latin1.tmac .
412 .
413 .
414 .TP
415 .I ja
416 Japanese.
417 .
418 .
419 .TP
420 .I pl
421 Polish;
422 localizes
423 .IR man ,
424 .IR me ,
425 .IR mm ,
426 .IR mom ,
427 and
428 .IR ms .
429 .
430 Sets the input encoding to Latin-2 by loading
431 .IR latin2.tmac .
432 .
433 .
434 .TP
435 .I ru
436 Russian;
437 localizes
438 .IR man ,
439 .IR me ,
440 .IR mm ,
441 .IR mom ,
442 and
443 .IR ms .
444 .
445 Sets the input encoding to KOI8-R by loading
446 .IR koi8-r.tmac .
447 .
448 .
449 .TP
450 .I sv
451 Swedish;
452 localizes
453 .IR man ,
454 .IR me ,
455 .IR mm ,
456 .IR mom ,
457 and
458 .IR ms .
459 .
460 Sets the input encoding to Latin-1 by loading
461 .IR latin1.tmac .
462 .
463 Some of the localization of the
464 .I mm
465 package is handled separately;
466 see
467 .MR groff_mmse 7 .
468 .
469 .
470 .TP
471 .I zh
472 Chinese.
473 .
474 .
475 .\" ====================================================================
476 .SS "Input encodings"
477 .\" ====================================================================
478 .
479 Localization influences automatic hyphenation
480 in two distinct but related respects.
481 A macro file specific to a character coding identifies
482 which character codes correspond to letters expected
483 in the language's hyphenation pattern files
484 and sets up case equivalences for those letters.
485 A language's macro file determines which of these letters
486 are equivalent to other letters for hyphenation purposes.
487 .
488 .
489 .P
490 For example,
491 in English,
492 the letter \[lq]\[n a~]\[rq] occurs in loan words.
493 The
494 .I \%latin1.tmac
495 and
496 .I \%latin9.tmac
497 macro files define a hyphenation code for \[lq]\[n a~]\[rq]
498 and make \[lq]\[N a~]\[rq] equivalent to it.
499 The English localization file
500 .I \%en.tmac
501 furthermore makes \[lq]\[n a~]\[rq] equivalent to \[lq]n\[rq].
502 In Spanish
503 .RI \%( es.tmac ),
504 however,
505 \[lq]\[n a~]\[rq] and \[lq]n\[rq] are
506 .I not
507 equivalent.
508 The language localization file
509 .\" (@pxref{Manipulating Hyphenation})
510 loads an appropriate encoding localization file;
511 a document need not do so directly.
512 .
513 .
514 .TP 8n \" "latin1" + 2n
515 .I latin1
516 .TQ
517 .I latin2
518 .TQ
519 .I latin5
520 .TQ
521 .I latin9
522 support the ISO\~Latin-1,
523 Latin-2,
524 Latin-5,
525 and
526 Latin-9 encodings
527 (8859-1,
528 8859-2,
529 8859-9,
530 and
531 8859-15,
532 respectively).
533 .
534 .
535 .TP
536 .I koi8\-r
537 supports the KOI8-R encoding.
538 .
539 KOI8-R code points in the range 0x80\[en]0x9F are not valid input to GNU
540 .IR troff ; \" GNU
541 see section \[lq]Identifiers\[rq] in
542 .MR groff 7 .
543 .
544 This should be no impediment to practical documents,
545 as these KOI8-R code points do not encode letters,
546 but box-drawing symbols and characters that are better obtained via
547 special character escape sequences;
548 see
549 .MR groff_char 7 .
550 .
551 .
552 .\" ====================================================================
553 .SS "General auxiliary packages"
554 .\" ====================================================================
555 .
556 The macro packages in this section are not intended for stand-alone
557 use,
558 but can add functionality to any other macro package or to plain
559 (\[lq]raw\[rq])
560 .I groff
561 documents.
562 .
563 .
564 .\" TODO:
565 .\" devtag
566 .\" europs
567 .\" psatk
568 .\" psfig
569 .TP 11n \" "papersize" + 2n
570 .I 62bit
571 provides macros for addition,
572 multiplication,
573 and division of 62-bit integers
574 (allowing safe multiplication of signed 31-bit integers,
575 for example).
576 .
577 .
578 .br
579 .ne 4v
580 .TP
581 .I hdtbl
582 allows the generation of tables using a syntax similar to the HTML table
583 model.
584 .
585 This Heidelberger table macro package is not a preprocessor,
586 which can be useful if the contents of table entries are determined by
587 macro calls or string interpolations.
588 .
589 Compare to
590 .MR \%tbl 1 .
591 .
592 It works only with the
593 .B ps
594 and
595 .B pdf
596 output devices.
597 .
598 See
599 .MR groff_hdtbl 7 .
600 .
601 .
602 .TP
603 .I papersize
604 enables the paper format to be set on the command line with the
605 .RB \[lq] \-d
606 .BI \%paper= fmt\c
607 \[rq]
608 option to
609 .IR \%troff .
610 .
611 Valid
612 .IR fmt s
613 are the ISO and DIN formats
614 .RB \[lq] A0 \[en] A6 \[rq],
615 .RB \[lq] B0 \[en] B6 \[rq],
616 .RB \[lq] C0 \[en] C6 \[rq],
617 and
618 .RB \[lq] D0 \[en] D6 \[rq];
619 .\" XXX: src/libs/libgroff/paper.cpp also supports [ABCD]7.
620 the U.S.\& formats
621 .RB \%\[lq] letter \[rq],
622 .RB \%\[lq] legal \[rq],
623 .RB \%\[lq] tabloid \[rq],
624 .RB \%\[lq] ledger \[rq],
625 .RB \%\[lq] statement \[rq],
626 and
627 .RB \%\[lq] executive \[rq];
628 and the envelope formats
629 .RB \%\[lq] com10 \[rq],
630 .RB \%\[lq] monarch \[rq],
631 and
632 .RB \%\[lq] DL \[rq].
633 .
634 All formats,
635 even those for envelopes,
636 are in portrait orientation:
637 the longer measurement is vertical.
638 .
639 Appending \[lq]l\[rq] (ell) to any of these denotes landscape
640 orientation instead.
641 .
642 This macro file assumes one-inch horizontal margins,
643 and sets registers recognized by the
644 .I groff
645 .IR man ,
646 .IR mdoc ,
647 .IR mm ,
648 .IR mom ,
649 and
650 .I ms
651 packages to configure them accordingly.
652 .
653 If you want different margins,
654 you will need to use those packages' facilities,
655 or
656 .I \%troff
657 .B ll
658 and/or
659 .B po
660 requests,
661 to adjust them.
662 .
663 An output device typically requires command-line options
664 .B \-p
665 and
666 .B \-l
667 to override the paper dimensions and orientation,
668 respectively,
669 defined in its
670 .I DESC
671 file;
672 see subsection \[lq]Paper format\[rq]
673 of
674 .MR groff 1 .
675 .
676 This macro file is normally loaded at startup by the
677 .I troffrc
678 file when formatting for a typesetter
679 (but not a terminal).
680 .
681 .
682 .TP
683 .I pdfpic
684 provides a single macro,
685 .BR \%PDFPIC ,
686 that operates in two modes.
687 .
688 If it is not used with
689 .IR gropdf ,
690 the given
691 .I file
692 must be a PDF;
693 .B \%PDFPIC
694 then relies on the external program
695 .MR pdftops 1
696 to convert the PDF to an encapsulated PostScript (EPS) file
697 and calls the
698 .B PSPIC
699 macro with which it shares an interface.
700 .
701 If output is to a PDF document,
702 .B \%PDFPIC
703 uses the
704 .RB \[lq] "pdf: \%pdfpic" \[rq]
705 device extension command
706 (see
707 .MR gropdf 1 );
708 the given
709 .I file
710 can then be a PDF or any graphic file format supported by
711 .IR gropdf .
712 .
713 .
714 .IP
715 Since
716 .B \%PDFPIC
717 needs to discover the width and height of the image
718 (to check if sufficient room exists to place it on the page),
719 it has dependencies on external programs as shown below.
720 .
721 .
722 .IP
723 .TS
724 allbox center;
725 Cb Ci Ci Ci
726 Li C C C.
727 \& pdfinfo\fR(1) file\fR(1) identify\fR(1)
728 \&.pdf \[OK] \[OK] \[OK]
729 \&.jpg \[u2717] \[OK] \[OK]
730 \&.jp2 \[u2717] \[u2717] \[OK]
731 \fRother \[u2717] \[u2717] \[OK]
732 .TE
733 .
734 .
735 .IP
736 To include image formats such as PNG,
737 PAM,
738 and GIF,
739 .I gropdf
740 relies upon PerlMagick modules to embed the graphic.
741 .
742 They are not needed for the types listed in the table above.
743 .
744 .
745 .IP
746 If the required programs are not available,
747 .I file
748 is treated as a PDF;
749 failure is likely if it is not one.
750 .
751 .
752 .TP
753 .I pic
754 supplies definitions of the macros
755 .BR PS ,
756 .BR PE ,
757 .BR PF ,
758 and
759 .BR PY ,
760 used with the
761 .MR \%pic 1
762 preprocessor.
763 .
764 They center each picture.
765 .
766 Use it if your document does not use a full-service macro package,
767 or that package does not supply working
768 .I pic
769 macro definitions.
770 .
771 Except for
772 .I man
773 and
774 .IR mdoc ,
775 those provided with
776 .I groff
777 already do so
778 (exception:
779 .I mm
780 employs the name
781 .B PF
782 for a different purpose).
783 .
784 .
785 .TP
786 .I pspic
787 provides a macro,
788 .BR PSPIC ,
789 that includes a PostScript graphic in a document.
790 .
791 The
792 .BR ps ,
793 .BR dvi ,
794 .BR html ,
795 and
796 .B xhtml
797 output devices support such inclusions;
798 for all other drivers,
799 the image is replaced with a rectangular border of the same size.
800 .
801 .I pspic.tmac
802 is loaded at startup by the
803 .I troffrc
804 file.
805 .
806 .
807 .br
808 .ne 3v
809 .IP
810 Its syntax is as follows.
811 .RS
812 .IP
813 \&\fB.PSPIC\fP \
814 [\fB\-L\fP\|\
815 |\|\fB\-R\fP\|\
816 |\|\fB\-C\fP\|\
817 |\|\fB\-I\fP\~\fIn\fP] \
818 \fI\|file\fP [\fIwidth\fP [\,\fIheight\/\fP]]
819 .RE
820 .
821 .
822 .IP
823 .I file
824 is the name of the PostScript file;
825 .I width
826 and
827 .I height
828 give the desired width and height of the image.
829 .
830 If neither a
831 .I width
832 nor a
833 .I height
834 argument is specified,
835 the image's natural width
836 (as given in the file's bounding box)
837 or the current line length is used as the width,
838 whatever is smaller.
839 .
840 The
841 .I width
842 and
843 .I height
844 arguments may have scaling units attached;
845 the default scaling unit
846 .RB is\~ i .
847 .
848 .B PSPIC
849 scales the graphic uniformly in the horizontal and vertical directions
850 so that it is no more than
851 .I width
852 wide
853 and
854 .I height
855 high.
856 .
857 Option
858 .B \-C
859 centers the graphic horizontally;
860 this is the default.
861 .
862 .B \-L
863 and
864 .B \-R
865 left- and right-align the graphic,
866 respectively.
867 .
868 .B \-I
869 indents the graphic
870 .RI by\~ n
871 (with a default scaling unit
872 .RB of\~ m ).
873 .
874 .
875 .IP
876 To use
877 .B PSPIC
878 within a diversion,
879 we recommend extending it with the following code,
880 assuring that the diversion's width completely covers the image's width.
881 .
882 .
883 .RS
884 .IP
885 .EX
886 \&.am PSPIC
887 \&.\~\~vpt 0
888 \&\[rs]h\[aq](\[rs]\[rs]n[ps\-offset]u + \[rs]\[rs]n[ps\-deswid]u)\[aq]
889 \&.\~\~sp \-1
890 \&.\~\~vpt 1
891 \&..
892 .EE
893 .RE
894 .
895 .
896 .IP
897 Failure to load
898 .BR PSPIC 's
899 image argument is not an error.
900 .
901 (The
902 .B psbb
903 request does issue an error diagnostic.)
904 .
905 To make such a failure fatal,
906 append to the
907 .B pspic*error\-hook
908 macro.
909 .
910 .
911 .RS
912 .IP
913 .EX
914 \&.am pspic*error\-hook
915 \&.\~\~ab
916 \&..
917 .EE
918 .RE
919 .
920 .
921 .TP
922 .I ptx
923 provides a macro,
924 .BR xx ,
925 to format permuted index entries as produced by the GNU
926 .MR ptx 1
927 program.
928 .
929 If your formatting needs differ,
930 copy the macro into your document and adapt it.
931 .
932 .
933 .TP
934 .I rfc1345
935 defines special character escape sequences named for the glyph mnemonics
936 specified in RFC\~1345 and the digraph table of the Vim text editor.
937 .
938 See
939 .MR groff_rfc1345 7 .
940 .
941 .
942 .TP
943 .I sboxes
944 offers an interface to the
945 .RB \[lq] "pdf: background" \[rq]
946 device extension command supported by
947 .MR gropdf 1 .
948 .
949 Using this package,
950 .I groff ms
951 documents can draw colored rectangles beneath any output.
952 .
953 .RS
954 .TP
955 .BI \%.BOXSTART\~SHADED\~ color\~\c
956 .BI \%OUTLINED\~ color\~\c
957 .BI \%INDENT\~ size\~\c
958 .BI \%WEIGHT\~ size
959 begins a box,
960 where the argument after
961 .B \%SHADED
962 gives the fill color and that after
963 .B \%OUTLINED
964 the border color.
965 .
966 Omit the former to get a borderless filled box and the latter for a
967 border with no fill.
968 .
969 The specified
970 .B \%WEIGHT
971 is used if the box is
972 .BR \%OUTLINED .
973 .
974 .
975 .IP
976 .B \%INDENT
977 precedes a value that leaves a gap between the border and the contents
978 inside the box.
979 .
980 .
981 .IP
982 Each
983 .I color
984 must be a defined
985 .I groff
986 color name,
987 and each
988 .I size
989 a valid
990 .I groff
991 numeric expression.
992 .
993 The keyword/value pairs can be specified in any order.
994 .RE
995 .
996 .
997 .IP
998 Boxes can be stacked,
999 so you can start a box within another box;
1000 usually the later boxes would be smaller than the containing box,
1001 but this is not enforced.
1002 .
1003 When using
1004 .BR \%BOXSTART ,
1005 the left position is the current indent minus the
1006 .B \%INDENT
1007 in the command,
1008 and the right position is the left position
1009 (calculated above)
1010 plus the current line length and twice the indent.
1011 .
1012 .
1013 .RS
1014 .TP
1015 .B \%.BOXSTOP
1016 takes no parameters.
1017 .
1018 It closes the most recently started box at the current vertical position
1019 after adding its
1020 .B \%INDENT
1021 spacing.
1022 .RE
1023 .
1024 .
1025 .IP
1026 Your
1027 .I groff
1028 documents can conditionally exercise the
1029 .I sboxes
1030 macros.
1031 .
1032 The register
1033 .B \%GSBOX
1034 is defined if the package is loaded,
1035 and interpolates a true value if the
1036 .B pdf
1037 output device is in use.
1038 .
1039 .
1040 .IP
1041 .I sboxes
1042 furthermore hooks into the
1043 .MR groff_ms 7
1044 package to receive notifications when footnotes are growing,
1045 so that it can close boxes on a page before footnotes are printed.
1046 .
1047 When that condition obtains,
1048 .I sboxes
1049 will close open boxes two points
1050 above the footnote separator and re-open them on the next page.
1051 .
1052 (This amount probably will not match the box's
1053 .BR \%INDENT .)
1054 .
1055 .
1056 .IP
1057 See
1058 .UR file:///usr/\:\%share/\:\%doc/\:\%groff/\:\%msboxes\:.pdf
1059 \[lq]Using PDF boxes with
1060 .I groff
1061 and the
1062 .I ms
1063 macros\[rq]
1064 .UE
1065 for a demonstration.
1066 .
1067 .
1068 .TP
1069 .I trace
1070 aids the debugging of
1071 .I groff
1072 documents by tracing macro calls.
1073 .
1074 See
1075 .MR groff_trace 7 .
1076 .
1077 .
1078 .TP
1079 .I www
1080 defines macros corresponding to HTML elements.
1081 .
1082 See
1083 .MR groff_www 7 .
1084 .
1085 .
1086 .\" ====================================================================
1087 .SH Naming
1088 .\" ====================================================================
1089 .
1090 AT&T
1091 .I nroff \" AT&T
1092 and
1093 .I troff \" AT&T
1094 were implemented before the conventions of the modern C
1095 .MR getopt 3
1096 call evolved,
1097 and used a naming scheme for macro packages that looks oddly terse to
1098 modern eyes.
1099 .
1100 The formatter's
1101 .B \-m
1102 option was the main means of loading a macro package,
1103 and its argument had to follow immediately without intervening space.
1104 This looked like a long option name preceded by a single minus\[em]a
1105 sensation in the computer stone age.
1106 .
1107 Macro packages therefore came to be known by names that started with the
1108 letter \[lq]m\[rq],
1109 which was omitted from the name of the macro file as stored on disk.
1110 .
1111 For example,
1112 the manuscript macro package was stored as
1113 .I tmac.s
1114 and loaded with the option
1115 .BR \-ms .
1116 .
1117 It has since become conventional in operating systems to use a suffixed
1118 file name extension to suggest a file type or format,
1119 thus we see
1120 .I roff
1121 documents with names ending in
1122 .IR .man ,
1123 .IR .me ,
1124 and so on.
1125 .
1126 .
1127 .br
1128 .ne 2v
1129 .P
1130 .I groff
1131 commands permit space between an option and its argument.
1132 .
1133 The syntax
1134 .RB \[lq] "groff \-m s" \[rq]
1135 makes the macro file name more clear but may surprise users familiar
1136 with the original convention,
1137 unaware that the package's \[lq]real\[rq] name was \[lq]s\[rq] all
1138 along.
1139 .
1140 For such packages of long pedigree,
1141 .I groff
1142 accommodates different users' expectations by supplying wrapper macro
1143 files that load the desired file with
1144 .B mso
1145 requests.
1146 .
1147 Thus,
1148 all of
1149 .RB \[lq] "groff \-m s" \[rq],
1150 .RB \[lq] "groff \-m ms" \[rq],
1151 .RB \[lq] "groff \-ms" \[rq],
1152 and
1153 .RB \[lq] "groff \-mms" \[rq]
1154 serve to load the manuscript macros.
1155 .
1156 .
1157 .\" ====================================================================
1158 .SH Inclusion
1159 .\" ====================================================================
1160 .
1161 The traditional method of employing a macro package is to specify the
1162 .RB \[lq] \-m
1163 .IR package \[rq]
1164 option to the formatter,
1165 which then reads
1166 .IR package 's
1167 macro file prior to any input.
1168 .
1169 Historically,
1170 .I package
1171 was sought in a file named
1172 .IR tmac. package
1173 (that is,
1174 with a
1175 .RB \[lq] tmac.\& \[rq]
1176 prefix).
1177 .
1178 GNU
1179 .I troff \" GNU
1180 searches for
1181 .RI package .tmac
1182 in the macro path;
1183 if not found,
1184 it looks for
1185 .IR tmac. package
1186 instead,
1187 and vice versa.
1188 .
1189 .
1190 .P
1191 Alternatively,
1192 one could include a macro file with the request
1193 .RB \[lq] so
1194 .IR file-name \[rq];
1195 the argument is resolved as
1196 .MR fopen 3
1197 would,
1198 from the current working directory of the formatter.
1199 .
1200 This approach was inadequate to locate macro packages,
1201 since systems stored them in varying locations.
1202 .
1203 GNU
1204 .I troff \" GNU
1205 offers an improved feature in the similar request
1206 .RB \[lq] mso
1207 .IR package-file-name \[rq],
1208 which searches the macro path for
1209 .IR package-file-name .
1210 .
1211 Because its argument is a file name,
1212 its
1213 .RB \[lq] .tmac \[rq]
1214 component must be included for the file to be found.
1215 .
1216 .
1217 .P
1218 If a sourced file requires preprocessing,
1219 for example if it includes
1220 .I tbl \" generic
1221 tables
1222 or
1223 .I eqn \" generic
1224 equations,
1225 the preprocessor
1226 .MR \%soelim 1
1227 must be used.
1228 .
1229 This can be achieved with a pipeline or by specifying the
1230 .B \-s
1231 option to
1232 .MR groff 1 .
1233 .
1234 .MR man 1
1235 librarian programs typically run
1236 .I \%soelim
1237 automatically.
1238 .
1239 (As a rule,
1240 macro packages themselves do not require preprocessing.)
1241 .
1242 .
1243 .ig
1244 .\" ====================================================================
1245 .SH Convention
1246 .\" ====================================================================
1247 .
1248 .\" This section does not fit into the framework of this document.
1249 .
1250 There is a convention that is supported by many modern roff
1251 typesetters and
1252 .MR man 1
1253 programs, the
1254 .I preprocessor word
1255 described in the following.
1256 .
1257 .P
1258 If the first line in a document is a comment, the first word (after the
1259 comment characters and a blank) constitutes the
1260 .B preprocessor
1261 .BR word .
1262 That means that the letters of this word are interpreted as
1263 abbreviations for those preprocessor commands that should be run
1264 when formatting the document.
1265 .
1266 Mostly, only the letters corresponding to the options for the
1267 preprocessors are recognized,
1268 \[oq]e\[cq]
1269 (for
1270 .IR eqn ),
1271 .\" \[oq]G\[cq],
1272 .\" \[oq]g\[cq],
1273 \[oq]p\[cq]
1274 (for
1275 .IR pic ),
1276 \[oq]R\[cq]
1277 (for
1278 .IR refer ),
1279 \[oq]s\[cq]
1280 (for
1281 .IR soelim ),
1282 and
1283 \[oq]t\[cq]
1284 (for
1285 .IR tbl ).
1286 (see
1287 .MR roff 7 ).
1288 .
1289 .
1290 .P
1291 Besides being a good reminder for the user, some formatters (like the
1292 .MR man 1
1293 program) are even able to automatically start the preprocessors
1294 specified in the preprocessor word, but do not bet on this.
1295 .
1296 .
1297 .P
1298 The
1299 .I man
1300 program handles some preprocessors automatically, such that in
1301 man\~pages only the following characters should be used:
1302 \[oq]e\[cq], \[oq]p\[cq], and \[oq]t\[cq].
1303 .
1304 .
1305 ..
1306 .\" XXX: The next section requires significant revision.
1307 .\" ====================================================================
1308 .SH "Writing macros"
1309 .\" ====================================================================
1310 .
1311 A
1312 .MR roff 7
1313 document is a text file that is enriched by predefined formatting
1314 constructs, such as requests, escape sequences, strings, numeric
1315 registers, and macros from a macro package.
1316 .
1317 .MR roff 7
1318 describes these elements.
1319 .
1320 .
1321 .P
1322 To give a document a personal style, it is most useful to extend the
1323 existing elements by defining some macros for repeating tasks; the best
1324 place for this is near the beginning of the document or in a separate
1325 file.
1326 .
1327 .
1328 .P
1329 Macros without arguments are just like strings.
1330 .
1331 But the full power of macros occurs when arguments are passed with a
1332 macro call.
1333 .
1334 Within the macro definition, the arguments are available as the escape
1335 sequences
1336 .BR \[rs]$1 ,
1337 \&.\|.\|.,
1338 .BR \[rs]$9 ,
1339 .BR \[rs]$[ .\|.\|. ] ,
1340 .BR \[rs]$* ,
1341 and
1342 .BR \[rs]$@ ,
1343 the name under which the macro was called is in
1344 .BR \[rs]$0 ,
1345 and the number of arguments is in register
1346 .BR \[rs]n[.$] ;
1347 see
1348 .MR groff 7 .
1349 .
1350 .
1351 .\" ====================================================================
1352 .SS "Drafting macros"
1353 .\" ====================================================================
1354 .
1355 One approach temporarily disables escape sequences
1356 by bracketing a macro definition with
1357 .B eo
1358 and
1359 .B ec
1360 requests.
1361 .
1362 .
1363 .IP
1364 .RS
1365 .ds @1 \[rs]f[I]\[rs]$0\[rs]f[]\"
1366 .ds @2 arguments:\"
1367 .EX
1368 \&.eo
1369 \&.ds midpart was called with the following
1370 \&.de print_args
1371 \&\*[@1]\~\[rs]*[midpart]\~\[rs]n[.$]\~\*[@2] \[rs]$*
1372 \&..
1373 \&.ec
1374 .EE
1375 .rm @1
1376 .rm @2
1377 .RE
1378 .
1379 .
1380 .P
1381 The above procedure has limitations;
1382 it is unsuitable for a macro that requires certain interpolations at the
1383 time it is defined,
1384 or for indirect definitions of identifiers.
1385 .
1386 See section \[lq]Copy mode\[rq] of
1387 .MR groff 7 .
1388 .
1389 In such cases,
1390 you might define and test the macro with the escape character doubled
1391 before escape sequences that are interpreted even in copy mode,
1392 then bracket it with
1393 .B eo
1394 and
1395 .B ec
1396 requests,
1397 un-double the escape characters,
1398 then test again.
1399 .
1400 .
1401 .\" ====================================================================
1402 .SS "Tips for macro definitions"
1403 .\" ====================================================================
1404 .
1405 .IP \(bu 3n
1406 Use only control lines in macro definitions;
1407 that is,
1408 start every input line with a control character.
1409 .
1410 .IR groff 's
1411 .B nop
1412 request makes use of text lines unnecessary.
1413 .
1414 .
1415 .RS
1416 .IP
1417 .EX
1418 \&.de Text
1419 \&. if (\[rs]\[rs]n[.$] == 0) \[rs]
1420 \&. return
1421 \&. nop \[rs]&\[rs]\[rs]$*\[rs]&
1422 \&..
1423 .EE
1424 .RE
1425 .
1426 .
1427 .IP \(bu
1428 Write a comment macro that works in both draft and non-draft modes;
1429 since the escape character is disabled in draft mode,
1430 trouble might occur when comment escape sequences are used.
1431 .
1432 .\" XXX: We need the vees.
1433 .ig
1434 For example,
1435 the following macro ignores its arguments,
1436 so calling it is a harmless
1437 (if somewhat busy)
1438 null operation.
1439 ..
1440 .
1441 .RS
1442 .IP
1443 .EX
1444 \&.de c
1445 \&..
1446 \&.c This is my comment.
1447 .EE
1448 .RE
1449 .
1450 .
1451 .IP \(bu
1452 Comment lengthy macro definitions.
1453 .
1454 .
1455 .IP \(bu
1456 Use empty requests,
1457 and indentation after control characters,
1458 to clarify a macro's structure.
1459 .
1460 .
1461 .\" ====================================================================
1462 .SH Authors
1463 .\" ====================================================================
1464 .
1465 This document was written by
1466 .MT wl@\:gnu\:.org
1467 Werner Lemberg
1468 .ME
1469 and
1470 .MT g.branden\:.robinson@\:gmail\:.com
1471 G.\& Branden Robinson
1472 .ME .
1473 .
1474 .
1475 .\" ====================================================================
1476 .SH "See also"
1477 .\" ====================================================================
1478 .
1479 .IR "Groff: The GNU Implementation of troff" ,
1480 by Trent A.\& Fisher and Werner Lemberg,
1481 is the primary
1482 .I groff
1483 manual.
1484 .
1485 You can browse it interactively with \[lq]info groff\[rq].
1486 .
1487 .
1488 .TP 18n "groff_rfc1345(7)" + 2n
1489 .MR groff 1
1490 is an overview of the
1491 .I groff
1492 system.
1493 .
1494 .
1495 .TP
1496 .MR groff_man 7 ,
1497 .TQ
1498 .MR groff_mdoc 7 ,
1499 .TQ
1500 .MR groff_me 7 ,
1501 .TQ
1502 .MR groff_mm 7 ,
1503 .TQ
1504 .MR groff_mom 7 ,
1505 .TQ
1506 .MR groff_ms 7 ,
1507 .TQ
1508 .MR groff_rfc1345 7 ,
1509 .TQ
1510 .MR groff_trace 7 ,
1511 .TQ
1512 and
1513 .TQ
1514 .MR groff_www 7
1515 are
1516 .I groff
1517 macro packages.
1518 .
1519 .
1520 .TP
1521 .MR groff 7
1522 summarizes the language recognized by GNU
1523 .IR troff . \" GNU
1524 .
1525 .
1526 .TP
1527 .MR \%troff 1
1528 documents the default macro file search path.
1529 .
1530 .
1531 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
1532 .cp \n[*groff_groff_tmac_5_man_C]
1533 .do rr *groff_groff_tmac_5_man_C
1534 .
1535 .
1536 .\" Local Variables:
1537 .\" fill-column: 72
1538 .\" mode: nroff
1539 .\" End:
1540 .\" vim: set filetype=groff textwidth=72: