diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex b/Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex index baf1d38f565..9d69c9d2fc7 100644 --- a/Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex +++ b/Master/texmf-dist/source/latex/koma-script/doc/english/scrwfile.tex @@ -6,7 +6,7 @@ %% %% scrwfile.dtx (with options: `doc') %% -%% Copyright (c) 2010-2012 by Markus Kohm <komascript(at)gmx.info> +%% Copyright (c) 2010-2013 by Markus Kohm <komascript(at)gmx.info> %% %% This file was generated from file(s) of the KOMA-Script bundle. %% --------------------------------------------------------------- @@ -43,9 +43,9 @@ %% EVERYTHING MAY CHANGE IN FUTURE! %% THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE! %% -%%% From File: scrwfile.dtx +%%% From File: $Id: scrwfile.dtx 1562 2013-12-19 07:51:16Z mjk $ \ProvidesFile{scrwfile.tex} - [2012/03/05 v0.1d-alpha LaTeX2e KOMA-Script package (write and clone files)] + [2013/08/05 v0.1f-alpha LaTeX2e KOMA-Script package (write and clone files)] \chapter[{Spare and Replace Files Using \Package{scrwfile}}] {Spare and Replace Files Using \Package{scrwfile}% } @@ -143,7 +143,7 @@ limited any longer. Sometimes it is useful to input a file not only once but several times. As \Macro{@starttoc} does not open files for writing any longer, this may be -done by simply using \Macro{\@starttoc} several times with the same +done by simply using \Macro{@starttoc} several times with the same extension. But sometimes you may have additional entries in only some of the content directories. Because of this, \Package{scrwfile} allows to copy all entries of a file to another file, too. We call this cloning. @@ -178,23 +178,53 @@ contents: \begin{lstcode} \usepackage{scrwfile} \TOCclone[Short \contentsname]{toc}{stoc} - \AtBeginDocument{% - % aux first opened at \begin{document}. So wait until this: - \addtocontents{toc}{% first toc entry: - \proctect\addcontentsline{stoc}{% write to Short Contents - \protect\tableofcontents% Contents - }% - }% +\end{lstcode} +This would create a new table of contents with the heading ^^c2^^bbShort +Contents^^c2^^ab. The new table of contents uses a helper file with extension +\File{stoc}. All entries to the helper file with extension \File{toc} will +also be copied to this new helper file. + +The new short table of contents should only have the chapter entries. This may +be done using: +\begin{lstcode} + \addtocontents{stoc}{\protect\value{tocdepth}=0} +\end{lstcode} +Normally you cannot write into a helper file before +\Macro{begin}\PParameter{document}. But using \Package{scrwfile} changes +this. So the code above will be successful after loading \Package{scrwfile}. + +To show the new short contents of helper file extension \File{stoc} we will +use +\begin{lstcode}[moretexcs={listofsttoc}] + \listofstoc +\end{lstcode} +somewhere after \Macro{begin}\PParameter{document}. + +If we also want an entry for the table of contents at the short contents, we +cannot use +\begin{lstcode} + \addtocontents{toc}{% write to the Contents + \protect\addcontentslinedefault{stoc}% write to Short Contents + {chapter}% a chapter entry with + {\contentsname}% the Contents' name + } +\end{lstcode} +because the \Macro{addcontentsline} command would be copied to \File{stoc} +too. So we cannot add the command to the \File{toc}-file. Package +\Package{tocbasic}\important{\Package{tocbasic}} may be used to solve this: +\csname phantomsection\endcsname\label{example:scrwfile.AfterStartingTOC} +\begin{lstcode} + \AfterStartingTOC[toc]{% + \addcontentslinedefault{stoc}{chapter} + {\protect\contentsname}% } - \begin{document} - \setcounter{tocdepth}{1}% show chapters only - \listofstoc% Write short table of contents - \setcounter{tocdepth}{6}% show all levels - \tableofcontents% Write table of contents \end{lstcode} -You need at least three \LaTeX{} runs to get a short table of contents and a -detailed table of contents. The detailed one produces an entry at the short -one but this entry will not be part of the detailed table of contents. +But this needs, that the file with extension \File{toc} is under control of +package \Package{tocbasic}, which is indeed the case within all \KOMAScript{} +classes. +See \autoref{sec:tocbasic.toc} on +\autopageref{desc:tocbasic.cmd.AfterStartingTOC} for more information about +\Macro{AfterStartingTOC}.% \end{Example} \EndIndex{Cmd}{TOCclone} |