blob: e95f4ec9c5f81eb3a9b0cb93f51d4725f7971f50 (
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
|
%% This is part of OpTeX project, see http://petr.olsak.net/optex
\_codedecl \pdfunidef {PDFunicode strings for outlines <2019-05-21>}
\_def\_outlines#1{\_pdfcatalog{/PageMode/UseOutlines}\openref
\_ifx\_toclist\_empty
\_opwarning{\noexpand\outlines -- data unavailable. TeX me again}%
\_else
\_ifx\_urlcolor\_empty
\opwarning{\_noexpand\outlines doesn't work when \_noexpand\hyperlinks isn't declared}\_fi
{\_let\_tocline=\_outlinesA
\_count0=0 \_count1=0 \_toclist % calculate numbers o childs
\_def\_outlinelevel{#1}\_let\_tocline=\_outlinesB
\_count0=0 \_count1=0 \_toclist}% create outlines
\_fi
}
\_def\_outlinesA#1#2#3#4#5{%
\_advance\_count#1 by1
\_ifcase#1\_or
\_addoneol{_ol:\_the\_count0}\_or
\_addoneol{_ol:\_the\_count0:\_the\_count1}\_fi
}
\_def\_addoneol#1{%
\_ifcsname #1\_endcsname
\_tmpnum=\_csname#1\_endcsname\_relax
\_advance\_tmpnum by1 \_sxdef{#1}{\_the\_tmpnum}%
\_else \_sxdef{#1}{1}%
\_fi
}
\_def\_outlinesB#1#2#3#4#5{%
\_advance\_count#1 by1
\_ifcase#1\_tmpnum=\_csifdefined{_ol:\_the\_count0}{0}\_relax\_or
\_tmpnum=\_csifdefined{_ol:\_the\_count0:\_the\_count1}{0}\_relax\_or
\_tmpnum = 0\_relax\_fi
\_pdfunidef\_tmp{#4}%
\_outlinesC{#1}{toc:\tocilabel.#3}{\_ifnum#1<\_outlinelevel\_space\_else-\_fi}{\_tmpnum}{\_tmp}%
}
\_def\_csifdefined#1#2{\_ifcsname #1\_endcsname \_csname#1\_endcsname \_else #2\_fi}
\_def\_outlinesC#1#2#3#4#5{\_pdfoutline goto name{#2} count #3#4{#5}\_relax}
\_newcount\_oulnum
\_def\_insertoutline#1{\_global\_advance\_oulnum by1
\_pdfdest name{oul:\_the\_oulnum} xyz\_relax
\_pdfoutline goto name{oul:\_the\_oulnum} count0 {#1}\_relax
}
\_public
\outlines \insertoutline ;
\_endcode % ----------------------------
The PDF format provides ``outlines'' which are notes placed in the special frame of
the PDF viewer. These notes can be managed as structured and hyperlinked
table of contents of the document. The command "\outlines{<level>}" creates
such outlines from data used for table of contents in the document. The
"<level>" parameter gives the level of opened sub-outlines
in the default view. The deeper levels can be open by mouse click on the
triangle symbol after that.
The command "\insertoutline{<text>}" inserts next entry into PDF outlines at
the main level~0. This entry can be placed before table of contents (created
by "\outlines") or after it.
|