'\" '\" Macros for doing pdfmarks '\" .de specialps \\k_\X'ps: \\$*'\h'|\\n_u'\c .. .de pdfmark . specialps exec [\\$1 pdfmark .. '\" pdfdest LINKNAME .de pdfdest .pdfmark "/Dest /\\$1 /View [/XYZ -5 PL null] /DEST" .. '\" pdfbookmark COUNT LINKNAME STRING .de pdfbookmark . pdfmark "/View [/XYZ 44 730 1.0] /Count \\$1 /Dest /\\$2 /Title (\\$3) /OUT" .. '\" '\" Define the heading user exit macro HZ to save pdfmark information '\" in "arrays" of numbers and strings. '\" .nr rr_n 0 1 .de HZ . ds hhh \\*[hd*mark] . chop hhh . chop hhh . nr rr_levels!\\n+[rr_n] \\$1 . ds rr_labels!\\n[rr_n] \\*[hhh] \\$3 . pdfdest Link\\n[rr_n] .. '\" '\" Call this from macro EOD to generate the pdfmark outline '\" .de pdf_outline .nr rr_levels!\\n+[rr_n] 1 .nr rr_i 0 1 .while \\n+[rr_i]<\\n[rr_n] \{\ . nr rr_ip1 \\n[rr_i]+1 . nr rr_count 0 . if \\n[rr_levels!\\n[rr_ip1]]>\\n[rr_levels!\\n[rr_i]] \{\ . nr rr_j \\n[rr_i] 1 . while \\n+[rr_j]<\\n[rr_n] \{\ . if \\n[rr_levels!\\n[rr_j]]<=\\n[rr_levels!\\n[rr_i]] \{\ . break . \} . if \\n[rr_levels!\\n[rr_j]]==(\\n[rr_levels!\\n[rr_i]]+1) \{\ . nr rr_count \\n[rr_count]+1 . \} . \} . \} . ds hhh \\*[rr_labels!\\n[rr_i]] . pdfbookmark \\n[rr_count] Link\\n[rr_i] "\\*[hhh]" .\} .. '\" '\" EOD - End of Document macro. Call this at end of document. '\" '\" Output pdfmarks, the table of contents, and a psselect fixup script '\" which can be run to put the TC in the right place. '\" .de EOD .pdf_outline .TC .bp .af P 1 .nr ncpp1 \\nP-2 .nr ncpp2 \\nP-1 .sy echo psselect -p1-2 -p_\\n[ncpp1]-_2 -p3-_\\n[ncpp2] > \*[doc_file].fixup .sy chmod 755 \*[doc_file].fixup ..