From 8379012d545fd6a59fae8842d97d14ec0c2b27d7 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 13 Feb 2020 03:00:51 +0000 Subject: CTAN sync 202002130300 --- macros/luatex/optex/outlines.opm | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 macros/luatex/optex/outlines.opm (limited to 'macros/luatex/optex/outlines.opm') diff --git a/macros/luatex/optex/outlines.opm b/macros/luatex/optex/outlines.opm new file mode 100644 index 0000000000..e95f4ec9c5 --- /dev/null +++ b/macros/luatex/optex/outlines.opm @@ -0,0 +1,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{}" creates +such outlines from data used for table of contents in the document. The +"" 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{}" 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. -- cgit v1.2.3