summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/scrwfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/source/scrwfile.dtx')
-rw-r--r--macros/latex/contrib/koma-script/source/scrwfile.dtx318
1 files changed, 132 insertions, 186 deletions
diff --git a/macros/latex/contrib/koma-script/source/scrwfile.dtx b/macros/latex/contrib/koma-script/source/scrwfile.dtx
index 7228e756ab..5da27e5ee0 100644
--- a/macros/latex/contrib/koma-script/source/scrwfile.dtx
+++ b/macros/latex/contrib/koma-script/source/scrwfile.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
% ======================================================================
% scrwfile.dtx
-% Copyright (c) Markus Kohm, 2010-2021
+% Copyright (c) Markus Kohm, 2010-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
@@ -16,65 +16,9 @@
%
% The Current Maintainer and author of this work is Markus Kohm.
%
-% The KOMA-Script bundle consists of all files listed in manifest.txt.
-% The work `scrwfile' consists of the files `scrwfile.dtx' and
-% `scrlogo.dtx'.
-%
-% If you're missing the installation batch file `scrwfile.ins', try
-% tex scrwfile.dtx
-% to unpack all files.
-% The package documentation may be produced repeating
-% latex scrwfile.dtx
-% at least three times.
-% ----------------------------------------------------------------------
-% scrwfile.dtx
-% Copyright (c) Markus Kohm, 2010-2021
-%
-% Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets.
-%
-% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
-% Version 1.3c.
-% Die neuste Version dieser Lizenz ist
-% http://www.latex-project.org/lppl.txt
-% und Version 1.3c ist Teil aller Verteilungen von LaTeX
-% Version 2005/12/01 und dieses Werks.
-%
-% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
-% (allein durch den Autor verwaltet).
-%
-% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
-%
-% Das KOMA-Script-Paket besteht aus allen Dateien, die in manifest.txt
-% genannt sind.
-% Das Werk `scrwfile' besteht aus den Dateien `scrwfile.dtx' und
-% `scrlogo.dtx'.
-%
-% Falls Sie die Installations-Batch-Datei `scrwfile.ins' vermissen,
-% probieren Sie einfach einmal
-% tex scrwfile.dtx
-% um alle Dateien auszupacken. Zur englischen Anleitung siehe den
-% englischen Kommentar oben.
+% This work consists of all files listed in manifest.txt.
% ======================================================================
-% \fi
-%
-% \CharacterTable
-% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-% Digits \0\1\2\3\4\5\6\7\8\9
-% Exclamation \! Double quote \" Hash (number) \#
-% Dollar \$ Percent \% Ampersand \&
-% Acute accent \' Left paren \( Right paren \)
-% Asterisk \* Plus \+ Comma \,
-% Minus \- Point \. Solidus \/
-% Colon \: Semicolon \; Less than \<
-% Equals \= Greater than \> Question mark \?
-% Commercial at \@ Left bracket \[ Backslash \\
-% Right bracket \] Circumflex \^ Underscore \_
-% Grave accent \` Left brace \{ Vertical bar \|
-% Right brace \} Tilde \~}
-%
-% \iffalse
-%%% From File: $Id: scrwfile.dtx 3600 2021-05-30 19:00:56Z kohm $
+%%% From File: $Id: scrwfile.dtx 3773 2022-03-29 06:27:55Z kohm $
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\ProvidesFile{scrwfile.dtx}
@@ -83,11 +27,12 @@
%<package&identify>\ProvidesPackage{scrwfile}
%<driver>\ProvidesFile{scrwfile.drv}
%<*dtx|(package&identify)|driver>
- [2021/05/30 v0.1.9-alpha KOMA-Script package (write and clone files)]
+ [2021/05/30 v0.1.10 KOMA-Script package (write and clone files)]
%</dtx|(package&identify)|driver>
%<*dtx>
\ifx\documentclass\undefined
\input scrdocstrip.tex
+ \@@input scrkernel-version.dtx
\@@input scrstrip.inc
\KOMAdefVariable{COPYRIGHTFROM}{2010}
@@ -105,130 +50,129 @@
\endbatchfile
%</dtx>
%<*driver>
- \documentclass{scrdoc}
- \usepackage[ngerman,english]{babel}
- \usepackage{listings}
- \lstnewenvironment{lstcode}[1][]{%
- \lstset{language=[LaTeX]TeX,basicstyle=\ttfamily\small,#1}%
- }{}
-
- \CodelineIndex
- \RecordChanges
- \GetFileInfo{scrwfile.dtx}
- \title{The \KOMAScript{} package \texttt{scrwfile}%
- \footnote{This is version \fileversion\ of file \texttt{\filename}.}}
- \date{\filedate}
- \author{Markus Kohm}
-
- \newenvironment{Explain}{\par}{\par}
- \let\Macro\cs
- \let\Package\textsf
- \let\File\texttt
- \let\Option\texttt
- \let\Counter\texttt
- \let\ShowOutput\quote
- \let\endShowOutput\endquote
- \let\Parameter\marg
- \let\OParameter\oarg
- \providecommand\PParameter[1]{\mbox{\texttt{\{#1\}}}}
- \let\PName\meta
- \let\PValue\texttt
- \providecommand*{\important}[1]{}
- \providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:}
- \providecommand*{\AUTOREF}{}
- \makeatletter
- \def\AUTOREF#1:#2:{%
- \edef\@tempa{#1}%
- \edef\@tempb{tab}\ifx\@tempa\@tempb table~\fi
- \edef\@tempb{sec}\ifx\@tempa\@tempb section~\fi
- \ref{#1:#2}%
- }
- \providecommand*{\IndexCmd}[2][]{}
- \providecommand*{\textnote}[2][]{}
- \makeatother
-
- \begin{document}
- \maketitle
- \DocInput{\filename}
- \end{document}
+\documentclass[USenglish]{koma-script-source-doc}
+\usepackage{babel}
+\usepackage{hvlogos}
+\setcounter{StandardModuleDepth}{2}
+\begin{document}
+\DocInput{scrwfile.dtx}
+\end{document}
%</driver>
% \fi
%
-% \selectlanguage{english}
-%
% \changes{v0.1}{2010/10/01}{start of new package}
% \changes{v0.1.7}{2014/10/13}{manual moved to \KOMAScript{} manual}
% \changes{v0.1.9}{2021/05/30}{version number scheme changed}
+% \changes{v0.1.10}{2022/02/05}{switch over from \cls*{scrdoc} to
+% \cls*{koma-script-source-doc}}
+%
+% \GetFileInfo{scrwfile.dtx}
+% \title{Saving Write Handles with the Experimental
+% \href{https://komascript.de}{\KOMAScript} Package \pkg*{scrwfile}}
+% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
+% \date{Version \fileversion{} of \filedate}
+% \maketitle
+% \begin{abstract}
+% The \TeX{} engines \TeX, \pdfTeX, and \XeTeX{} (but not \LuaTeX) do
+% provide only 16 handles for simultaneously write open files. Some of them
+% are already used by \LaTeX{}. Moreover, for every file using
+% \cs{@starttoc} \LaTeX{} keeps a write file open from usage of
+% \cs{@starttoc}, e.g., inside \cs{tableofcontents}, \cs{listoffigures}
+% etc., until the end of the document. Additional write files are used for
+% the index, glossary etc. So sometimes it happens, that there are not
+% enough handles to open another one. \pkg*{scrwfile} was made to change the
+% \LaTeX{} internal handling of all the helper files bases on \cs{@starttoc}
+% to not keep them open simultaneously, but use only one file handle for all
+% of them. So you should never run out of write file handles.
+% \end{abstract}
+%
+% \section{User Manual}
+%
+% You can find the user manual of \pkg*{scrwfile} in the \KOMAScript{} manual,
+% either the German \file{scrguide} or the English \file{scrguien}. But please
+% note:
+% \begin{quote}\bfseries
+% This is an experimental package. Usage of this package is on your own
+% risk. There is no support, if you are using this package, not only for
+% this package but also for the class you are using or other packages, that
+% use \cs{@starttoc} or \cs{@writefile} like \pkg{caption}, \pkg{float},
+% \pkg*{tocbasic}, \pkg{listings} and many more.
+% \end{quote}
+%
+% \MaybeStop{\PrintIndex}
+%
+%
+% \section{Implementation of \pkg*{scrwfile}}
%
-% \StopEventually{%
-% \clearpage
-% \PrintIndex\PrintChanges}
-%
-%
-% \section{Implementation of \Package{scrwfile}}
-%
-% \iffalse
+% \begin{macrocode}
%<*package>
-%<*identify>
-% \fi
+% \end{macrocode}
%
% \begin{macrocode}
+%<*identify>
\PackageWarningNoLine{scrwfile}{%
- THIS IS AN ALPHA VERSION!\MessageBreak
- USAGE OF THIS VERSION IS ON YOUR OWN RISK!\MessageBreak
+ THIS IS AN EXPERIMENTAL PACKAGE!\MessageBreak
+ USAGE OF THIS PACKAGE IS ON YOUR OWN RISK!\MessageBreak
EVERYTHING MAY HAPPEN!\MessageBreak
EVERYTHING MAY CHANGE IN FUTURE!\MessageBreak
THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE!\MessageBreak
- Maybe, it would be better not to load this package.%
+ Maybe, it would be better not to load this package%
}
+%</identify>
% \end{macrocode}
%\iffalse
-%</identify>
%\fi
%
% \subsection{Options}
% \iffalse
%<*option>
% \fi
-%
% Currently we don't need options.
-%
% \iffalse
%</option>
% \fi
%
% \subsection{Body}
-% \iffalse
+% \begin{macrocode}
%<*body>
-% \fi
+% \end{macrocode}
%
% \subsubsection{Needed Packages}
%
-% Package \textsf{scrbase} is needed, because of using several \KOMAScript{}
+% Package \pkg*{scrbase} is needed, because of using several \KOMAScript{}
% basic commands.
% \begin{macrocode}
\RequirePackage{scrbase}[2010/09/17]
% \end{macrocode}
%
-% Package \textsf{scrlfile} is needed because of the \texttt{aux} file
-% handling and \verb|\protected@immediate@write|.
+% Package \pkg*{scrlfile} is needed because of the \file{aux}-file
+% handling and \cs{protected@immediate@write}.
% \begin{macrocode}
\RequirePackage{scrlfile}[2010/09/30]
% \end{macrocode}
%
+% \changes{v0.1.10}{2022/02/04}{\pkg{iftex} is required}
+% Package \pkg{iftex} is used to detect Lua\LaTeX.
+% \begin{macrocode}
+\RequirePackage{iftex}
+% \end{macrocode}
+%
% \subsubsection{Is is needed?}
%
% \changes{v0.1.9}{2021/05/30}{with Lua\LaTeX{} using is not recommended}
-% If the user uses Lua\LaTeX{} usage of \textsf{scrwfile} should not be
+% \changes{v0.1.10}{2022/02/04}{using \cs{ifluatex}}
+% \changes{v0.1.10}{2022/02/04}{\cs{PackageInfoNoLine} replaced by
+% \cs{PackageWarningNoLine}}
+% If the user uses Lua\LaTeX{} usage of \pkg*{scrwfile} should not be
% needed.
% \begin{macrocode}
-\scr@ifluatex{%
- \PackageInfoNoLine{scrwfile}{LuaLaTeX detected.\MessageBreak
+\ifluatex
+ \PackageWarningNoLine{scrwfile}{LuaLaTeX detected.\MessageBreak
With LuaLaTeX you should never get an error message:\MessageBreak
\space\space`No room for a new \string\write'.\MessageBreak
So scrwfile could make much more harm than benefit\MessageBreak
and using it is not recommended}%
-}{}
+\fi
% \end{macrocode}
%
% \subsubsection{\LaTeX{} Kernel Patchs}
@@ -238,15 +182,15 @@
% \begin{description}
% \item[Single handle feature] means, that \LaTeX{} will no longer need a file
% handle for every help file, but only one for all files. We will patch
-% |\@starttoc| and |\@writefile| to do so.
+% \cs{@starttoc} and \cs{@writefile} to do so.
% \item[Clone file feature] means, that every write to one file may be done to
-% another file, too. We will patch |\@writefile| to do so.
+% another file, too. We will patch \cs{@writefile} to do so.
% \end{description}
% Every patch should be minimum invasive, so that files, that are not under
-% \textsf{scrwfile}'s control are changed as little as possible.
+% \pkg*{scrwfile}'s control are changed as little as possible.
%
% \begin{macro}{\scrwfile@if@only}
-% First of all we check, if the file should be handled by \textsf{scrwfile}.
+% First of all we check, if the file should be handled by \pkg*{scrwfile}.
% \begin{macrocode}
\newcommand*{\scrwfile@if@only}[1]{%
\begingroup
@@ -273,16 +217,16 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\scrwfile@starttoc}
-% \begin{macro}{\scrwfile@@starttoc}
-% This is the internal redefinition of |\@starttoc|. First of all test, if it
+% \begin{macro}{\scrwfile@starttoc,\scrwfile@@starttoc}
+% This is the internal redefinition of \cs{@starttoc}. First of all test, if it
% should be used, then use it or not.
% \begin{macrocode}
\newcommand*{\scrwfile@starttoc}[1]{%
\scrwfile@if@only{#1}{\scrwfile@@starttoc}{\scrwfile@saved@starttoc}{#1}%
}
\newcommand*{\scrwfile@@starttoc}[1]{%
-%<trace> \typeout{Use my own \string\@starttoc\space for #1}%
+%<trace> \PackageInfo{scrwfile}{%
+%<trace> Using my own \string\@starttoc\space for `#1'}%
\begingroup
\if@filesw
\xdef\scrwfile@writefilelist{\scrwfile@writefilelist,#1}%
@@ -293,20 +237,18 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\scrwfile@writefile}
-% \begin{macro}{\scrwfile@@writefile}
-% \begin{macro}{\scrwfile@wrtout}
-% \begin{macro}{\scrwfile@writefilelist}
-% This is the internal redefinition of |\@writefile|. First of all test, if it
-% should be used, then use it or not.
+% \begin{macro}{\scrwfile@writefile,\scrwfile@@writefile,\scrwfile@wrtout,
+% \scrwfile@writefilelist}
+% This is the internal redefinition of \cs{@writefile}. First of all test, if
+% it should be used, then use it or not.
% \begin{macrocode}
\newcommand*{\scrwfile@writefile}[1]{%
\scrwfile@if@only{#1}{\scrwfile@@writefile}{\scrwfile@saved@writefile}{#1}%
}
\newcommand{\scrwfile@@writefile}[2]{%
-%<trace> \typeout{Use my own \string\@writefile\space for #1}%
+%<trace> \PackageInfo{scrwfile}{%
+%<trace> Using my own \string\@writefile\space for `#1'}%
\ifnum\scrwfile@wrtout>0
\begingroup
\@temptokena{#2}%
@@ -324,15 +266,12 @@
\newcommand*{\scrwfile@writefilelist}{}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\@writefile}
-% We have to add the single handle feature and the clone file feature to this.
-% \begin{macro}{\scrwfile@saved@writefile}
-% This is the original definition, that will be used, if the file is not under
-% \texttt{scrwfile}'s control.
+% \begin{macro}{\@writefile,\scrwfile@saved@writefile}
+% We have to add the single handle feature and the clone file feature to
+% \cs{@writefile} and therefore save the original
+% definition. \cs{scrwfile@saved@writefile} is used, whenever a file is not
+% under \pkg*{scrwfile}'s control.
% \begin{macrocode}
\newcommand*{\scrwfile@saved@writefile}{}
\BeforeClosingMainAux{%
@@ -367,9 +306,9 @@
}
% \end{macrocode}
% \changes{v0.1.8}{2021/05/30}{added order rule for
-% \textsf{scrlayer-notecolumn}}
+% \pkg*{scrlayer-notecolumn}}
% Note: Here we use a \LaTeX{} version test, because a do-nothing-definition
-% like the one of \textsf{latexrelease} wouldn't be correct, if the command is
+% like the one of \pkg{latexrelease} wouldn't be correct, if the command is
% not supported by the current \LaTeX{} kernel version setting.
% \begin{macrocode}
\IfLTXAtLeastTF{2020/10/01}{%
@@ -389,14 +328,13 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\@starttoc}
-% We have to add the single handle feature to this.
-% \begin{macro}{\scrwfile@saved@starttoc}
+% \begin{macro}{\@starttoc,\scrwfile@saved@starttoc}
+% We have to add the single handle feature to \cs{@starttoc} and therefore
+% save the original definition.
% \changes{v0.1.5}{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. Because of package \textsl{hyperref}, that does
+% \cs{scrwfile@saved@starttoc} is be used, whenever the file is not under
+% \pkg*{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}
@@ -445,14 +383,20 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
%
% \subsubsection{Clone TOC Feature}
%
-% \textsf{scrwfile} may clone a TOC, that means, every entry to one file will
+% \pkg*{scrwfile} may clone a TOC, that means, every entry to one file will
% be copied to other files, too. You must not clone recursively!
%
+% \begin{description}
+% \item[ToDo:]The whole feature should be moved to \pkg*{tocbasic}. But this
+% would need a complete re-implementation and would result in one more write
+% handle for every cloned file. So maybe it wouldn't be a really good idea
+% to do so.
+% \end{description}
+%
% \begin{macro}{\scrwfile@process@clones}
% \begin{macrocode}
\newcommand*{\scrwfile@process@clones}[1]{%
@@ -480,13 +424,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\TOCclone}
+% \begin{command}{\TOCclone}
% \changes{v0.1.8}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}
% \changes{v0.1.8}{2019/11/19}{\cs{ifattoclist} replaced by \cs{Ifattoclist}}
% \changes{v0.1.8}{2019/11/19}{\cs{iftocfeature} replaced by
% \cs{Iftocfeature}}
% \changes{v0.1.8}{2020/02/25}{spurious space in warning message removed}
-% \changes{v0.1.9}{2021/05/30}{requires package \textsf{tocbasic}}
+% \changes{v0.1.9}{2021/05/30}{requires package \pkg*{tocbasic}}
% \changes{v0.1.9}{2021/05/30}{can be used only in preamble}
% Clone the entries from the second (first mandatory) argument TOC to the
% third (second mandatory) argument TOC. If the first (optional) argument was
@@ -494,8 +438,10 @@
% the toc features \texttt{leveldown}, \texttt{numbered}, \texttt{onecolumn}
% and \texttt{totoc} of |#2| to |#3|. The toc feature \texttt{nobabel} will
% always be set, because the babel entries at TOC |#3| will be cloned from TOC
-% |#2|. \textbf{Note:} We use owner \texttt{TOCclone} for all cloned
-% extensions.
+% |#2|.
+% \begin{description}
+% \item{Note:} We use owner \texttt{TOCclone} for all cloned extensions.
+% \end{description}
% \begin{macrocode}
\newcommand*{\TOCclone}[3][]{%
\RequirePackage{tocbasic}%
@@ -534,23 +480,23 @@
}%
}
\@onlypreamble\TOCClone
+%</body>
% \end{macrocode}
-% \end{macro}
+% \end{command}
%
-% \iffalse
-%</body>
+% \begin{macrocode}
%</package>
-% \fi
+% \end{macrocode}
%
% \Finale
-%
-\endinput
-%
-% end of file `scrwfile.dtx'
-
-%%% Local Variables:
-%%% mode: doctex
-%%% mode: flyspell
-%%% ispell-local-dictionary: "english"
-%%% TeX-master: t
-%%% End:
+% \PrintChanges
+%
+% \endinput
+% Local Variables:
+% mode: doctex
+% ispell-local-dictionary: "en_US"
+% eval: (flyspell-mode 1)
+% TeX-master: t
+% TeX-engine: luatex-dev
+% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
+% End: