]> mj.ucw.cz Git - saga.git/commitdiff
Table of contents.
authorMartin Mares <mj@ucw.cz>
Sat, 19 Apr 2008 17:00:20 +0000 (19:00 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 19 Apr 2008 17:00:20 +0000 (19:00 +0200)
Makefile
adv.tex
dyn.tex
macros.tex
rank.tex
saga.tex

index 9d0d809915802ea260c2d115506800b4c9cadde9..e387ee03f7f5ccc5f7fb61dd279c555a5a981e5a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ saga.dvi: $(addsuffix .tex,$(CHAPTERS))
        dvipdfm -o $@ -p a4 -r 600 -z 9 $<
 
 mostlyclean:
-       rm -f *.dvi *.log *~ core *.o *.aux *.bbl *.blg *.ids
+       rm -f *.dvi *.log *~ core *.o *.aux *.bbl *.blg *.ids *.toc
 
 clean: mostlyclean
        rm -f *.ps *.pdf
diff --git a/adv.tex b/adv.tex
index b5ca2324bf23ce2a35f31486f550ae0bae9b2e0b..105152596f09bf8a62562fd16b6c6518186c8da7 100644 (file)
--- a/adv.tex
+++ b/adv.tex
@@ -1051,7 +1051,7 @@ preprocessing in linear time, the queries require $\Omega(\alpha(n))$ time.
 
 %--------------------------------------------------------------------------------
 
-\section{A~randomized algorithm}\id{randmst}%
+\section{A randomized algorithm}\id{randmst}%
 
 When we analysed the contractive Bor\o{u}vka's algorithm in Section~\ref{contalg},
 we observed that while the number of vertices per iteration decreases exponentially,
diff --git a/dyn.tex b/dyn.tex
index 302425656cd02273ce3b65ac7c7edca6ba1df913..41a5e2de52da9cd1962aeec65e7fcb5dad9267c9 100644 (file)
--- a/dyn.tex
+++ b/dyn.tex
@@ -515,7 +515,7 @@ to fit our needs, so we omit the details.
 
 %--------------------------------------------------------------------------------
 
-\section{Dynamic MSF}
+\section{Dynamic spanning forests}
 
 Let us turn our attention back to the dynamic MSF now.
 Most of the early algorithms for dynamic connectivity also imply $\O(n^\varepsilon)$
index 9dba90d1254a2e17775ee07d50a5d61d843b286e..77f8c26443323961e9cdeb5aacbba3d155f70d97 100644 (file)
 \thmcount=0
 \def\currentid{??}
 
-\def\chapter#1{\vfill\supereject
-\advance\chapcount by 1
+\def\rawchapter#1{\vfill\supereject
+\leftline{\chapfont #1}
+\bigskip
+}
+
+\def\chapter#1{\advance\chapcount by 1
 \seccount=0
 \thmcount=0
 \footcnt=0
 \edef\currentid{\the\chapcount}
-\leftline{\chapfont\currentid. #1}
-\bigskip
+\rawchapter{\currentid. #1}
+\writetoc{chap}{#1}
 }
 
 \def\section#1{\bigskip
 \thmcount=0
 \edef\currentid{\the\chapcount.\the\seccount}
 \leftline{\secfont\currentid. #1}
+\nobreak
 \medskip
+\nobreak
+\writetoc{sec}{#1}
 }
 
 \def\para{\advance\thmcount by 1
 \def\proof{\noindent {\sl Proof.}\enspace}
 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
 
+%%% Table of contents %%%
+
+\newwrite\toc
+\immediate\openout\toc=\jobname.toc
+\newif\iftoc
+\tocfalse
+
+\def\writetoc#1#2{
+  \toctrue
+  \toks0={\the\count0}
+  \edef\tocaux{\write\toc{\noexpand\expandafter\noexpand\string\noexpand\csname toc#1\noexpand\endcsname{\currentid}{#2}{\the\toks0}}}
+  \tocaux
+  \tocfalse
+}
+
+\def\includetoc{
+\immediate\closeout\toc
+\input \jobname.toc
+}
+
+\def\tocchap#1#2#3{\smallskip\line{\bo #1.~~#2 \dotfill ~#3}}
+\def\tocsec#1#2#3{\line{#1.~~#2 \dotfill ~#3}}
+
 %%% References %%%
 
 \newwrite\ids
index 82c191b0bf7b1c236ab7afe0587e546f4d26d8c4..28a5430c27ee0710f6a62d63a6ef6807a24d86c3 100644 (file)
--- a/rank.tex
+++ b/rank.tex
@@ -208,7 +208,7 @@ array~$\alpha$ and update~$\alpha^{-1}$ accordingly.
 
 %--------------------------------------------------------------------------------
 
-\section{Ranking of {\secitfont k\/}-permutations}
+\section{Ranking of \iftoc $k$\else{\secitfont k\/}\fi-permutations}
 \id{kpranksect}
 
 The technique from the previous section can be also generalized to lexicographic ranking of
index 6fbc7fc34dd64bd7a6fd86c5f9a7bf50dd5e6c0a..21331ea42963805e0a15fc3d9c3eda1a2e96d6c0 100644 (file)
--- a/saga.tex
+++ b/saga.tex
@@ -14,4 +14,7 @@
 \chapter{Bibliography}
 \dumpbib
 
+\rawchapter{Table of contents}
+\includetoc
+
 \bye