summaryrefslogtreecommitdiff
path: root/contrib/pdfmark/spdf.tmac
blob: c7af6dc3b22447c3dc3f7199d43116f9800841bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.\" -*- nroff -*-
.ig

spdf.tmac

Copyright (C) 2004, 2009
  Free Software Foundation, Inc.
     Written by Keith Marshall (keith.d.marshall@ntlworld.com)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or
(at your option) any later version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

..
.\"
.if !rOPMODE .nr OPMODE 1
.\"
.mso s.tmac
.mso pdfmark.tmac
.\"
.\" Omitted Sections
.\" ================
.\"
.\" Define section markers, for special document sections,
.\" which are to be omitted from regular document processing.
.\"
.de OMIT OMIT
.de \\$1
.omit@begin \\$1 \\$2
..
.de \\$2
.omit@end \\$1 \\$2
..
.OMIT CS CE    \" front cover text, processed independently
.OMIT MS ME    \" menu definitions, for info documents only
.\"
.de omit@begin
.ds omit@section \\$1
.ig \\$2
..
.de omit@end
.if !'\\*[omit@section]'\\$1' .@error \\$2 without \\$1
.rm omit@section
..
.de XM
.\"
.pdfhref M -X \\$@
..
.de XR
.if \\n(.$ \{\
.   if \\n[OPMODE] \{\
.      ds spdf!opts -D "\\$1"
.      if \\n(.$>1 .as spdf!opts " -A "\\$2"
.      if \\n(.$>2 .as spdf!opts " -P "\\$3"
.      pdfhref L \\*[spdf!opts]
.      rm spdf!opts
.      \}
.   \}
..
.\"
.\" Document Outlines, Section Headings and Table of Contents
.\" =========================================================
.\"
.de XN
.\" Use AFTER .NH n, to define the text of the numbered heading,
.\" automatically generating a matching formatted TOC entry, and
.\" a PDF document outline entry.
.\"
.\" String registers XNVS1, XNVS2 and XNVS3 establish additional leading,
.\" prior to top level headings, preceding each level of indented subheading,
.\" and following each nested level of subheading, respectively
.\" (strings are used, rather than numeric registers, so that these
.\"  additional spacing parameters may be set relative to the current
.\"  document line spacing, as set by \n[VS]).
.\"
.rm xn*ref
.while dopt*XN\\$1 \{\
.   opt*XN\\$1 \\$*
.   shift \\n[xn*argc]
.   \}
.rr xn*argc
.if '\\$1'--' .shift
.if dxn*ref .XM -N \\*[xn*ref] -- \\$@
.rm xn*ref
.pdfhref O \\n[nh*hl] "\\*(SN \\$*"
.XS
.if rtc*hl \{\
.   if !dXNVS1 .ds XNVS1 1.0v  \" default leading for top level
.   if !dXNVS2 .ds XNVS2 0.3v  \" default leading at nesting increment
.   if !dXNVS3 .ds XNVS3 0.6v  \" default leading following nested group
.   if \\n[nh*hl]==1 \{\
.      sp \\*[XNVS1]
.      nr tc*hl-max 1
.      \}
.   ie \\n[nh*hl]<\\n[tc*hl] .if \\n[nh*hl]>1 .sp \\*[XNVS3]
.   el \{\
.      ie \\n[nh*hl]>\\n[tc*hl] .sp \\*[XNVS2]
.      el \{\
.         if !r tc*hl-max .nr tc*hl-max 1
.         ie \\n[tc*hl-max]>\\n[nh*hl] .sp \\*[XNVS3]
.         el .nr tc*hl-max \\n[nh*hl]
.         \}
.      \}
.   \}
.nr tc*hl \\n[nh*hl]
\h'\\n[nh*hl]-1m'\c
\&\\*(SN\h'1n'\\$*
.\".pdfhref L -D \\*[PDFBOOKMARK.NAME] -- \&\\*(SN\h'1n'\\$*
.XE
\&\\$*
..
.de opt*XN-N
.nr xn*argc 2
.ds xn*ref \\$2
..
.de opt*XN-X
.nr xn*argc 1
.if !dxn*ref .ds xn*ref \\\\$1
..
.de LU
.LP
The content for this section is not yet available.
..
.de AN
.ie \\n(.$ .@AN \\$*
.el .@AN Note
..
.de @AN
.SH
\\$*
.LP
..
.nr PDF-TOC-ONLY  1
.nr PDF-BODY-TEXT 2
.de OP
.ie rPHASE \{\
.   ie \\n(.$ \{\
.      nr op:request 0
.      while \\n(.$ \{\
.         if \\$1=\\n[PHASE] .nr op:request 1
.         shift
.         \}
.      \}
.   el .nr op:request 1
.   if !\\n[op:request]=\\n[OPMODE] \{\
.      nr OPMODE \\n[op:request]
.      nop \O[\\n[OPMODE]]\c
.      \}
.   \}
.el .nr OPMODE 1
..
.nr SAME-PAGE 0
.de NN
.if !\\n[SAME-PAGE] .bp
.nr SAME-PAGE 0
.NH \\$1
.nn*setname \\$2
.shift 2
.XN -N \\*[nn*name] -- \\$@
.rm nn*name
..
.de nn*setname
.ds nn*name \\$1
.shift
.while \\n(.$ \{\
.   as nn*name -\\$1
.   shift
.   \}
..
.de PXREF
.nn*setname \\$2
.XR \\*[nn*name] )\\$1 (
.rm nn*name
..
.de IS
.RS
.nr LL \\n(LL-\\n(PI
..
.de IE
.RE
.nr LL \\n(LL+\\n(PI
..
.\" Override the standard ms macro,
.\" to ensure the document outline cache is flushed
.\" BEFORE emitting the table of contents.
.de TC
.pdfsync O
.P1
.OP \n[PDF-TOC-ONLY]
.pg@begin 1 i
.if \\n[OPMODE] .pdf@toc
.PX \\$1
..
.de pdf@toc
.pdfhref O -T T 1 "\\*[TOC]"
.pdfsync O
..
.de pdf@exit
.if \\n[OPMODE] .pdfsync
.pg@end-text
..
.em pdf@exit
.OP \n[PDF-BODY-TEXT]
.
.\" groff "ms" provides the "pg@bottom" macro, which has already
.\" been installed as a page transition trap.  To ensure proper
.\" mapping of "pdfhref" links which overflow the bottom of any
.\" page, we need to install the "pdfhref" page transition hook,
.\" as an addendum to this macro.
.
.pdfhref I -PT pg@bottom
.\"
.\" spdf.tmac: end of file: vim: ft=groff