summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrwfile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/koma-script/scrwfile.dtx126
1 files changed, 100 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx b/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx
index f76af2b85f1..5db335bed1b 100644
--- a/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx
+++ b/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx
@@ -1,8 +1,8 @@
-% \CheckSum{271}
+% \CheckSum{306}
% \iffalse meta-comment
% ======================================================================
% scrwfile.dtx
-% Copyright (c) Markus Kohm, 2010-2012
+% Copyright (c) Markus Kohm, 2010-2013
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
@@ -29,7 +29,7 @@
% at least three times.
% ----------------------------------------------------------------------
% scrwfile.dtx
-% Copyright (c) Markus Kohm, 2010-2012
+% Copyright (c) Markus Kohm, 2010-2013
%
% Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets.
%
@@ -75,7 +75,7 @@
% Right brace \} Tilde \~}
%
% \iffalse
-%%% From File: scrwfile.dtx
+%%% From File: $Id: scrwfile.dtx 1562 2013-12-19 07:51:16Z mjk $
%<*dtx>
\def\LaTeXformat{LaTeX2e}
\ifx\fmtname\LaTeXformat
@@ -90,7 +90,7 @@
%<driver>\ProvidesFile{scrwfile.drv}
%<doc>\ProvidesFile{scrwfile.tex}
%<*dtx|(package&identify)|driver|doc>
- [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)]
%</dtx|(package&identify)|driver|doc>
%<*driver>
\documentclass{scrdoc}
@@ -121,6 +121,7 @@
\providecommand\PParameter[1]{\mbox{\texttt{\{#1\}}}}
\let\PName\meta
\let\PValue\texttt
+ \providecommand*{\important}[1]{}
\providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:}
\providecommand*{\AUTOREF}{}
\makeatletter
@@ -144,7 +145,7 @@
% Now the installation driver:
%</dtx>
%<*insfile>
-\expandafter\let\expandafter\ifbeta\csname iffalse\endcsname
+\let\ifbeta=\iffalse % with = will be replaced by release process
\def\batchfile{scrwfile.dtx}
\input docstrip.tex
\ifToplevel{%
@@ -164,7 +165,7 @@
\preamble
-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.
---------------------------------------------------------------
@@ -364,7 +365,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.
@@ -408,24 +409,54 @@ 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 »Short
+Contents«. 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.
%\iffalse^^A meta-comment
+See \autoref{sec:tocbasic.toc} on
+\autopageref{desc:tocbasic.cmd.AfterStartingTOC} for more information about
+\Macro{AfterStartingTOC}.%
\end{Example}
\EndIndex{Cmd}{TOCclone}
@@ -649,12 +680,55 @@ extension. So there's currently no user documentation for this.
% \begin{macro}{\@starttoc}
% We have to add the single handle feature to this.
% \begin{macro}{\scrwfile@saved@starttoc}
+% \changes{v0.1e}{2013/07/24}{take care for unfriendly \textsl{hyperref}}
% This is the original definition, that will be used, if the file is not under
-% \texttt{scrwfile}'s control.
+% \texttt{scrwfile}'s control. Because of package \textsl{hyperref}, that does
+% a hard redefinition without any care for changed definitions, we have to
+% take care for that unfriendly package and cannot do a simple
+% \begin{verbatim}
+% \let\scrwfile@saved@starttoc\@starttoc
+% \let\@starttoc\scrwfile@starttoc
+% \end{verbatim}
% \begin{macrocode}
\newcommand*{\scrwfile@saved@starttoc}{}
-\let\scrwfile@saved@starttoc\@starttoc
-\let\@starttoc\scrwfile@starttoc
+\AtBeginDocument{%
+ \begingroup
+ \@ifpackageloaded{hyperref}{%
+ \scr@ifundefinedorrelax{Hy@AtBeginDocument}{%
+ \PackageWarning{scrwfile}{%
+ Incompatible `hyperref` package detected!\MessageBreak
+ You are using a `hyperref` version, that\MessageBreak
+ doesn't provide `\string\Hy@AtBeginDocument`.\MessageBreak
+ This may or may not work.\MessageBreak
+ Using immediate redefinition%
+ }%
+ \aftergroup\@firstofone
+ }{%
+ \def\reserved@a{\AtBeginDocument}%
+ \ifx\Hy@AtBeginDocumentHook\@undefined
+ \PackageInfo{scrwfile}{%
+ Using immediate redefinition%
+ }%
+ \aftergroup\@firstofone
+ \else
+ \PackageInfo{scrwfile}{%
+ Using `\string\Hy@AtBeginDocument`%
+ }%
+ \aftergroup\Hy@AtBeginDocument
+ \fi
+ }%
+ }{%
+ \aftergroup\@firstofone
+ }%
+ \endgroup
+ {%
+ \PackageInfo{scrwfile}{%
+ Extending `\string\@starttoc`
+ }%
+ \let\scrwfile@saved@starttoc\@starttoc
+ \let\@starttoc\scrwfile@starttoc
+ }%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}