| 1 |
% \iffalse |
| 2 |
%% Package `shorttoc' to use with LaTeX 2e |
| 3 |
%% Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Jean-Pierre F. Drucbert, all rights reserved |
| 4 |
%% |
| 5 |
%% You may use and distribute this file freely, provided that |
| 6 |
%% you don't pretend that you wrote it. |
| 7 |
% |
| 8 |
% It may be distributed and/or modified under the |
| 9 |
% conditions of the LaTeX Project Public License, either version 1.1 |
| 10 |
% of this license or (at your option) any later version. |
| 11 |
% The latest version of this license is in |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% and version 1.1 or later is part of all distributions of LaTeX |
| 14 |
% version 1999/06/01 or later. |
| 15 |
% |
| 16 |
%<package>\NeedsTeXFormat{LaTeX2e}[1996/06/01] |
| 17 |
%<package>\ProvidesPackage{shorttoc} |
| 18 |
%<package> [2002/08/20 v1.3 Short table of contents (JPFD)] |
| 19 |
% |
| 20 |
%<*driver> |
| 21 |
\documentclass{ltxdoc} |
| 22 |
\usepackage[tight]{shorttoc} |
| 23 |
\GetFileInfo{shorttoc.sty} |
| 24 |
\def\filedate{2002/04/10} |
| 25 |
\def\fileversion{v1.3} |
| 26 |
\EnableCrossrefs |
| 27 |
%\DisableCrossrefs % Say \DisableCrossrefs if index is ready |
| 28 |
\RecordChanges % Gather update information |
| 29 |
\CodelineIndex % Index code by line number |
| 30 |
\title{The \pkg{shorttoc} package} |
| 31 |
\author{Jean-Pierre F. Drucbert\\\texttt{[email protected]}}% |
| 32 |
\date{\filedate} |
| 33 |
\def\bs{\texttt{\char'134}} |
| 34 |
\let\pkg\textsf |
| 35 |
\begin{document} |
| 36 |
\maketitle |
| 37 |
\DocInput{shorttoc.dtx} |
| 38 |
\end{document} |
| 39 |
%</driver> |
| 40 |
% \fi |
| 41 |
% |
| 42 |
% \CheckSum{86} |
| 43 |
% |
| 44 |
% \changes{v1.0}{21 Jul 98}{First officially released version.} |
| 45 |
% \changes{v1.1}{03 Aug 99}{LPPL License.} |
| 46 |
% \changes{v1.2}{20 Aug 99}{Added tight/loose options.} |
| 47 |
% \changes{v1.3}{10 Apr 2002}{Added macro for external tocs.} |
| 48 |
% |
| 49 |
% \DoNotIndex{\@Mii,\@Miv,\@cons,\@currlist,\@dblarg,\@dbldeferlist} |
| 50 |
% \DoNotIndex{\@dblfloat,\@dottedtocline,\@eha,\@Esphack,\@float} |
| 51 |
% \DoNotIndex{\@floatpenalty,\@ifnextchar,\@ifundefined,\@latexerr} |
| 52 |
% \DoNotIndex{\@mkboth,\@namedef,\@nameuse,\@parboxrestore,\@spaces} |
| 53 |
% \DoNotIndex{\@starttoc,\@tempa,\@tempboxa,\@tempdima,\@warning} |
| 54 |
% \DoNotIndex{\addcontentsline,\addtocounter,\advance,\arabic,\bfseries} |
| 55 |
% \DoNotIndex{\bgroup,\box,\chapter,\columnwidth,\csname,\def,\dimen,\docdate} |
| 56 |
% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endinput,\expandafter,\fi} |
| 57 |
% \DoNotIndex{\filedate,\fileversion,\global,\hbadness,\hbox,\hfil,\hrule} |
| 58 |
% \DoNotIndex{\hsize,\ht,\if@twocolumn,\ifdim,\iffalse,\ifnum,\iftrue,\ifvbox} |
| 59 |
% \DoNotIndex{\ifx,\ignorespaces,\intextsep,\kern,\let,\long,\moveleft,\newbox} |
| 60 |
% \DoNotIndex{\newcommand,\newcounter,\newif,\newsavebox,\noexpand,\normalsize} |
| 61 |
% \DoNotIndex{\numberline,\PackageError,\PackageWarning,\par,\parindent} |
| 62 |
% \DoNotIndex{\penalty,\prevdepth,\protect,\refstepcounter,\relax} |
| 63 |
% \DoNotIndex{\renewcommand,\rmfamily,\section,\setbox,\setcounter,\space} |
| 64 |
% \DoNotIndex{\textheight,\the,\typeout,\unvbox,\uppercase,\vadjust,\value} |
| 65 |
% \DoNotIndex{\vbox,\vrule,\vskip,\vspace,\wd,\z@} |
| 66 |
% |
| 67 |
% \shorttoc{Short Contents}{1} |
| 68 |
% \tableofcontents |
| 69 |
% \begin{abstract} |
| 70 |
% This package\footnote{% |
| 71 |
% \begin{tabular}[t]{l} |
| 72 |
% Copyright \copyright\ 1997, 1998, 1999, 2000, 2001, 2002 by\\ |
| 73 |
% Jean-Pierre F. Drucbert\vphantom{bp}\\ |
| 74 |
% ONERA/Centre de Toulouse SRI\vphantom{bp}\\ |
| 75 |
% Office National d'\'Etudes et de Recherches A\'erospatiales\vphantom{bp}\\ |
| 76 |
% Centre de Toulouse\vphantom{bp}\\ |
| 77 |
% Service R\'eseaux et Informatique\vphantom{bp}\\ |
| 78 |
% \\ |
| 79 |
% Complexe Scientifique de Rangueil\vphantom{bp}\\ |
| 80 |
% 2, Avenue \'Edouard Belin\vphantom{bp}\\ |
| 81 |
% BP 4025 F-31055 TOULOUSE CEDEX\vphantom{bp}\\ |
| 82 |
% FRANCE\vphantom{bp}\\ |
| 83 |
% \vphantom{bp}\\ |
| 84 |
% Email: \texttt{[email protected]}\vphantom{bp}\\ |
| 85 |
% \end{tabular}} |
| 86 |
% allows you to create another table of contents, with a different |
| 87 |
% depth. This could be useful in large documents where a detailed |
| 88 |
% table of contents should be accompanied by a shorter one, giving |
| 89 |
% only a general overview of the main topics in the document. |
| 90 |
% You can also insert the table of contents of another |
| 91 |
% document. |
| 92 |
% \end{abstract} |
| 93 |
% |
| 94 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 95 |
% \section{The \pkg{shorttoc} package} |
| 96 |
% \DescribeMacro{\shorttableofcontents} |
| 97 |
% This package defines the |\shorttableofcontents| macro, which |
| 98 |
% is used as follows: |
| 99 |
% \begin{quote}\ttfamily |
| 100 |
% \bs shorttableofcontents\marg{title}\marg{depth} |
| 101 |
% \end{quote} |
| 102 |
% where \meta{title} will be the title of this table of contents and |
| 103 |
% \meta{depth} its ``depth'', with the meaning of the \texttt{tocdepth} |
| 104 |
% counter. |
| 105 |
% |
| 106 |
% \DescribeMacro{\shorttoc} |
| 107 |
% As this macro has a too long name, |\shorttoc| is a synomym, with |
| 108 |
% the same syntax. |
| 109 |
% |
| 110 |
% \DescribeMacro{\anothertableofcontents} |
| 111 |
% This macro allows you to display the table of contents of |
| 112 |
% an another document, or its list of figures or list of |
| 113 |
% tables. Its use is: |
| 114 |
% \begin{quote}\ttfamily |
| 115 |
% \bs anothertableofcontents\oarg{suffix}\marg{document}\marg{title}\marg{depth} |
| 116 |
% \end{quote} |
| 117 |
% where \meta{suffix} is |.toc| by default (table of |
| 118 |
% contents), \meta{document} is the base name of the other |
| 119 |
% document whose table of contents (or its list of figures or |
| 120 |
% list of tables, if you give another \meta{suffix}). |
| 121 |
% \meta{title} and \meta{depth} have the same meaning as for |
| 122 |
% |\shorttableofcontents|. |
| 123 |
% |
| 124 |
% \DescribeMacro{\anothertoc} |
| 125 |
% As this macro has a too long name, |\anothertoc| is a synomym, with |
| 126 |
% the same syntax. |
| 127 |
% |
| 128 |
% \subsection{Options} |
| 129 |
% The available package options are \texttt{loose} (default) |
| 130 |
% and \texttt{tight}. \texttt{tight} reduces the amount of |
| 131 |
% vertical space between the lines of the short table of contents. |
| 132 |
% |
| 133 |
% \subsection{Important note} |
| 134 |
% This package \emph{does not create} the |.toc| file; this |
| 135 |
% file must be created by a classical |\tableofcontents| command, or by |
| 136 |
% something similar. You must place the |\shorttableofcontents| |
| 137 |
% (or |\shorttoc|) command \emph{before} the |\tableofcontents| |
| 138 |
% (or equivalent) command. If you do not respect the right sequence, |
| 139 |
% the short table of contents will be % empty (just its title). |
| 140 |
% |
| 141 |
% This restriction does not apply to |\anothertableofcontents| |
| 142 |
% and |\anothertoc| macros, but, of course, the files |.toc| (or other) |
| 143 |
% for the other document must be available. |
| 144 |
% |
| 145 |
% \StopEventually{\setcounter{IndexColumns}{2}\PrintIndex\PrintChanges} |
| 146 |
% |
| 147 |
% \clearpage |
| 148 |
% \section{Implementation} |
| 149 |
% |
| 150 |
% \begin{macrocode} |
| 151 |
%<*package> |
| 152 |
% \end{macrocode} |
| 153 |
% |
| 154 |
% \begin{macro}{\@startshorttoc} |
| 155 |
% First, we declare the |\@startshorttoc| macro, like |\@starttoc|, |
| 156 |
% but without creating the |.toc| file: |
| 157 |
% \begin{macrocode} |
| 158 |
\def\@startshorttoc#1{\bgroup |
| 159 |
\makeatletter |
| 160 |
\@input{\jobname.#1}% |
| 161 |
\global\@nobreakfalse \egroup} |
| 162 |
% \end{macrocode} |
| 163 |
% \end{macro} |
| 164 |
% The macro |\sht@startshorttoc| is similar, but has a second |
| 165 |
% argument to speciffy another document. |
| 166 |
% \begin{macrocode} |
| 167 |
\def\sht@startshorttoc#1#2{\bgroup |
| 168 |
\makeatletter |
| 169 |
\@input{#2.#1}% |
| 170 |
\global\@nobreakfalse \egroup} |
| 171 |
% \end{macrocode} |
| 172 |
% |
| 173 |
% \begin{macro}{\if@tightshtoc} |
| 174 |
% Then a flag for the tight/loose options: |
| 175 |
% \begin{macrocode} |
| 176 |
\newif\if@tightshtoc \@tightshtocfalse |
| 177 |
% \end{macrocode} |
| 178 |
% \end{macro} |
| 179 |
% |
| 180 |
% \begin{macro}{\shorttableofcontents} |
| 181 |
% Then the user interface macro is copied from |
| 182 |
% |\tableofcontents|, but with arguments and |
| 183 |
% processing of the depth: |
| 184 |
% \begin{macrocode} |
| 185 |
\def\shorttableofcontents#1#2{\bgroup\c@tocdepth=#2\@restonecolfalse |
| 186 |
\if@tightshtoc |
| 187 |
\parsep\z@ |
| 188 |
\fi |
| 189 |
\if@twocolumn\@restonecoltrue\onecolumn\fi |
| 190 |
\@ifundefined{chapter}% |
| 191 |
{\section*{{#1} |
| 192 |
\@mkboth{\uppercase{#1}}{\uppercase{#1}}}}% |
| 193 |
{\chapter*{{#1} |
| 194 |
\@mkboth{\uppercase{#1}}{\uppercase{#1}}}}% |
| 195 |
\@startshorttoc{toc}\if@restonecol\twocolumn\fi\egroup} |
| 196 |
% \end{macrocode} |
| 197 |
% \end{macro} |
| 198 |
% |
| 199 |
% \begin{macro}{\anothertableofcontents} |
| 200 |
% This macro is analog, but using another input file and |
| 201 |
% with arguments for suffix and name of the other document: |
| 202 |
% \begin{macrocode} |
| 203 |
\newcommand{\anothertableofcontents}[4][toc]{\bgroup\c@tocdepth=#4\@restonecolfalse |
| 204 |
\if@tightshtoc |
| 205 |
\parsep\z@ |
| 206 |
\fi |
| 207 |
\if@twocolumn\@restonecoltrue\onecolumn\fi |
| 208 |
\@ifundefined{chapter}% |
| 209 |
{\section*{{#3} |
| 210 |
\@mkboth{\uppercase{#3}}{\uppercase{#3}}}}% |
| 211 |
{\chapter*{{#3} |
| 212 |
\@mkboth{\uppercase{#3}}{\uppercase{#3}}}}% |
| 213 |
\sht@startshorttoc{#1}{#2}\if@restonecol\twocolumn\fi\egroup} |
| 214 |
% \end{macrocode} |
| 215 |
% \end{macro} |
| 216 |
% |
| 217 |
% \begin{macro}{\shorttoc} |
| 218 |
% Let us define shorters synonyms: |
| 219 |
% \begin{macrocode} |
| 220 |
\let\shorttoc\shorttableofcontents |
| 221 |
\let\anothertoc\anothertableofcontents |
| 222 |
% \end{macrocode} |
| 223 |
% \end{macro} |
| 224 |
% |
| 225 |
% And declare the options: |
| 226 |
% \begin{macrocode} |
| 227 |
\DeclareOption{tight}{\@tightshtoctrue} |
| 228 |
\DeclareOption{loose}{\@tightshtocfalse} |
| 229 |
\ExecuteOptions{loose} |
| 230 |
\ProcessOptions* |
| 231 |
% \end{macrocode} |
| 232 |
% |
| 233 |
% \Finale |
| 234 |
% \end{document} |
| 235 |
\endinput |