% \iffalse
%% Package `shorttoc' to use with LaTeX 2e
%% Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Jean-Pierre F. Drucbert, all rights reserved
%%
%% You may use and distribute this file freely, provided that
%% you don't pretend that you wrote it.
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.1
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.1 or later is part of all distributions of LaTeX 
% version 1999/06/01 or later.
%
%<package>\NeedsTeXFormat{LaTeX2e}[1996/06/01]
%<package>\ProvidesPackage{shorttoc}
%<package>         [2002/08/20 v1.3 Short table of contents (JPFD)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[tight]{shorttoc}
\GetFileInfo{shorttoc.sty}
\def\filedate{2002/04/10}
\def\fileversion{v1.3}
\EnableCrossrefs         
%\DisableCrossrefs   % Say \DisableCrossrefs if index is ready
\RecordChanges                  % Gather update information
\CodelineIndex                  % Index code by line number
\title{The \pkg{shorttoc} package}
\author{Jean-Pierre F. Drucbert\\\texttt{drucbert@onecert.fr}}%
\date{\filedate}
\def\bs{\texttt{\char'134}}
\let\pkg\textsf
\begin{document}
\maketitle
\DocInput{shorttoc.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{86}
%
% \changes{v1.0}{21 Jul 98}{First officially released version.}
% \changes{v1.1}{03 Aug 99}{LPPL License.}
% \changes{v1.2}{20 Aug 99}{Added tight/loose options.}
% \changes{v1.3}{10 Apr 2002}{Added macro for external tocs.}
%
% \DoNotIndex{\@Mii,\@Miv,\@cons,\@currlist,\@dblarg,\@dbldeferlist}
% \DoNotIndex{\@dblfloat,\@dottedtocline,\@eha,\@Esphack,\@float}
% \DoNotIndex{\@floatpenalty,\@ifnextchar,\@ifundefined,\@latexerr}
% \DoNotIndex{\@mkboth,\@namedef,\@nameuse,\@parboxrestore,\@spaces}
% \DoNotIndex{\@starttoc,\@tempa,\@tempboxa,\@tempdima,\@warning}
% \DoNotIndex{\addcontentsline,\addtocounter,\advance,\arabic,\bfseries}
% \DoNotIndex{\bgroup,\box,\chapter,\columnwidth,\csname,\def,\dimen,\docdate}
% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endinput,\expandafter,\fi}
% \DoNotIndex{\filedate,\fileversion,\global,\hbadness,\hbox,\hfil,\hrule}
% \DoNotIndex{\hsize,\ht,\if@twocolumn,\ifdim,\iffalse,\ifnum,\iftrue,\ifvbox}
% \DoNotIndex{\ifx,\ignorespaces,\intextsep,\kern,\let,\long,\moveleft,\newbox}
% \DoNotIndex{\newcommand,\newcounter,\newif,\newsavebox,\noexpand,\normalsize}
% \DoNotIndex{\numberline,\PackageError,\PackageWarning,\par,\parindent}
% \DoNotIndex{\penalty,\prevdepth,\protect,\refstepcounter,\relax}
% \DoNotIndex{\renewcommand,\rmfamily,\section,\setbox,\setcounter,\space}
% \DoNotIndex{\textheight,\the,\typeout,\unvbox,\uppercase,\vadjust,\value}
% \DoNotIndex{\vbox,\vrule,\vskip,\vspace,\wd,\z@}
%
% \shorttoc{Short Contents}{1}
% \tableofcontents
% \begin{abstract}
% This package\footnote{%
% \begin{tabular}[t]{l}
% Copyright \copyright\ 1997, 1998, 1999, 2000, 2001, 2002 by\\
% Jean-Pierre F. Drucbert\vphantom{bp}\\
% ONERA/Centre de Toulouse SRI\vphantom{bp}\\
% Office National d'\'Etudes et de Recherches A\'erospatiales\vphantom{bp}\\
% Centre de Toulouse\vphantom{bp}\\
% Service R\'eseaux et Informatique\vphantom{bp}\\
% \\
% Complexe Scientifique de Rangueil\vphantom{bp}\\
% 2, Avenue \'Edouard Belin\vphantom{bp}\\
% BP 4025 F-31055 TOULOUSE CEDEX\vphantom{bp}\\
% FRANCE\vphantom{bp}\\
% \vphantom{bp}\\
% Email: \texttt{drucbert@onecert.fr}\vphantom{bp}\\
% \end{tabular}}
% allows you to create another table of contents, with a different
% depth. This could be useful in large documents where a detailed
% table of contents should be accompanied by a shorter one, giving
% only a general overview of the main topics in the document.
% You can also insert the table of contents of another
% document.
% \end{abstract}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{The \pkg{shorttoc} package}
% \DescribeMacro{\shorttableofcontents}
% This package defines the |\shorttableofcontents| macro, which
% is used as follows:
% \begin{quote}\ttfamily
% \bs shorttableofcontents\marg{title}\marg{depth}
% \end{quote}
% where \meta{title} will be the title of this table of contents and
% \meta{depth} its ``depth'', with the meaning of the \texttt{tocdepth}
% counter.
%
% \DescribeMacro{\shorttoc}
% As this macro has a too long name, |\shorttoc| is a synomym, with
% the same syntax.
%
% \DescribeMacro{\anothertableofcontents}
% This macro allows you to display the table of contents of
% an another document, or its list of figures or list of
% tables. Its use is:
% \begin{quote}\ttfamily
% \bs anothertableofcontents\oarg{suffix}\marg{document}\marg{title}\marg{depth}
% \end{quote}
% where \meta{suffix} is |.toc| by default (table of
% contents), \meta{document} is the base name of the other
% document whose table of contents (or its list of figures or
% list of tables, if you give another \meta{suffix}).
% \meta{title} and \meta{depth} have the same meaning as for
% |\shorttableofcontents|.
%
% \DescribeMacro{\anothertoc}
% As this macro has a too long name, |\anothertoc| is a synomym, with
% the same syntax.
%
% \subsection{Options}
% The available package options are \texttt{loose} (default)
% and \texttt{tight}. \texttt{tight} reduces the amount of
% vertical space between the lines of the short table of contents.
%
% \subsection{Important note}
% This package \emph{does not create} the |.toc| file; this
% file must be created by a classical |\tableofcontents| command, or by
% something similar.  You must place the |\shorttableofcontents|
% (or |\shorttoc|) command \emph{before} the |\tableofcontents|
% (or equivalent) command.  If you do not respect the right sequence,
% the short table of contents will be % empty (just its title).
%
% This restriction does not apply to |\anothertableofcontents|
% and |\anothertoc| macros, but, of course, the files |.toc| (or other)
% for the other document must be available.
%
% \StopEventually{\setcounter{IndexColumns}{2}\PrintIndex\PrintChanges}
%
% \clearpage
% \section{Implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \begin{macro}{\@startshorttoc}
% First, we declare the |\@startshorttoc| macro, like |\@starttoc|, 
% but without creating the |.toc| file:
%    \begin{macrocode}
\def\@startshorttoc#1{\bgroup
  \makeatletter
  \@input{\jobname.#1}%
  \global\@nobreakfalse \egroup}
%    \end{macrocode}
% \end{macro}
% The macro |\sht@startshorttoc| is similar, but has a second
% argument to speciffy another document.
%    \begin{macrocode}
\def\sht@startshorttoc#1#2{\bgroup
  \makeatletter
  \@input{#2.#1}%
  \global\@nobreakfalse \egroup}
%    \end{macrocode}
%
% \begin{macro}{\if@tightshtoc}
% Then a flag for the tight/loose options:
%    \begin{macrocode}
\newif\if@tightshtoc \@tightshtocfalse
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\shorttableofcontents}
% Then the user interface macro is copied from
% |\tableofcontents|, but with arguments and
% processing of the depth:
%    \begin{macrocode}
\def\shorttableofcontents#1#2{\bgroup\c@tocdepth=#2\@restonecolfalse
  \if@tightshtoc
     \parsep\z@
  \fi
  \if@twocolumn\@restonecoltrue\onecolumn\fi
  \@ifundefined{chapter}%
  {\section*{{#1}
        \@mkboth{\uppercase{#1}}{\uppercase{#1}}}}%
  {\chapter*{{#1}
        \@mkboth{\uppercase{#1}}{\uppercase{#1}}}}%
  \@startshorttoc{toc}\if@restonecol\twocolumn\fi\egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\anothertableofcontents}
% This macro is analog, but using another input file and
% with arguments for suffix and name of the other document:
%    \begin{macrocode}
\newcommand{\anothertableofcontents}[4][toc]{\bgroup\c@tocdepth=#4\@restonecolfalse
  \if@tightshtoc
     \parsep\z@
  \fi
  \if@twocolumn\@restonecoltrue\onecolumn\fi
  \@ifundefined{chapter}%
  {\section*{{#3}
        \@mkboth{\uppercase{#3}}{\uppercase{#3}}}}%
  {\chapter*{{#3}
        \@mkboth{\uppercase{#3}}{\uppercase{#3}}}}%
  \sht@startshorttoc{#1}{#2}\if@restonecol\twocolumn\fi\egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\shorttoc}
% Let us define shorters synonyms:
%    \begin{macrocode}
     \let\shorttoc\shorttableofcontents
     \let\anothertoc\anothertableofcontents
%    \end{macrocode}
% \end{macro}
%
% And declare the options:
%    \begin{macrocode}
     \DeclareOption{tight}{\@tightshtoctrue}
     \DeclareOption{loose}{\@tightshtocfalse}
     \ExecuteOptions{loose}
     \ProcessOptions*
%    \end{macrocode}
%
% \Finale
% \end{document}
\endinput
