From 92cae99163d60cc0e2fec3a24bdfced2daee0190 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Fri, 21 Feb 2020 18:19:55 +0100 Subject: [PATCH] Table of contents --- 98-misc/toc.tex | 39 +++++++++++++++++++++++++++++++++++++++ ds.tex | 2 ++ 2 files changed, 41 insertions(+) create mode 100644 98-misc/toc.tex diff --git a/98-misc/toc.tex b/98-misc/toc.tex new file mode 100644 index 0000000..74be4dd --- /dev/null +++ b/98-misc/toc.tex @@ -0,0 +1,39 @@ +\fakechapter{Table of contents} + +\def\tocchaplabel#1#2^^X{\if0#1\else#1#2~\fi} +\def\tocchapter#1#2#3#4{\bigskip + \line{\bf\tocchaplabel#2^^X\toclink{#2}{#4}\hfil\pagelink{#1}} + \tocoutline{#2}{#4} +} +\def\tocsection#1#2#3#4{% + \line{\qquad#2#3~~\toclink{#2}{#4}\hfil\pagelink{#1}} + \tocoutline{#2}{#4} +} +\def\toclink#1#2{% + \ifprint + #2 + \else + \pdfextension startlink\commonlinkargs goto name {s#1}\relax #2\pdfextension endlink + \fi +} +\def\tocoutline#1#2{ + \ifprint\else + \directlua{pdfmeta.add_outline('\luaescapestring{#1}', '\luaescapestring{s#1}', '\luaescapestring{#2}')} + \fi +} +\def\tocstar{\rlap{*}} + +{ +\catcode`@=11 +\catcode`*=\active +\let*=\tocstar +\input toc.aux +\catcode`@=12 +} + +\bigskip + +Sections and exercises marked with one or two asterisks contain advanced material. +We suggest that the reader skips them first time. + +\vfill\eject diff --git a/ds.tex b/ds.tex index 86d3472..5a6af27 100644 --- a/ds.tex +++ b/ds.tex @@ -4,6 +4,8 @@ %\debuggrid %\debugindex +\input 98-misc/toc.tex + \def\includechapaux#1-#2@{\input #1-#2/#2.tex} \def\includechapter#1{\includechapaux#1@} \input chapters.tex -- GitLab