groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / contrib / pdfmark / spdf.tmac
CommitLineData
465b256c
JR
1.\" -*- nroff -*-
2.ig
3
4spdf.tmac
5
4d3e9548 6Copyright (C) 2004, 2009
465b256c
JR
7 Free Software Foundation, Inc.
8 Written by Keith Marshall (keith.d.marshall@ntlworld.com)
9
10This file is part of groff.
11
12groff is free software; you can redistribute it and/or modify it under
13the terms of the GNU General Public License as published by the Free
4d3e9548
JL
14Software Foundation, either version 3 of the License, or
15(at your option) any later version.
465b256c
JR
16
17groff is distributed in the hope that it will be useful, but WITHOUT ANY
18WARRANTY; without even the implied warranty of MERCHANTABILITY or
19FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20for more details.
21
4d3e9548
JL
22You should have received a copy of the GNU General Public License
23along with this program. If not, see <http://www.gnu.org/licenses/>.
465b256c
JR
24
25..
26.\"
27.if !rOPMODE .nr OPMODE 1
28.\"
29.mso s.tmac
30.mso pdfmark.tmac
31.\"
32.\" Omitted Sections
33.\" ================
34.\"
35.\" Define section markers, for special document sections,
36.\" which are to be omitted from regular document processing.
37.\"
38.de OMIT OMIT
39.de \\$1
40.omit@begin \\$1 \\$2
41..
42.de \\$2
43.omit@end \\$1 \\$2
44..
45.OMIT CS CE \" front cover text, processed independently
46.OMIT MS ME \" menu definitions, for info documents only
47.\"
48.de omit@begin
49.ds omit@section \\$1
50.ig \\$2
51..
52.de omit@end
53.if !'\\*[omit@section]'\\$1' .@error \\$2 without \\$1
54.rm omit@section
55..
56.de XM
57.\"
58.pdfhref M -X \\$@
59..
60.de XR
61.if \\n(.$ \{\
62. if \\n[OPMODE] \{\
63. ds spdf!opts -D "\\$1"
64. if \\n(.$>1 .as spdf!opts " -A "\\$2"
65. if \\n(.$>2 .as spdf!opts " -P "\\$3"
66. pdfhref L \\*[spdf!opts]
67. rm spdf!opts
68. \}
69. \}
70..
71.\"
72.\" Document Outlines, Section Headings and Table of Contents
73.\" =========================================================
74.\"
75.de XN
76.\" Use AFTER .NH n, to define the text of the numbered heading,
77.\" automatically generating a matching formatted TOC entry, and
78.\" a PDF document outline entry.
79.\"
80.\" String registers XNVS1, XNVS2 and XNVS3 establish additional leading,
81.\" prior to top level headings, preceding each level of indented subheading,
82.\" and following each nested level of subheading, respectively
83.\" (strings are used, rather than numeric registers, so that these
84.\" additional spacing parameters may be set relative to the current
85.\" document line spacing, as set by \n[VS]).
86.\"
87.rm xn*ref
88.while dopt*XN\\$1 \{\
89. opt*XN\\$1 \\$*
90. shift \\n[xn*argc]
91. \}
92.rr xn*argc
93.if '\\$1'--' .shift
94.if dxn*ref .XM -N \\*[xn*ref] -- \\$@
95.rm xn*ref
96.pdfhref O \\n[nh*hl] "\\*(SN \\$*"
97.XS
98.if rtc*hl \{\
99. if !dXNVS1 .ds XNVS1 1.0v \" default leading for top level
100. if !dXNVS2 .ds XNVS2 0.3v \" default leading at nesting increment
101. if !dXNVS3 .ds XNVS3 0.6v \" default leading following nested group
102. if \\n[nh*hl]==1 \{\
103. sp \\*[XNVS1]
104. nr tc*hl-max 1
105. \}
106. ie \\n[nh*hl]<\\n[tc*hl] .if \\n[nh*hl]>1 .sp \\*[XNVS3]
107. el \{\
108. ie \\n[nh*hl]>\\n[tc*hl] .sp \\*[XNVS2]
109. el \{\
110. if !r tc*hl-max .nr tc*hl-max 1
111. ie \\n[tc*hl-max]>\\n[nh*hl] .sp \\*[XNVS3]
112. el .nr tc*hl-max \\n[nh*hl]
113. \}
114. \}
115. \}
116.nr tc*hl \\n[nh*hl]
117\h'\\n[nh*hl]-1m'\c
118\&\\*(SN\h'1n'\\$*
119.\".pdfhref L -D \\*[PDFBOOKMARK.NAME] -- \&\\*(SN\h'1n'\\$*
120.XE
121\&\\$*
122..
123.de opt*XN-N
124.nr xn*argc 2
125.ds xn*ref \\$2
126..
127.de opt*XN-X
128.nr xn*argc 1
129.if !dxn*ref .ds xn*ref \\\\$1
130..
131.de LU
132.LP
133The content for this section is not yet available.
134..
135.de AN
136.ie \\n(.$ .@AN \\$*
137.el .@AN Note
138..
139.de @AN
140.SH
141\\$*
142.LP
143..
144.nr PDF-TOC-ONLY 1
145.nr PDF-BODY-TEXT 2
146.de OP
147.ie rPHASE \{\
148. ie \\n(.$ \{\
149. nr op:request 0
150. while \\n(.$ \{\
151. if \\$1=\\n[PHASE] .nr op:request 1
152. shift
153. \}
154. \}
155. el .nr op:request 1
156. if !\\n[op:request]=\\n[OPMODE] \{\
157. nr OPMODE \\n[op:request]
158. nop \O[\\n[OPMODE]]\c
159. \}
160. \}
161.el .nr OPMODE 1
162..
163.nr SAME-PAGE 0
164.de NN
165.if !\\n[SAME-PAGE] .bp
166.nr SAME-PAGE 0
167.NH \\$1
168.nn*setname \\$2
169.shift 2
170.XN -N \\*[nn*name] -- \\$@
171.rm nn*name
172..
173.de nn*setname
174.ds nn*name \\$1
175.shift
176.while \\n(.$ \{\
177. as nn*name -\\$1
178. shift
179. \}
180..
181.de PXREF
182.nn*setname \\$2
183.XR \\*[nn*name] )\\$1 (
184.rm nn*name
185..
186.de IS
187.RS
188.nr LL \\n(LL-\\n(PI
189..
190.de IE
191.RE
192.nr LL \\n(LL+\\n(PI
193..
194.\" Override the standard ms macro,
195.\" to ensure the document outline cache is flushed
196.\" BEFORE emitting the table of contents.
197.de TC
198.pdfsync O
199.P1
200.OP \n[PDF-TOC-ONLY]
201.pg@begin 1 i
202.if \\n[OPMODE] .pdf@toc
203.PX \\$1
204..
205.de pdf@toc
206.pdfhref O -T T 1 "\\*[TOC]"
207.pdfsync O
208..
209.de pdf@exit
210.if \\n[OPMODE] .pdfsync
211.pg@end-text
212..
213.em pdf@exit
214.OP \n[PDF-BODY-TEXT]
215.
216.\" groff "ms" provides the "pg@bottom" macro, which has already
217.\" been installed as a page transition trap. To ensure proper
218.\" mapping of "pdfhref" links which overflow the bottom of any
219.\" page, we need to install the "pdfhref" page transition hook,
220.\" as an addendum to this macro.
221.
222.pdfhref I -PT pg@bottom
223.\"
224.\" spdf.tmac: end of file: vim: ft=groff