From 757bf828d88fde2aeabbb214f0275aa036163623 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 5 Mar 2013 23:25:04 +0000 Subject: tableof (5mar13) git-svn-id: svn://tug.org/texlive/trunk@29296 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/tableof/tableof.sty | 43 ++++++++++++++----------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/tex/latex/tableof') diff --git a/Master/texmf-dist/tex/latex/tableof/tableof.sty b/Master/texmf-dist/tex/latex/tableof/tableof.sty index edeff99cb83..0a3723f9327 100644 --- a/Master/texmf-dist/tex/latex/tableof/tableof.sty +++ b/Master/texmf-dist/tex/latex/tableof/tableof.sty @@ -22,10 +22,10 @@ %% in the same archive or directory.) %% \ProvidesPackage{tableof} - [2012/12/13 v1.1 tables of tagged contents (jfB)] + [2013/03/04 v1.2 tables of tagged contents (jfB)] %% %% Package `tableof' by Jean-Francois Burnol -%% Copyright (C) 2012 by Jean-Francois Burnol +%% Copyright (C) 2012,2013 by Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e} \DeclareOption*{\PackageWarning{tableof}{Option `\CurrentOption' is unknown.}} @@ -34,11 +34,11 @@ \def\tof@readtoc#1{% \ifeof #1 \let\tof@nextread\@gobble - \global\tof@toctoks=\expandafter{\the\tof@toctoks}% + \global\tof@toctoks\expandafter{\the\tof@toctoks}% \else \let\tof@nextread\tof@readtoc \read #1 to \tof@buffer - \tof@toctoks=\expandafter\expandafter\expandafter + \tof@toctoks\expandafter\expandafter\expandafter {\expandafter\the\expandafter\tof@toctoks\tof@buffer}% \fi \tof@nextread{#1}} @@ -50,13 +50,13 @@ \tof@readtoc\tof@tf \closein\tof@tf}}{} \AtBeginDocument{ - \addtocontents{toc}{\string\@ifundefined\string{tof@begin\string}} - \addtocontents{toc}{\string{\let\string\tof@begin\string\relax% + \addtocontents{toc}{\string\@ifundefined{tof@begin}} + \addtocontents{toc}{{\let\string\tof@begin\string\relax% \string\let\string\tof@finish\string\relax% \string\let\string\tof@starttags\string\@gobble% \string\let\string\tof@stoptags\string\@gobble% \string\let\string\tof@tagthis\string\@gobble% - \string\let\string\tof@untagthis\string\@gobble\string}\string{\string}} + \string\let\string\tof@untagthis\string\@gobble}{}} \addtocontents{toc}{\string\tof@begin} \@ifpackageloaded{hyperref} {\def\tof@gobblethree@orfour#1#2#3#4{}% @@ -64,8 +64,10 @@ {\def\tof@gobblethree@orfour#1#2#3{}}} \AtEndDocument{\addtocontents{toc}{\string\tof@finish}} \newcommand\tofOpenTocFileForWrite{% -\expandafter\newwrite \csname tf@toc\endcsname -\immediate \openout \csname tf@toc\endcsname \jobname .toc\relax} + \if@filesw + \newwrite \tf@toc + \immediate \openout \tf@toc \jobname .toc\relax + \fi} \def\tof@tags{} \def\tof@tags@tmp{} \def\tof@untags@tmp{} @@ -120,7 +122,8 @@ \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}% \the\tof@toctoks} -\newcommand\nexttocwithtags{\@ifstar{\tof@nextof@or}{\tof@nextof@and}} +\newcommand*\tableof{\@ifstar{\tof@or}{\tof@and}} +\newcommand*\tablenotof{\@ifstar{\tof@nand}{\tof@nor}} \def\tof@nextof@or#1{\toks\z@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next @@ -136,23 +139,27 @@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}}% - \expandafter\tof@init\expandafter{\the\toks\z@}} + \expandafter\tof@init\expandafter{\the\toks\z@}% + \tof@printtoc} \def\tof@nextof@nand#1{% \toks\z@\expandafter{\the\toks\z@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}}% - \expandafter\tof@init\expandafter{\the\toks\z@}} -\newcommand\tableof{\@ifstar{\tof@or}{\tof@and}} -\newcommand\tablenotof{\@ifstar{\tof@nand}{\tof@nor}} + \expandafter\tof@init\expandafter{\the\toks\z@}% + \tof@printtoc} +\newcommand*{\nexttocwithtags}{\let\tof@printtoc\relax + \@ifstar{\tof@nextof@or}{\tof@nextof@and}} +\newcommand*{\tableoftaggedcontents}{\def\tof@printtoc{\the\tof@toctoks}% + \@ifstar{\tof@nextof@or}{\tof@nextof@and}} \newcommand*\toftagthis[1]{\addtocontents{toc} - {\string\tof@tagthis\string{#1\string}}} + {\string\tof@tagthis{#1}}} \newcommand*\tofuntagthis[1]{\addtocontents{toc} - {\string\tof@untagthis\string{#1\string}}} + {\string\tof@untagthis{#1}}} \newcommand*\toftagstart[1]{\addtocontents{toc} - {\string\tof@starttags\string{#1\string}}} + {\string\tof@starttags{#1}}} \newcommand*\toftagstop[1]{\addtocontents{toc} - {\string\tof@stoptags\string{#1\string}}} + {\string\tof@stoptags{#1}}} \endinput %% %% End of file `tableof.sty'. -- cgit v1.2.3