diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrwfile.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrwfile.dtx | 376 |
1 files changed, 29 insertions, 347 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx b/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx index 5db335bed1b..453d708d8e6 100644 --- a/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx +++ b/Master/texmf-dist/source/latex/koma-script/scrwfile.dtx @@ -2,7 +2,7 @@ % \iffalse meta-comment % ====================================================================== % scrwfile.dtx -% Copyright (c) Markus Kohm, 2010-2013 +% Copyright (c) Markus Kohm, 2010-2014 % % 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-2013 +% Copyright (c) Markus Kohm, 2010-2014 % % Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets. % @@ -75,23 +75,36 @@ % Right brace \} Tilde \~} % % \iffalse -%%% From File: $Id: scrwfile.dtx 1562 2013-12-19 07:51:16Z mjk $ +%%% From File: $Id: scrwfile.dtx 1805 2014-10-13 08:55:20Z kohm $ %<*dtx> -\def\LaTeXformat{LaTeX2e} -\ifx\fmtname\LaTeXformat - \makeatletter - \let\saved@@end\@@end - \def\@@end{\csname fi\endcsname\saved@@end} - \makeatother - \ProvidesFile{scrwfile.dtx} +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\ProvidesFile{scrwfile.dtx} %</dtx> %<(package&identify)|driver>\NeedsTeXFormat{LaTeX2e}[1995/06/01] %<package&identify>\ProvidesPackage{scrwfile} %<driver>\ProvidesFile{scrwfile.drv} -%<doc>\ProvidesFile{scrwfile.tex} -%<*dtx|(package&identify)|driver|doc> - [2013/08/05 v0.1f-alpha LaTeX2e KOMA-Script package (write and clone files)] -%</dtx|(package&identify)|driver|doc> +%<*dtx|(package&identify)|driver> + [2013/08/05 v0.1f-alpha KOMA-Script package (write and clone files)] +%</dtx|(package&identify)|driver> +%<*dtx> +\ifx\documentclass\undefined + \input scrdocstrip.tex + \@@input scrstrip.inc + \KOMAdefVariable{COPYRIGHTFROM}{2010} + + \generate{\usepreamble\defaultpreamble + \file{scrwfile.sty}{% + \from{scrwfile.dtx}{package,trace,scrwfile,identify,option,body}% + \from{scrlogo.dtx}{logo}% + }% + } + + \@@input scrstrop.inc +\else + \let\endbatchfile\relax +\fi +\endbatchfile +%</dtx> %<*driver> \documentclass{scrdoc} \usepackage[ngerman,english]{babel} @@ -140,350 +153,19 @@ \DocInput{\filename} \end{document} %</driver> -%<*dtx> -\fi -% Now the installation driver: -%</dtx> -%<*insfile> -\let\ifbeta=\iffalse % with = will be replaced by release process -\def\batchfile{scrwfile.dtx} -\input docstrip.tex -\ifToplevel{% - \Msg{**********************************************************************} - \Msg{*} - \Msg{* KOMA-Script presents scrwfile} - \Msg{* a package to define, configure and several different styles for} - \Msg{* table of contents, list of floats and the like.} - \Msg{*} - \Msg{* This is `\batchfile', a batch file to unpack the package scrwfile,} - \Msg{* the documentation of the package, and an archive of all these files.} - \Msg{*} - \Msg{**********************************************************************} - \keepsilent - \askforoverwritefalse -} - -\preamble - -Copyright (c) 2010-2013 by Markus Kohm <komascript(at)gmx.info> - -This file was generated from file(s) of the KOMA-Script bundle. ---------------------------------------------------------------- - -This work may be distributed and/or modified under the conditions of -the LaTeX Project Public License, version 1.3c of the license. -The latest version of this license is in - http://www.latex-project.org/lppl.txt -and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later and of this work. - -This work has the LPPL maintenance status "author-maintained". - -The Current Maintainer and author of this work is Markus Kohm. - -This file may only be distributed together with the file -`scrwfile.dtx' and `scrlogo.dtx'. You may however distribute the files -`scrwfile.dtx' and `scrlogo.dtx' without this file. - -If this file is a beta version, you are not allowed to distribute it. - -English and German manuals are part of KOMA-Script bundle. ----------------------------------------------------------- - -The english manual is at `scrwfile.dtx', too. - -The KOMA-Script bundle (but not this file) was based upon the LaTeX2.09 -Script family created by Frank Neukam 1993 and the LaTeX2e standard -classes created by The LaTeX3 Project 1994-1996. - -THIS IS AN ALPHA VERSION! -USAGE OF THIS VERSION IS ON YOUR OWN RISK! -EVERYTHING MAY HAPPEN! -EVERYTHING MAY CHANGE IN FUTURE! -THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE! - -\endpreamble - -\generate{\usepreamble\defaultpreamble - \file{scrwfile.sty}{% - \ifx\ifbeta\iftrue\from{scrbeta.dtx}{package,scrwfile}\fi - \from{scrwfile.dtx}{package,trace,scrwfile,identify,option,body}% - \from{scrlogo.dtx}{logo}% - }% -} - -\ifToplevel{% - \generate{\usepreamble\defaultpreamble - \file{scrwfile.ins}{% - \from{scrwfile.dtx}{insfile}% - }% - \file{scrwfile.tex}{% - \from{scrwfile.dtx}{doc}% - }% - \file{scrwfile.drv}{% - \from{scrwfile.dtx}{driver}% - }% - }% -} - -\ifToplevel{% - \Msg{**********************************************************************} - \Msg{*} - \ifbeta - \Msg{* THIS IS AN ALPHA OR BETA VERSION. YOU SHOULD NOT INSTALL OR USE IT!} - \Msg{* THERE MAY BE A LOT OF BUGS AT THIS VERSION!} - \Msg{* PLEASE INSTALL THE RELEASE YOU MAY FIND AT CTAN OR BERLIOS!} - \else - \Msg{* To finish the installation you have to copy the file `scrwfile.sty'} - \Msg{* to folder `tex/latex/scrwfile/' of one of your TEXMF trees.} - \Msg{* You should also produce the documentation using} - \Msg{*\space\space latex scrwfile.dtx} - \Msg{* and copy it to folder `doc/latex/scrwfile/' of one of your} - \Msg{* TEXMF trees.} - \Msg{*} - \Msg{* See the manual of your TeX distribution for more informations about} - \Msg{* package installation.} - \fi - \Msg{*} - \Msg{**********************************************************************} -} - -%</insfile> -%<*dtx|doc> -%<*dtx> -\csname endinput\endcsname -%</dtx> % \fi % % \selectlanguage{english} % % \changes{v0.1}{2010/10/01}{start of new package} -% -%\iffalse^^A meta comment -\chapter[{Spare and Replace Files Using \Package{scrwfile}}] -{Spare and Replace Files Using \Package{scrwfile}% -% \footnote{This chapter has been generated from \File{scrwfile.dtx}.}% -} -\labelbase{scrwfile} - -\BeginIndex{Package}{scrwfile} - -%\fi^^A meta comment -% \begin{abstract} -\TeX{} supports 18 write handles only. Handle 0 is used by \TeX{} itself (log -file). \LaTeX{} needs at least handle 1 for \Macro{@mainaux}, handle 2 for -\Macro{@partaux}, one handle for \Macro{tableofcontents}, one handle for -\Macro{listoffigures}, one handle for \Macro{listoftables}, one handle for -\Macro{makeindex}. So there are 11 left. Seams a lot and enough. But every new -type of float, every new index and several other packages, e.g., -\Package{hyperref} need write handles, too. - -The bottom line is, that this eventually will result in the error message: -\begin{lstcode} - ! No room for a new \write . - \ch@ck ...\else \errmessage {No room for a new #3} - \fi -\end{lstcode} - -Last but not least, immediately opening one more write handle for every table -of contents, list of figures, list of tables, and so on has one more -disadvantage. These are not only set by the corresponding commands, they also -couldn't not be set once more, because their helper files are empty after the -corresponding commands until the end of the document. - -Package \Package{scrwfile} provides a general change of the \LaTeX{} kernel, -that may solve both problems. -% \end{abstract} -% -% \tableofcontents - -\section{General Modifications of the \LaTeX{} Kernel} -\label{sec:scrwfile.kernelpatches} - -\LaTeX{} classes use the \LaTeX{} kernel command -\Macro{@starttoc}\IndexCmd{@starttoc} for output and opening of a new table of -contents, list of float, e.\,g., \Macro{listoffigures} or -\Macro{listoftables}, or similar. Thereby \LaTeX{} not only reads the helper -file with the contents of the directory, but opens the helper file for writing -also. Nevertheless, if afterwards new entries to these lists of floats will be -made using \Macro{addcontentsline}, then this will not write immediately to -the helper file. Instead of \LaTeX{} writes -\Macro{@writefile}\IndexCmd{@writefile} commands into the -\File{aux}-file. Only while reading the \File{aux}-file while the end of the -document, those \Macro{@writefile} commands generates real write operations -into the helper files. \LaTeX{} even doesn't close the helper files -explicitly. Instead of \LaTeX{} counts on \TeX{} to close all open files at -the end. - -This procedure means, that all the helper files are open for writing from the -output of the contents, i.\,e. at the front matter of the document until the -end of the document, though their content is written after the end of the -document. \Package{scrwfile}'s basic approach is exactly this: redefinition of -\Macro{@starttoc} and \Macro{@writefile}. - -Surely\textnote{Attention!}, changes of the \LaTeX{} kernel always may -potentially result in incompatibilities with other packages. In case of -\Package{scrwfile} this may be happen with all packages, that redefine -\Macro{@starttoc} or \Macro{@writefile} too. Sometimes changing the order of -loading the packages may help. - -In fact, such problems with \Package{scrwfile} haven't been reported currently, -though several users have tested the package for more than a year until first -release. Nevertheless, if you find such a problem, please contact the -\KOMAScript{} author. - - -\section{The Single File Feature} -\label{sec:scrwfile.singlefilefeature} - -Just while loading the package using, e.\,g., -\begin{lstcode}[belowskip=\dp\strutbox] - \usepackage{scrwfile} -\end{lstcode} -\Package{scrwfile} will redefine \Macro{@starttoc}\IndexCmd{@starttoc} to not -longer allocate a file handle or open any file for writing. Immediately before -closing the \File{aux}-file in \Macro{end}\PParameter{document} it will -redefine \Macro{@writefile} to not longer write into the usual helper files -but into one single new file with file extension \File{wrt}. After -reading the \File{aux}-file this \File{wrt}-file will be processed once per -helper file. This means, that not all of the helper file have to be open at -the same time, but only one at a time. And this single file will be closed -afterwards and the write handle is not longer needed after it is closed. An -internal write handle of \LaTeX{} is used for this. So \Package{scrwfile} -doesn't need any own write handle. - -Because of this, even if only one table of contents should be generated, after -loading \Package{scrwfile} one more write file handle will be available, -e.\,g., for bibliographies, indexes, glossaries and similar, that are not -using \Macro{@starttoc}. Additionally the number of tables of contents and -lists of whatever, that use \Macro{@starttoc}\IndexCmd{@starttoc} won't be -limited any longer. - - -\section{The Clone File Write Feature} -\label{sec:scrwfile.clonefilefeature} - -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 -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. - -%\iffalse^^A meta-comment -\begin{Declaration} -%\fi^^A meta-comment -% \DescribeMacro{\TOCclone} -% The command - \Macro{TOCclone}% - \OParameter{heading}\Parameter{source}\Parameter{destination} -%\iffalse^^A meta-comment -\end{Declaration} -\BeginIndex{Cmd}{TOCclone}% -%\fi^^A meta-comment -activates the clone feature for files with extensions \PName{source} and -\PName{destination}. All entries to the file -\Macro{jobname}\File{.}\PName{source} will be added to -\Macro{jobname}\File{.}\PName{destination}, too. - -If extension \PName{destination} is a new one, \PName{destination} will be -added to the list of known extensions using the \KOMAScript{} package -\Package{tocbasic}. - -If the optional argument \PName{heading} is given, a new list-of macro -\Macro{listof}\PName{destination} is defined. \PName{heading} will be used -as section (or chapter) heading of this list. In this case several -\Package{tocbasic} features of the \PName{source} will be copied to -\PName{destination}, if and only if they have been set up when -\Macro{TOCclone} was used. Feature \PName{nobabel} will always be set, -because the language selection commands are part of the helper file and -would be cloned, too. - -% \subparagraph*{How you can use it:} -%\iffalse^^A meta-comment -\begin{Example} -%\fi^^A meta-comment -Assumed, you want a short table of contents -with only the chapter level but an additional entry with the table of -contents: -\begin{lstcode} - \usepackage{scrwfile} - \TOCclone[Short \contentsname]{toc}{stoc} -\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}% - } -\end{lstcode} -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} - -\section{State of Development Note} -\label{sec:scrwfile.draft} - -Though this package has been tested by several users and even is in -productivity usage several times, development is not finished yet. Because of -this especially internal functionality may be changed in future. Most likely -the package will be extended. Some code for extensions is already in the -package. Nevertheless, currently user haven't make requests for such -extension. So there's currently no user documentation for this. - -\EndIndex{Package}{scrwfile} - -%\fi^^A meta-comment - -%\iffalse -%</dtx|doc> -%\fi +% \changes{v0.1g}{2014/10/13}{manual moved to \KOMAScript{} manual} % % \StopEventually{% % \clearpage % \PrintIndex\PrintChanges} % % -% \section{Implementation} +% \section{Implementation of \Package{scrwfile}} % % \iffalse %<*package> |