-*- nroff -*-
spdf.tmac Copyright (C) 2004 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 2, 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 groff; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. ..

.mso s.tmac .mso pdfmark.tmac
Omitted Sections
================

Define section markers, for special document sections,
which are to be omitted from regular document processing.

.omit@begin \\$1 \\$2 .. .omit@end \\$1 \\$2 .. .OMIT CS CE \" front cover text, processed independently .OMIT MS ME \" menu definitions, for info documents only
.. ..
.pdfhref M -X \\$@ .. . 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
=========================================================

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]).

.while dopt*XN\\$1 \{\ . opt*XN\\$1 \\$* . shift \\n[xn*argc] . \} .rr xn*argc .pdfhref O \\n[nh*hl] "\\*(SN \\$*" .XS . 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 \\$* .. .nr xn*argc 2 .. .nr xn*argc 1 ..

The content for this section is not yet available. .. ..

\\$*

.. .nr PDF-TOC-ONLY 1 .nr PDF-BODY-TEXT 2 . 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 . \} . \} .. .nr SAME-PAGE 0 .nr SAME-PAGE 0 .nn*setname \\$2 .shift 2 .XN -N \\*[nn*name] -- \\$@ .. .shift .while \\n(.$ \{\ . as nn*name -\\$1 . shift . \} .. .nn*setname \\$2 .XR \\*[nn*name] )\\$1 ( ..

.nr LL \\n(LL-\\n(PI ..

.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.
.pdfsync O

1 .OP \n[PDF-TOC-ONLY] .pg@begin 1 i

X \\$1 .. .pdfhref O -T T 1 "\\*[TOC]" .pdfsync O .. .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