diff options
author | Karl Berry <karl@freefriends.org> | 2007-09-16 00:07:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-09-16 00:07:34 +0000 |
commit | d85f248e3b38ea0ecda38c5340e3cadd08d65346 (patch) | |
tree | 52e17f32b395006895b3917bc7729c7ac1514ae3 /Master/texmf-dist/source/latex | |
parent | 2389552f283181e0d8c610037712ade989112da3 (diff) |
oberdiek update (14sep07)
git-svn-id: svn://tug.org/texlive/trunk@4947 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
63 files changed, 11103 insertions, 1059 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/accsupp.dtx b/Master/texmf-dist/source/latex/oberdiek/accsupp.dtx index 4ca301db4bf..39ace16bc8d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/accsupp.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/accsupp.dtx @@ -671,6 +671,7 @@ A\notparallel B % \begin{macrocode} %</dvips> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/aliascnt.dtx b/Master/texmf-dist/source/latex/oberdiek/aliascnt.dtx index b280be8396e..e7368483072 100644 --- a/Master/texmf-dist/source/latex/oberdiek/aliascnt.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/aliascnt.dtx @@ -340,6 +340,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/alphalph.dtx b/Master/texmf-dist/source/latex/oberdiek/alphalph.dtx index 7fba92f4829..3a3d117ec0b 100644 --- a/Master/texmf-dist/source/latex/oberdiek/alphalph.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/alphalph.dtx @@ -17,7 +17,8 @@ % % This work consists of the main source file alphalph.dtx % and the derived files -% alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv. +% alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv, +% alphalph-test1.tex, alphalph-test2.tex, alphalph-test3.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/alphalph.dtx @@ -52,6 +53,9 @@ % Installation: % TDS:tex/generic/oberdiek/alphalph.sty % TDS:doc/latex/oberdiek/alphalph.pdf +% TDS:doc/latex/oberdiek/alphalph-test1.tex +% TDS:doc/latex/oberdiek/alphalph-test2.tex +% TDS:doc/latex/oberdiek/alphalph-test3.tex % TDS:source/latex/oberdiek/alphalph.dtx % %<*ignore> @@ -67,7 +71,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: alphalph 2007/04/11 v1.5 Converting numbers to letters (HO)} +\Msg{* Package: alphalph 2007/04/11 v2.0 Converting numbers to letters (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +98,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file alphalph.dtx and the derived files - alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv. + alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv, + alphalph-test1.tex, alphalph-test2.tex, alphalph-test3.tex. \endpreamble @@ -103,6 +108,10 @@ and the derived files \file{alphalph.drv}{\from{alphalph.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{alphalph.sty}{\from{alphalph.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{alphalph-test1.tex}{\from{alphalph.dtx}{test1}}% + \file{alphalph-test2.tex}{\from{alphalph.dtx}{test2,etex}}% + \file{alphalph-test3.tex}{\from{alphalph.dtx}{test2,noetex}}% } \obeyspaces @@ -128,17 +137,42 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{alphalph.drv}% - [2007/04/11 v1.5 Converting numbers to letters (HO)]% + [2007/04/11 v2.0 Converting numbers to letters (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} -\usepackage{alphalph} +\usepackage{alphalph}[2007/04/11] +\makeatletter +\newalphalph{\fnsymbolwrap}[wrap]{\@fnsymbol}{} +\newcommand*{\fnsymbolsingle}[1]{% + \ensuremath{% + \ifcase#1% + \or *% + \or \dagger + \or \ddagger + \or \mathsection + \or \mathparagraph + \else + \@ctrerr + \fi + }% +} +\makeatother +\newalphalph{\fnsymbolmult}[mult]{\fnsymbolsingle}{} +\usepackage{amsmath} +\DeclareMathOperator{\opDiv}{div} +\DeclareMathOperator{\opMod}{mod} +\newcommand*{\Def}{% + \ensuremath{% + \mathrel{\mathop{:}}=% + }% +} \begin{document} \DocInput{alphalph.dtx}% \end{document} %</driver> % \fi % -% \CheckSum{406} +% \CheckSum{1035} % % \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 @@ -159,100 +193,352 @@ and the derived files % \GetFileInfo{alphalph.drv} % % \title{The \xpackage{alphalph} package} -% \date{2007/04/11 v1.5} +% \date{2007/04/11 v2.0} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle % % \begin{abstract} -% The package provides the new expandable commands \cs{alphalph} -% and \cs{AlphAlph}. They are like \cs{number}, but the expansion -% consists of lowercase and uppercase letters respectively. +% The package provides methods to represent numbers with a limited +% set of symbols. Both \LaTeX\ and \plainTeX are supported. % \end{abstract} % % \tableofcontents % -% \newenvironment{param}{^^A -% \newcommand{\entry}[1]{\meta{\###1}:&}^^A -% \begin{tabular}[t]{@{}l@{ }l@{}}^^A -% }{^^A -% \end{tabular}^^A -% } +% \section{Documentation} % -% \section{Usage} -% The package \Package{alphalph} can be used with both \plainTeX\ -% and \LaTeX: -% \begin{description} -% \item[\plainTeX:] |\input alphalph.sty| -% \item[\LaTeXe:] |\usepackage{alphalph}|\\ -% There aren't any options. -% \end{description} +% \subsection{Introduction} +% \LaTeX\ counter can be represented in different ways +% by using presentation commands: +% \begin{quote} +% \cs{arabic}, \cs{roman}, \cs{Roman},\\ +% \cs{alph}, \cs{Alph}, \cs{fnsymbol} +% \end{quote} +% The ranges of supported counter values are more or less +% restricted. Only \cs{arabic} can be used with any counter +% value \TeX\ supports. +% \begin{quote} +% \catcode`\|=12 % +% \begin{tabular}{@{}l|l|l|l@{}} +% Presentation & Supported & Ignored & Error message\\ +% command & domain & values & ``Counter too large''\\ +% \hline +% \cs{arabic} +% & \ttfamily -MAX..MAX & &\\ +% \cs{roman}, \cs{Roman} +% & \ttfamily 1..MAX & \ttfamily MAX..0 &\\ +% \cs{alph}, \cs{Alph} +% & \ttfamily 1..26 & 0 & \ttfamily MAX..-1, 27..MAX\\ +% \cs{fnsymbol} +% & \ttfamily 1..9 & 0 & \ttfamily -MAX..-1, 10..MAX\\ +% \hline +% \end{tabular}\\[1ex] +% \texttt{MAX} = \texttt{2147483647} +% \end{quote} +% Ordinal numbers are often used in documents: numbering +% of chapters, sections, figures, footnotes and so on. +% The layouter chooses \cs{Alph} for chapter numbers +% and \cs{fnsymbol} for footnotes. But what can be done +% if there are more than 26 chapters or more than 10 footnotes? +% This package \xpackage{alphalph} allows to define new +% presentation commands. They rely on a existing command +% and define presentations for values greater the limits. +% Three different methods are provided by the package. +% In the following use cases they are presentated. +% +% \subsection{Use cases} +% +% \subsubsection{Number system based on symbols} +% +% Asume you are writing a book and your lecturer demands +% that chapter numbers must be letters. But you have already +% 30 chapters and you have only 26 letters? +% +% In the decimal system the situation would be clear. +% If you run out of digits, you are using more digits +% to represent a number. This method can be also be used +% for letters. After chapter 26 with |Z| we us |AA|, |AB|, |AC|, and |AD| +% for the remaining chapters. +% +% Happily this package already defines this presentation command: +%\begin{quote} +%\begin{verbatim} +%\usepackage{alphalph} +%\renewcommand*{\thechapter}{% +% \AlphAlph{\value{chapter}}% +%} +%\end{verbatim} +%\end{quote} +% \cs{AlphAlph} generates: +% \AlphAlph{1}, \AlphAlph{2}, \AlphAlph{3}, \dots, +% \AlphAlph{26}, \AlphAlph{27}, \AlphAlph{28}, \dots +% +% The other presentation command is \cs{alphalph} for lowercase letters. +% +% \subsubsection{Wrap symbols around} +% +% Nine footnote symbols are quite a few. +% Too soon the symbols are consumed +% and \LaTeX\ complains with the error ``Counter too large''. +% However, it could be acceptable to start again with the symbols +% from the beginning, especially if there are less than nine symbols +% on a page. +% This could be achieved by a counter reset. +% But finding the right place can be difficult or needs manual +% actions. Also a +% unique counter value can be desirable (e.g. for generating +% unique anchor/link names). +% Package \xpackage{alphalph} allows you to define +% a macro that implements a ``wrap around'', but letting +% the value of the counter untouched: +%\begin{quote} +%\begin{verbatim} +%\usepackage{alphalph} +%\makeatletter +%\newalphalph{\fnsymbolwrap}[wrap]{\@fnsymbol}{} +%\makeatother +%\renewcommand*{\thefootnote}{% +% \fnsymbolwrap{\value{footnote}}% +%} +%\end{verbatim} +%\end{quote} +% \cs{fnsymbolwrap} generates: +% \fnsymbolwrap{1}~(1), \fnsymbolwrap{2}~(2), \fnsymbolwrap{3}~(3), \dots, +% \fnsymbolwrap{9}~(9), \fnsymbolwrap{10}~(10), \fnsymbolwrap{11}~11, \dots % -% \subsection{User commands} -% \begin{description} -% \item[\cmd{\alphalph}:]\DescribeMacro{\alphalph} -% This works like \cmd{\number}, but the expansion consists of -% lowercase letters. -% \item[\cmd{\AlphAlph}:]\DescribeMacro{\AlphAlph} -% It converts a number into uppercase letters. -% \end{description} -% Both commands have following properties: -% \begin{itemize} -% \item They are fully expandable. This means that they can safely -% \begin{itemize} -% \item be written to a file, -% \item used in moving arguments (\LaTeX: they are \emph{robust}), -% \item used in a \cmd{\csname}-\cmd{\endcsname} pair. -% \end{itemize} -% \item If the argument is zero or negative, the commands expand -% to nothing like \cmd{\romannumeral}. -% \item As argument is allowed all that can be used after a \cmd{\number}: -% \begin{itemize} -% \item explicite constants, -% \item macros that expand to a number, -% \item count registers, \LaTeX\ counter can used -% via \cmd{\value}, e.\,g.:\\ -% |\alphalph{\value{page}}| -% \end{itemize} -% \end{itemize} -% -% The following table shows, how the conversion is made: -% \begin{center} -% \catcode`\|=12 -% \catcode`\+\active -% \def+#1&{\alphalph{#1}&}% -% \begin{tabular}{@{}l|*{14}{r@{, }}r@{}} -% number & 1& 2&\dots& 26& 27&\dots& 52& 53& -% \dots& 78& 79&\dots& 702& 703&\dots -% \\\hline -% \cmd{\alphalph}&+1&+2&\dots&+26&+27&\dots&+52&+53& -% \dots&+78&+79&\dots&+702&+703&\dots -% \end{tabular} -% \end{center} -% -% \subsubsection{New commands like \cs{alphalph}} -% \begin{description} -% \item[\cmd{\newalphalph}:]\DescribeMacro{\newalphalph} -% This macro defines a new command that acts like \cs{alphalph}. -% The use of \eTeX is required. -% The macro has three arguments: -% \begin{itemize} -% \item[\texttt{\#1}:] The command to be defined. -% \item[\texttt{\#2}:] A macro that converts a positive number -% to a symbol. -% \item[\texttt{\#3}:] The number of available symbols. -% \end{itemize} -% \end{description} -% -% Example: +% \subsubsection{Multiple symbols} +% +% \LaTeX's standard set of footnote symbols contains doubled +% symbols at the higher positions. Could this principle +% be generalized? +% Yes, but first we need a clean footnote symbol list without +% doubled entries, example: +%\begin{quote} +%\begin{verbatim} +%\usepackage{alphalph} +%\makeatletter +%\newcommand*{\fnsymbolsingle}[1]{% +% \ensuremath{% +% \ifcase#1% +% \or *% +% \or \dagger +% \or \ddagger +% \or \mathsection +% \or \mathparagraph +% \else +% \@ctrerr +% \fi +% }% +%} +%\makeatother +%\newalphalph{\fnsymbolmult}[mult]{\fnsymbolsingle}{} +%\renewcommand*{\thefootnote}{% +% \fnsymbolmult{\value{footnote}}% +%} +%\end{verbatim} +%\end{quote} +% The own definition of \cs{fnsymbolsingle} has the +% advantage that this list can easily modified. +% Otherwise you can use \cs{@fnsymbol} directly, +% because it uses the same first five symbols. %\begin{quote} %\begin{verbatim} -%\newcommand*{\myvocals}[1]{% -% \ifcase#1\or A\or E\or I\or O\or U\fi +%\usepackage{alphalph} +%\makeatletter +%\newalphalph{\fnsymbolmult}[mult]{\@fnsymbol}{5} +%\makeatother +%\renewcommand*{\thefootnote}{% +% \fnsymbolmult{\value{footnote}}% %} -%\newalphalph{\vocalsvocals}{\myvocals}{5} %\end{verbatim} %\end{quote} +% \cs{fnsymbolmult} generates: +% \fnsymbolmult{1}~(1), \fnsymbolmult{2}~(2), \fnsymbolmult{3}~(3), +% \fnsymbolmult{4}~(4), \fnsymbolmult{5}~(5), \fnsymbolmult{6}~(6), +% \dots, \fnsymbolmult{16}~16, \fnsymbolmult{17}~17, \dots +% +% \bigskip +% The same method can also be used for the chapter problem +% in the first discussed use case: +%\begin{quote} +%\begin{verbatim} +%\usepackage{alphalph} +%\makeatletter +%\newalphalph{\AlphMult}[mult]{\@Alph}{26} +%\makeatother +%\renewcommand*{\chapter}{% +% \AlphMult{\value{chapter}}% +%} +%\end{verbatim} +%\end{quote} +% \cs{AlphMult} then generates AA, BB, CC, and DD for chapters 27--30. +% +% \subsection{Glossary} +% +% \begin{description} +% \item[Counter presentation command] is a macro that +% expects a \LaTeX\ counter name as argument. +% Numbers cannot be used. Examples: +% \cs{arabic}, \cs{alph}, \cs{fnsymbol}. +% \item[Number presentation command] is a macro that +% expects a number as argument. A number is anything +% that \TeX\ accepts as number including \cs{value}. +% Examples: \cs{alphalph}, \cs{AlphAlph}, \cs{alphalph@alph} +% +% However, \cs{alph} or \cs{fnsymbol} are not number +% presentation commands because they expect a counter +% name as argument. Happily \LaTeX\ counter presentation +% commands internally uses number presentation commands +% with the same name, but prefixed by `@'. Thus +% \cs{@alph}, \cs{@fnsymbol} are number presentation commands. +% \item[Symbols provider] is a command that can be used +% to get a list of symbols. For example, \cs{@Alph} +% provides the 26 uppercase letters from `A' to `Z'. +% Basically a symbol provider is a number presentation +% command, usually with a limited range. +% \item[Number of symbols] is the number of the +% last symbol slot of a symbol provider. Thus \cs{@Alph} +% generates 26 symbols, \cs{@fnsymbol} provides 9 symbols. +% \end{description} +% +% \subsection{Package usage} +% +% The package \Package{alphalph} can be used with both \plainTeX\ +% and \LaTeX: +% \begin{description} +% \item[\plainTeX:] |\input alphalph.sty| +% \item[\LaTeXe:] |\usepackage{alphalph}|\\ +% There aren't any options. +% \end{description} +% +% \subsection{User commands} +% +% \begin{declcs}{AlphAlph} \M{number}\\ +% \cs{alphalph} \M{number} +% \end{declcs} +% Both macros are number presentation commands that +% expects a number as argument. \LaTeX\ counters +% are used with \cs{value}. +% +% The macros represents a number by letters. +% First single letters |A..Z| are used, then +% two letters |AA..ZZ|, three letters |AAA...ZZZ|, \dots +% follow. +% +% Macro \cs{AlphAlph} uses uppercase letters, +% \cs{alphalph} generates the lowercase variant. +% \begin{quote} +% \catcode`\|=12 +% \def\entry#1{ +% \texttt{#1} +% & \texttt{\AlphAlph{#1}} +% & \texttt{\alphalph{#1}} +% } +% \begin{tabular}{@{}l|l|l@{}} +% \meta{number} & \verb|\AlphAlph{|\meta{number}\verb|}| +% & \verb|\alphalph{|\meta{number}\verb|}|\\ +% \hline +% \entry{1}\\ +% \entry{2}\\ +% \entry{26}\\ +% \entry{27}\\ +% \entry{30}\\ +% \entry{2000}\\ +% \entry{3752127}\\ +% \entry{10786572}\\ +% \entry{2147483647}\\ +% \end{tabular} +% \end{quote} +% +% \begin{declcs}{newalphalph} +% \M{cmd} +% |[|\meta{method}|]| +% \M{symbols provider} +% \M{number of symbols} +% \end{declcs} +% Macro \cs{newalphalph} defines \meta{cmd} as new +% number presentation command. Like \cs{newcommand} an error +% is thrown, if macro \meta{cmd} already exists. +% +% The \meta{method} is one of |alph|, |wrap|, or |mult|. +% The default is |alph|. +% +% As symbol provider a number presentation command +% can be used, e.g. \cs{@fnsymbol}, \cs{@Alph}, or +% \cs{alphalph@alph}. +% +% The last argument is the number of symbols. +% If the argument is empty, then \cs{newalphalph} tries +% to find this number itself. \LaTeX's number presentation +% commands throw an error message, if the number is too large. +% This error message is put in a macro \cs{@ctrerr}. +% Thus \cs{newalphalph} calls the symbol provider and tests +% a number by typesetting it in a temporary box. The error +% macro \cs{@ctrerr} is catched, it proofs that the number +% is not supported. Also if the width of the result is zero +% the number is considered as unavailable. +% +% The empty argument is useful for potentially variable lists. +% However if the end cannot be detected, then the number of +% symbols must be given. This is also a lot faster. Therefore don't +% let the argument empty without reason. +% +% \subsection{Programmer commands} +% +% \begin{declcs}{alphalph@Alph} \M{number}\\ +% \cs{alphalph@alph} \M{number} +% \end{declcs} +% They are basically the same as \cs{@Alph} and \cs{@alph}. +% Some languages of package \xpackage{babel} redefine +% \LaTeX's macros to include some font setup that +% breaks expandibility. Therefore \cs{AlphAlph} and \cs{alphalph} +% are based on \cs{alphalph@Alph} and \cs{alphalph@alph} to get +% the letters. The behaviour of these symbol providers for numbers +% outside the range |1..26| is undefined. +% +% \subsection{Design principles} +% +% \subsubsection{Number presentation commands} +% +% All number presentation commands that this package defines +% (including \cs{alphalph} and \cs{AlphAlph}) have the following +% properties: +% \begin{itemize} +% \item They are fully expandable. This means that they can safely +% \begin{itemize} +% \item be written to a file, +% \item used in moving arguments (\LaTeX: they are \emph{robust}), +% \item used in a \cmd{\csname}-\cmd{\endcsname} pair. +% \end{itemize} +% \item If the argument is zero or negative, the commands expand +% to nothing like \cmd{\romannumeral}. +% \item The argument is a \TeX\ number. Anything that would be +% accepted by \cmd{\number} is a valid argument: +% \begin{itemize} +% \item explicite constants, +% \item macros that expand to a number, +% \item count registers, \LaTeX\ counter can used +% via \cmd{\value}, e.\,g.:\\ +% |\alphalph{\value{page}}| +% \item \dots +% \end{itemize} +% \item \eTeX's numeric expressions are supported, if \eTeX\ is +% available. Then \cs{numexpr} is applied to the argument. +% Package \cs{calc}'s expressions are not supported. +% That would violate the expandibility. +% \end{itemize} +% +% \subsubsection{General usability} +% +% \begin{description} +% \item[\TeX\ format:] +% The package does not depend on \LaTeX, it can also be used +% by \plainTeX, for example. +% \item[\eTeX:] \eTeX is supported, the macros are shorter and +% faster. But \eTeX's extensions are not requirements. +% Without \eTeX, just the implementation changes. The properties +% remain unchanged. +% \end{description} % % \StopEventually{ % } @@ -319,18 +605,107 @@ and the derived files \fi \expandafter\x\csname ver@alphalph.sty\endcsname \ProvidesPackage{alphalph}% - [2007/04/11 v1.5 Converting numbers to letters (HO)] + [2007/04/11 v2.0 Converting numbers to letters (HO)] % \end{macrocode} % -% For unique command names this package uses |aa@| as prefix -% for internal command names. Because we need |@| as a letter -% we save the current catcode value. +% \subsection{Catcodes} +% % \begin{macrocode} -\expandafter\edef\csname aa@atcode\endcsname{\the\catcode`\@ } -\catcode`\@=11 +\expandafter\edef\csname AlPh@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\AlPh@AtEnd{% + \AlPh@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{59}{12}% ; +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{91}{12}% [ +\TMP@EnsureCode{93}{12}% ] +\TMP@EnsureCode{96}{12}% ` +\TMP@EnsureCode{124}{12}% | +% \end{macrocode} +% +% \subsection{Package loading} +% +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax + \input infwarerr.sty\relax + \input intcalc.sty\relax +\else + \RequirePackage{infwarerr}[2007/09/09]% + \RequirePackage{intcalc}[2007/09/09]% +\fi +% \end{macrocode} +% +% \subsection{\eTeX\ detection} +% +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname numexpr\endcsname\relax + \catcode124=9 % '!': ignore + \catcode43=14 % '+': comment +\else + \catcode124=14 % '!': comment + \catcode43=9 % '+': ignore +\fi % \end{macrocode} % % \subsection{Help macros} +% +% \begin{macro}{\AlPh@Error} +% \begin{macrocode} +\def\AlPh@Error#1{% + \begingroup + \escapechar=92 % backslash + \@PackageError{alphalph}{#1}\@ehc + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AlPh@IfDefinable} +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname @ifdefinable\endcsname\relax + \def\AlPh@IfDefinable#1#2{% + \ifcase\ifx#1\@undefined\else\ifx#1\relax\else1\fi\fi0 % + #2% + \else + \AlPh@Error{% + Command \string#1 already defined% + }% + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\else +% \end{macrocode} +% \begin{macro}{\AlPh@IfDefinable} +% \begin{macrocode} + \let\AlPh@IfDefinable\@ifdefinable +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\fi +% \end{macrocode} +% % \begin{macro}{\@ReturnAfterElseFi} % \begin{macro}{\@ReturnAfterFi} % The following commands moves the `then' and `else' part respectively @@ -338,7 +713,7 @@ and the derived files % and so a \TeX\ capacity error because of a limited input stack size. % I use this trick in several packages, so I don't prefix these internal % commands in order not to have the same macros with different names. -% (It saves memory). +% (It saves memory.) % \begin{macrocode} \long\def\@ReturnAfterElseFi#1\else#2\fi{\fi#1} \long\def\@ReturnAfterFi#1\fi{\fi#1} @@ -346,461 +721,810 @@ and the derived files % \end{macro} % \end{macro} % -% \begin{macro}{\aa@alph} -% \begin{macro}{\aa@Alph} -% The two commands \cmd{\aa@alph} and \cmd{\aa@Alph} convert a -% number into a letter (lowercase and uppercase respectivly). +% \begin{macro}{\@gobblefour} +% \LaTeX\ defines commands for eating arguments. +% Define \cs{@gobblefour} if it is not defined (\plainTeX). +% \begin{macrocode} +\expandafter\ifx\csname @gobblefour\endcsname\relax + \long\def\@gobblefour#1#2#3#4{}% +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{AlPh@IfOptArg} +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname kernel@ifnextchar\endcsname\relax + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname @ifnextchar\endcsname\relax + \def\AlPh@IfOptArg#1#2{% + \def\AlPh@TempA{#1}% + \def\AlPh@TempB{#2}% + \futurelet\AlPh@Token\AlPh@IfOptArgNext + }% + \let\AlPh@BracketLeft=[%] + \def\AlPh@IfOptArgNext{% + \ifx\AlPh@Token\AlPh@BracketLeft + \expandafter\AlPh@TempA + \else + \expandafter\AlPh@TempB + \fi + }% + \else + \def\AlPh@IfOptArg{\@ifnextchar[}%] + \fi +\else + \def\AlPh@IfOptArg{\kernel@ifnextchar[}%] +\fi +% \end{macrocode} +% \end{macro} +% +% \subsection{Symbol provider} +% +% \subsubsection{Alphabet} +% +% The output of \cs{alphalph} and \cs{AlphAlph} should be +% usable as part of command names (see \cs{@namedef}, \cs{csname}, \dots). +% Unhappily some languages of package \xpackage{babel} +% redefine \LaTeX's \cs{@alph} and \cs{@Alph} in a manner that +% they cannot be used in expandable context any more. +% Therefore package \xpackage{alphalph} provides its own +% commands. +% +% \begin{macro}{\alphalph@Alph} +% \begin{macro}{\alphalph@alph} +% The two commands \cmd{\AlPh@Alph} and \cmd{\AlPh@alph} convert a +% number into a letter (uppercase and lowercase respectivly). % The character |@| is used as an error symbol, % if the number isn't in the range of 1 until 26. % Here we need no space after the number |#1|, because the error % symbol |@| for the zero case stops scanning the number. +% This error symbol should not appear anywhere (except for bugs). % \begin{macrocode} -\def\aa@alph#1{% +\def\alphalph@Alph#1{% \ifcase#1% @% - \or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% - \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z% + \or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% + \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z% \else + \AlPh@ctrerr @% \fi } -\def\aa@Alph#1{% +\def\alphalph@alph#1{% \ifcase#1% @% - \or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% - \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z% + \or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% + \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z% \else + \AlPh@ctrerr @% \fi } % \end{macrocode} % \end{macro} % \end{macro} -% -% \subsection{User commands} -% \begin{macro}{\alphalph} -% \begin{macro}{\AlphAlph} -% The whole difference between \cmd{\alphalph} and \cmd{\AlphAlph} -% is that the output consists of lowercase or uppercase letters. +% \begin{macro}{\AlPh@ctrerr} +% Macro \cs{AlPh@ctrerr} is used as hook for the algorithm +% to get the available number of symbols. % \begin{macrocode} -\def\alphalph{\aa@callmake\aa@alph} -\def\AlphAlph{\aa@callmake\aa@Alph} +\def\AlPh@ctrerr{} % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\aa@callmake} -% \cmd{\aa@callmake} converts the number in -% the second argument |#2| into explicite decimal digits via -% the \TeX\ primitive \cmd{\number}. (The closing curly brace stops reading -% the number at the latest.) +% \subsection{Finding number of symbols} +% +% \begin{macro}{\AlPh@GetNumberOfSymbols} +% \noindent +% |#1|: symbols provider % \begin{macrocode} -\def\aa@callmake#1#2{% - \expandafter\aa@make\expandafter{\number#2}#1% +\def\AlPh@GetNumberOfSymbols#1{% + \AlPh@TestNumber1!{#1}% + \ifAlPh@Unavailable + \def\AlPh@Number{0}% + \AlPh@Error{No symbols found}% + \else + \def\AlPh@Number{1}% + \AlPh@ExpSearch2!{#1}% + \fi } % \end{macrocode} % \end{macro} -% -% \eTeX provides the new primitive \cmd{\numexpr}. -% With this command the implementation is very simple -% (see \ref{sec:etex}). Therefore the package provides two -% methods: a fast and simple one that uses the \eTeX\ extension -% and a method that is restricted to the standard \TeX\ means. -% -% Now we distinguish between \TeX\ and \eTeX\ by checking -% whether \cmd{\numexpr} is defined or isn't. -% Because the \TeX\ primitive \cmd{\csname} defines an -% undefined command to be \cmd{\relax}, \cmd{\csname} -% is executed in a group. +% \begin{macro}{\ifAlPh@Unavailable} % \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname numexpr\endcsname\relax +\newif\ifAlPh@Unavailable +\def\AlPh@Unavailabletrue{% + \global\let\ifAlPh@Unavailable\iftrue +} +\def\AlPh@Unavailablefalse{% + \global\let\ifAlPh@Unavailable\iffalse +} % \end{macrocode} -% -% \subsection{\texorpdfstring{Conversion with standard \TeX\ means}{\TeX}} -% \begin{macro}{\aa@make} -% \cmd{\aa@make} catches the cases, if the number is zero or negative. -% Then it expands to nothing like \cmd{\romannumeral}. +% \end{macro} +% \begin{macro}{\AlPh@TestNumber} +% |#1|: number to be tested\\ +% |#2|: symbols provider % \begin{macrocode} - \def\aa@make#1#2{% - \ifnum#1<1 % - \else - \@ReturnAfterFi{% - \aa@process1;#1;1..#2% - }% +\def\AlPh@TestNumber#1!#2{% + \AlPh@Unavailablefalse + \begingroup + \setbox0=\hbox{% + \begingroup % color + \let\@ctrerr\AlPh@Unavailabletrue + \let\AlPh@ctrerr\AlPh@Unavailabletrue + #2{#1}% + \endgroup + }% + \ifdim\wd0=0pt % + \AlPh@Unavailabletrue \fi - }% + \endgroup +} % \end{macrocode} % \end{macro} -% -% \begin{macro}{\aa@process} -% \cmd{\aa@process} contains the algorithm for the conversion. -% \TeX doesn't provide a simple method to divide or multiply -% numbers in a fully expandable way. An expandable addition by one -% is complicated enough. Therefore \cmd{\aa@process} uses -% only expandible versions of additions by one. The algorithm -% starts with one and increments it until the size of the wanted -% number is reached. The intermediate number that is incremented -% is present in two kinds: -% \begin{itemize} -% \item the normal decimal form for the \cs{ifnum}-comparison, -% \item a digit format: the end of each digit is marked by an dot, -% and the digits are in reserved order. An empty digit -% ends this format. The meaning of a digit is here the -% decimal representation of a letter, the range is -% from 1 until 26. -% \end{itemize} -% Example: The aim number is 100, the intermediate number 50, so -% following would be on the argument stack: -% \begin{quote} -% |50;100;24.1..\aa@alph| -% \end{quote} -% \cmd{\aa@process} increments the first argument |#1| (|50|), -% and calls \cmd{\aa@alphinc} to increment the digit form -% (|24.1..|). The middle part with the aim number |;#2;| (|;100;|) -% will not be changed. Neither \cmd{\aa@process} nor \cmd{\aa@alphinc} -% need the conversion command \cmd{\aa@alph} nor \cmd{\aa@Alph}. -% This command is read by \cmd{\aa@getresult}, if the digit form is -% ready. -% -% The expansion motor is \cmd{\number}. It reads and expands token -% to get decimal numbers until a token is reached that isn't a -% decimal digit. So the expansion doesn't stop, if \cmd{\aa@inc} -% is ready, because \cmd{\aa@inc} produces only decimal digits. -% \cmd{\aa@alphinc} is expanded to look for further digits. -% Now \cmd{\aa@alphinc} makes its job and returns with its -% argument |;#2;|. At last the first character |;| finishes \cmd{\number}. +% \begin{macro}{\AlPh@ExpSearch} +% |#1|: number to be tested\\ +% |#2|: symbols provider % \begin{macrocode} - \def\aa@process#1;#2;{% - \ifnum#1=#2 % - \expandafter\aa@getresult +\def\AlPh@ExpSearch#1!#2{% + \let\AlPh@Next\relax + \AlPh@TestNumber#1!{#2}% + \ifAlPh@Unavailable + \expandafter\AlPh@BinSearch\AlPh@Number!#1!{#2}% + \else + \def\AlPh@Number{#1}% + \ifnum#1>1073741823 % + \AlPh@TestNumber2147483647!{#2}% + \ifAlPh@Unavailable + \AlPh@BinSearch#1!2147483647!{#2}% + \else + \def\AlPh@Number{0}% + \AlPh@Error{% + Maximal symbol number not found% + }% + \fi \else - \@ReturnAfterFi{% - \expandafter\aa@process\number\aa@inc{#1}\aa@alphinc{;#2;}% + \def\AlPh@Next{% + \expandafter\AlPh@ExpSearch\number\intcalcShl{#1}!{#2}% }% \fi - }% + \fi + \AlPh@Next +} % \end{macrocode} % \end{macro} -% -% \subsubsection{\texorpdfstring{^^A -% Convert the separated digits to the letter result}{^^A -% Digits to letter result}}\label{sec:form} -% -% The single decimal digits of the final letter number are -% limited by a dot and come in reverse order. The end is -% marked by an empty digit. -% The next token is the command to convert a digit -% (\cmd{\aa@alph} or \cmd{\aa@Alph}), e.g.: -% \begin{quote} -% |11.3.1..\alph| $\Rightarrow$ |ack| -% \end{quote} -% -% \begin{macro}{\aa@getresult} -% \cmd{\aa@getresult} reads the digits |#1| and the converting -% command |#2|. Then it -% calls \cmd{\aa@@getresult} with its arguments. +% \begin{macro}{\AlPh@BinSearch} +% |#1|: available number\\ +% |#2|: unavailable number, |#2| $>$ |#1|\\ +% |#3|: symbols provider % \begin{macrocode} - \def\aa@getresult#1..#2{% - \aa@@getresult!#2#1..% - }% +\def\AlPh@BinSearch#1!#2!#3{% + \expandafter\AlPh@ProcessBinSearch + \number\intcalcShr{\intcalcAdd{#1}{#2}}!% + #1!#2!{#3}% +} % \end{macrocode} % \end{macro} -% -% \begin{macro}{\aa@@getresult} -% In its first argument |#1| \cmd{\aa@@getresult} collects the -% converted letters in the correct order. Character |!| is used -% as a parameter separator. The next token |#2| is the converting -% command (\cmd{\aa@alph} or \cmd{\aa@Alph}). The next digit |#3| -% is read, converted, and |\aa@@getresult| is called again. -% If the digit |#3| is empty, the end of the digit form is reached -% and the process stops and the ready letter number is output. +% \begin{macro}{\AlPh@ProcessBinSearch} +% |#1|: number to be tested, |#2| $\leq$ |#1| $\leq$ |#3|\\ +% |#2|: available number\\ +% |#3|: unavailable number\\ +% |#4|: symbols provider % \begin{macrocode} - \def\aa@@getresult#1!#2#3.{% - \ifx\\#3\\% - \@ReturnAfterElseFi{#1}% ready +\def\AlPh@ProcessBinSearch#1!#2!#3!#4{% + \let\AlPh@Next\relax + \ifnum#1>#2 % + \ifnum#1<#3 % + \AlPh@TestNumber#1!{#4}% + \ifAlPh@Unavailable + \def\AlPh@Next{% + \AlPh@BinSearch#2!#1!{#4}% + }% + \else + \def\AlPh@Next{% + \AlPh@BinSearch#1!#3!{#4}% + }% + \fi \else - \@ReturnAfterFi{% - \expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter - \aa@@getresult - \expandafter\expandafter\expandafter\expandafter - #2{#3}#1!#2% - }% + \def\AlPh@Number{#2}% \fi - }% + \else + \def\AlPh@Number{#2}% + \fi + \AlPh@Next +} % \end{macrocode} % \end{macro} % -% \subsubsection{Addition by one} -% -% \paragraph{Expandable addition of a decimal integer.} -% \begin{macro}{\aa@inc} -% \cmd{\aa@inc} increments its argument |#1| by one. -% The case, that the whole number is less than nine, is -% specially treated because of speed. (The space -% after |9| is neccessary.) +% \subsection{Methods} +% +% The names of method macros start with \cs{AlPh@Method}. +% These macros do the main job in converting a number to +% its representation. +% A method command is called with three arguments. +% The first argument is the number of symbols. The +% second argument is the basic macro for converting +% a number with limited number range. The last parameter +% is the number that needs converting. +% +% \subsubsection{Common methods} +% +% \begin{macro}{\AlPh@CheckPositive} +% \noindent +% |#1|: number to be checked +% |#2|: continuation macro\\ +% |#3|: number of symbols (hidden here)\\ +% |#4|: symbol provider (hidden here) % \begin{macrocode} -% \aa@inc adds one to its argument #1. - \def\aa@inc#1{% - \ifnum#1<9 % - \aa@nextdigit{#1}% - \else - \aa@reverse#1!!% - \fi - }% +\def\AlPh@CheckPositive#1!#2{% + \ifnum#1<1 % + \expandafter\@gobblefour + \fi + #2{#1}% +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@nextdigit} -% \cmd{\aa@nextdigit} increments the digit |#1|. The result -% is a digit again. \cmd{\aa@addone} works off the case ``9+1''. +% +% \subsubsection{Method `alph'} +% +% \begin{macro}{\AlPh@Method@alph} +% \noindent +% |#1|: number of symbols\\ +% |#2|: symbols provider\\ +% |#3|: number to be converted % \begin{macrocode} - \def\aa@nextdigit#1{\ifcase#1 1\or2\or3\or4\or5\or6\or7\or8\or9\fi}% +\def\AlPh@Method@alph#1#2#3{% + \expandafter\AlPh@CheckPositive +| \number#3!% ++ \the\numexpr#3!% + \AlPh@ProcessAlph + {#1}{#2}% +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@reverse} -% Because the addition starts with the lowest significant digit -% of the number. But with the means of \TeX's macro expansion is -% the first digit of a number available. So \cmd{\aa@reverse} -% reverses the order of the digits and calls \cmd{\aa@addone}, -% if it is ready. +% \begin{macro}{\AlPh@ProcessAlph} +% |#1|: current number\\ +% |#2|: number of symbols\\ +% |#3|: symbols provider % \begin{macrocode} - \def\aa@reverse#1#2!#3!{% - \ifx\\#2\\% - \aa@addone#1#3!!% - \else - \@ReturnAfterFi{% - \aa@reverse#2!#1#3!% - }% - \fi - }% +\def\AlPh@ProcessAlph#1#2#3{% + \ifnum#1>#2 % + \@ReturnAfterElseFi{% + \expandafter\AlPh@StepAlph\number + \intcalcInc{% + \intcalcMod{\intcalcDec{#1}}{#2}% + }% + \expandafter!\number + \intcalcDiv{\intcalcDec{#1}}{#2}% + !{#2}{#3}% + }% + \else + \@ReturnAfterFi{% + #3{#1}% + }% + \fi +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@addone} -% The addition is performed by the macro \cmd{\aa@addone}. -% The digits are in reversed order. The parameter text |#1#2| -% separates the next digit |#1| that have to be incremented. -% Already incremented digits are stored in |#3| in reversed order -% to take some work of \cmd{\aa@lastreverse}. +% \begin{macro}{\AlPh@StepAlph} +% |#1|: current last digit\\ +% |#2|: new current number\\ +% |#3|: number of symbols\\ +% |#4|: symbols provider % \begin{macrocode} - \def\aa@addone#1#2!#3!{% - \ifnum#1<9 % - \expandafter\aa@lastreverse\number\aa@nextdigit#1 #2!#3!% - \else - \@ReturnAfterFi{% - \ifx\\#2\\% - 10#3% - \else - \@ReturnAfterFi{% - \aa@addone#2!0#3!% - }% - \fi - }% - \fi - }% +\def\AlPh@StepAlph#1!#2!#3#4{% + \AlPh@ProcessAlph{#2}{#3}{#4}% + #4{#1}% +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@lastreverse} -% With \cmd{\aa@reverse} the order of the digits is changed to -% perform the addition in \cmd{\aa@addone}. Now we have to return -% to the original order that is done by \cmd{\aa@lastreverse}. +% +% \subsubsection{Method `wrap'} +% +% \begin{macro}{\AlPh@Method@wrap} +% \noindent +% |#1|: number of symbols\\ +% |#2|: symbols provider\\ +% |#3|: number to be converted % \begin{macrocode} - \def\aa@lastreverse#1#2!#3!{% - \ifx\\#2\\% - #1#3% - \else - \@ReturnAfterFi{% - \aa@lastreverse#2!#1#3!% - }% - \fi - }% +\def\AlPh@Method@wrap#1#2#3{% + \expandafter\AlPh@CheckPositive +| \number#3!% ++ \the\numexpr#3!% + \AlPh@ProcessWrap + {#1}{#2}% +} % \end{macrocode} % \end{macro} % -% \paragraph{Increment of the decimal digit result form.} -% \begin{macro}{\aa@alphinc} -% \cmd{\aa@alphinc} adds one to the intermediate number in -% the decimal digit result form (see \ref{sec:form}). -% Parameter |#1| consists of the tokens that come before the -% addition result (see |;#2;| of \cmd{\aa@process}). Then -% it is also used to store already incremented digits. -% |#2| contains the next digit in the range of 1 until 26. -% An empty |#2| marks the end of the number. +% \begin{macro}{\AlPh@ProcessWrap} +% |#1|: number to be converted\\ +% |#2|: number of symbols\\ +% |#3|: symbols provider % \begin{macrocode} - \def\aa@alphinc#1#2.{% - \ifx\\#2\\% - \@ReturnAfterElseFi{% - #11..% ready - }% - \else - \@ReturnAfterFi{% - \ifnum#2<26 % - \@ReturnAfterElseFi{% - \expandafter\aa@alphinclast\expandafter - {\number\aa@inc{#2}}{#1}% - }% - \else - \@ReturnAfterFi{% - \aa@alphinc{#11.}% - }% - \fi - }% - \fi - }% +\def\AlPh@ProcessWrap#1#2#3{% + \ifnum#1>#2 % + \@ReturnAfterElseFi{% + \expandafter\AlPh@StepWrap\number + \intcalcInc{\intcalcMod{\intcalcDec{#1}}{#2}}% + !{#3}% + }% + \else + \@ReturnAfterFi{% + #3{#1}% + }% + \fi +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@alphinclast} -% \cmd{\aa@alphinclast} is a help macro. Because |#2| consists of -% several tokens (e.g. |;100;|), we cannot jump over it via -% \cmd{\expandafter} in \cmd{\aa@alphinc}. +% \begin{macro}{\AlPh@StepWrap} +% |#1|: final number\\ +% |#2|: symbols provider % \begin{macrocode} - \def\aa@alphinclast#1#2{#2#1.}% +\def\AlPh@StepWrap#1!#2{% + #2{#1}% +} % \end{macrocode} % \end{macro} % -% \begin{macro}{\newalphalph} +% \subsubsection{Method `mult'} +% +% After the number of symbols is exhausted, +% repetitions of the symbol are used. +% \begin{gather*} +% x \Def \text{number to be converted}\\ +% n \Def \text{number of symbols}\\ +% r \Def \text{repetition length}\\ +% s \Def \text{symbol slot}\\ +% r = ((x - 1) \div n) + 1\\ +% s = ((x - 1) \mod n) + 1 +% \end{gather*} +% \begin{macro}{\AlPh@Method@mult} +% \noindent +% |#1|: number of symbols\\ +% |#2|: symbols provider\\ +% |#3|: number to be converted % \begin{macrocode} - \newcommand*{\newalphalph}[3]{% - \PackageError{alphalph}{% - \string\newalphalph\space requires e-TeX% - }\@ehc +\def\AlPh@Method@mult#1#2#3{% + \expandafter\AlPh@CheckPositive +| \number#3!% ++ \the\numexpr#3!% + \AlPh@ProcessMult + {#1}{#2}% +} % \end{macrocode} % \end{macro} % -% \subsection{\texorpdfstring{Conversion with \eTeX\ features}{\eTeX}} -% \label{sec:etex} +% \begin{macro}{\AlPh@ProcessMult} +% |#1|: number to be converted\\ +% |#2|: number of symbols\\ +% |#3|: symbols provider % \begin{macrocode} -\else -% \end{macrocode} -% -% \begin{macro}{\aa@make} -% \cmd{\aa@make} catches the cases, if the number is zero or negative. -% Then it expands to nothing like \cmd{\romannumeral}. -% \begin{macrocode} - \def\aa@make#1#2{% - \ifnum#1<1 % - \else - \@ReturnAfterFi{% - \aa@eprocess#1;#2% - }% - \fi - }% +\def\AlPh@ProcessMult#1#2#3{% + \ifnum#1>#2 % + \@ReturnAfterElseFi{% + \expandafter\AlPh@StepMult\romannumeral + \intcalcInc{\intcalcDiv{\intcalcDec{#1}}{#2}}% + 000% + \expandafter!\number + \intcalcInc{\intcalcMod{\intcalcDec{#1}}{#2}}% + !{#3}% + }% + \else + \@ReturnAfterFi{% + #3{#1}% + }% + \fi +} % \end{macrocode} % \end{macro} -% -% \begin{macro}{\aa@eprocess} -% The first argument |#1| contains the number that have to be -% converted yet, the next argument |#2| the command for making -% the conversion of a digit (\cmd{\aa@alph} or \cmd{\aa@Alph}). -% The number is divided by 26 to get the rest. Command -% |#2| converts the rest to a letter that is put after the arguments -% of the next call of \cmd{\aa@eprocess}. -% -% The only feature of \eTeX\ we use the new primitive \cmd{\numexpr}. -% It provides expandible mathematical calculations. +% \begin{macro}{\AlPh@StepMult} +% |#1#2|: repetitions coded as list of character `m'\\ +% |#3|: symbol slot\\ +% |#4|: symbols provider % \begin{macrocode} - \def\aa@eprocess#1;#2{% - \ifnum#1<27 % - \@ReturnAfterElseFi{% - #2{#1}% - }% - \else - \@ReturnAfterFi{% - \expandafter\aa@eprocess\number\numexpr(#1-14)/26% - \expandafter\expandafter\expandafter;% - \expandafter\expandafter\expandafter#2% - #2{\numexpr#1-((#1-14)/26)*26}% - }% - \fi - }% +\def\AlPh@StepMult#1#2!#3!#4{% + \ifx\\#2\\% + \else + \@ReturnAfterFi{% + \AlPh@StepMult#2!#3!{#4}% + }% + \fi + #4{#3}% +} % \end{macrocode} % \end{macro} % -% \subsection{Generic version} +% \subsection{User interface} % -% \begin{macro}{\aa@gen@callmake} -% See macro \cs{aa@callmake}. Argument |#3| holds the -% number of available symbols. +% \begin{macro}{\newalphalph} +% Macro \cs{newalphalph} had three arguments in versions below 2.0. +% For the new method argument we use an optional argument an first +% position.\\ +% |#1|: cmd\\ +% |[#2]|: method name: |alph| (default), |wrap|, |mult|\\ % hash-ok +% |#3|: symbols provider\\ +% |#4|: number of symbols % \begin{macrocode} - \def\aa@gen@callmake#1#2#3{% - \expandafter\aa@gen@make\expandafter{\number#3}#1{#2}% +\AlPh@IfDefinable\newalphalph{% + \def\newalphalph#1{% + \AlPh@IfOptArg{% + \AlPh@newalphalph{#1}% + }{% + \AlPh@newalphalph{#1}[alph]% + }% }% +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@gen@make} -% See macro \cs{aa@make}. Argument |#3| holds the number of -% available symbols. +% \begin{macro}{\AlPh@newalphalph} +% |#1|: cmd +% |#2|: method name\\ +% |#3|: symbols provider\\ +% |#4|: number of symbols % \begin{macrocode} - \def\aa@gen@make#1#2#3{% - \ifnum#1<1 % +\def\AlPh@newalphalph#1[#2]#3#4{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname AlPh@Method@#2\endcsname\relax + \AlPh@Error{% + Unknown method % +| `#2'% ++ `\detokenize{#2}'% + }% + \else + \ifx\\#4\\% + \AlPh@GetNumberOfSymbols{#3}% + \ifcase\AlPh@Number + \else + \begingroup + \escapechar=92 % backslash + \@PackageInfo{alphalph}{% + Number of symbols for \string#1 is \AlPh@Number + }% + \endgroup + \expandafter\AlPh@NewAlphAlph + \csname AlPh@Method@#2\expandafter\endcsname + \AlPh@Number!{#1}{#3}% + \fi \else - \@ReturnAfterFi{% - \aa@gen@eprocess{#3}#1;#2% - }% + \expandafter\AlPh@NewAlphAlph + \csname AlPh@Method@#2\expandafter\endcsname +| \number#4!% ++ \the\numexpr#4!% + {#1}{#3}% \fi - }% + \fi +}% % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@gen@eprocess} -% See macro \cs{aa@eprocess}. Argument |#1| holds the number of -% available symbols. +% \begin{macro}{\AlPh@NewAlphAlph} +% |#1|: method macro\\ +% |#2|: number of symbols\\ +% |#3|: cmd\\ +% |#4|: symbols provider % \begin{macrocode} - \def\aa@gen@eprocess#1#2;#3{% - \ifnum#2>#1 % - \@ReturnAfterElseFi{% - \expandafter\aa@gen@eprocess\expandafter{% - \number#1\expandafter - }% - \number\numexpr(#2-(\aa@half{#1}+1))/#1% - \expandafter\expandafter\expandafter;% - \expandafter\expandafter\expandafter#3% - #3{\numexpr#2-((#2-(\aa@half{#1}+1))/#1)*#1\relax}% - }% +\def\AlPh@NewAlphAlph#1#2!#3#4{% + \AlPh@IfDefinable#3{% + \ifnum#2>0 % + \def#3{#1{#2}{#4}}% \else - \@ReturnAfterFi{% - #3{#2}% - }% + \AlPh@Error{% + Definition of \string#3 failed,\MessageBreak + because number of symbols (#2) is not positive% + }% \fi }% +} % \end{macrocode} % \end{macro} -% \begin{macro}{\aa@half} -% Macro \cs{aa@half} implements integer division by two -% without rounding. +% +% \begin{macro}{\AlphAlph} % \begin{macrocode} - \def\aa@half#1{% - \number\dimexpr.5\dimexpr #1sp\relax\relax - }% +\newalphalph\AlphAlph\alphalph@Alph{26} % \end{macrocode} % \end{macro} -% \begin{macro}{\newalphalph} -% New macros are defined by \cs{newalphalph} that act like -% \cs{alphalph}. The macro to be defined is |#1|. Argument |#2| -% contains the macro that converts a number to a symbol and -% argument |#3| holds the number of available symbols. +% \begin{macro}{\alphalph} % \begin{macrocode} - \newcommand*{\newalphalph}[3]{% - \newcommand*{#1}{}% - \edef#1{% - \noexpand\aa@gen@callmake\noexpand#2{\number\numexpr#3}% - }% - }% +\newalphalph\alphalph\alphalph@alph{26} % \end{macrocode} % \end{macro} % -% \subsection{End\texorpdfstring{ of package}{}} -% Now we can terminate the differentiation between \TeX\ and \eTeX. % \begin{macrocode} -\fi +\AlPh@AtEnd +%</package> % \end{macrocode} % -% At the end the catcode of the character |@| is restored. +% \section{Test} +% +% \subsection{Catcode checks for loading} +% % \begin{macrocode} -\catcode`\@=\aa@atcode +%<*test1> % \end{macrocode} % \begin{macrocode} -%</package> +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input alphalph.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> % \end{macrocode} +% +% \section{Macro tests} +% +% \begin{macrocode} +%<*test2> +\NeedsTeXFormat{LaTeX2e} +\nofiles +\documentclass{article} +%<*noetex> +\makeatletter +\let\saved@numexpr\numexpr +\newcommand*{\DisableNumexpr}{% + \let\numexpr\@undefined +} +\newcommand*{\RestoreNumexpr}{% + \let\numexpr\saved@numexpr +} +\DisableNumexpr +%</noetex> +\usepackage{alphalph}[2007/04/11] +%<noetex>\RestoreNumexpr +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} + +\newcommand*{\TestCmd}[3]{% + \setbox0=\hbox{% +%<noetex> \DisableNumexpr + \edef\TestString{#1{#2}}% + \expandafter\Expect\expandafter{\TestString}{#3}% + \edef\TestString{#1{#2} }% + \expandafter\Expect\expandafter{\TestString}{#3 }% + }% + \Expect*{\the\wd0}{0.0pt}% +} + +\makeatletter +\newalphalph\LaTeXAlphAlph\@Alph{26} +\newalphalph\LaTeXalphalph\@alph{26} +\newalphalph\AlphWrap[wrap]\alphalph@Alph{26} +\newalphalph\alphwrap[wrap]\alphalph@alph{26} +\newalphalph\LaTeXAlphWrap[wrap]\@Alph{26} +\newalphalph\LaTeXalphwrap[wrap]\@alph{26} +\def\LastSymbol#1{% + \ifx\\#1\\% + \else + \@LastSymbol#1\@nil + \fi +} +\def\@LastSymbol#1#2\@nil{% + \ifx\\#2\\% + #1% + \else + \@LastSymbol#2\@nil + \fi +} +\makeatother +\newcommand*{\TestAlph}[2]{% + \uppercase{\TestCallCmd\AlphAlph{#2}}{#1}% + \lowercase{\TestCallCmd\alphalph{#2}}{#1}% + \uppercase{\TestCallCmd\LaTeXAlphAlph{#2}}{#1}% + \lowercase{\TestCallCmd\LaTeXalphalph{#2}}{#1}% + \edef\WrapString{\LastSymbol{#2}}% + \expandafter\TestAlphWrap\expandafter{\WrapString}{#1}% +} +\newcommand*{\TestAlphWrap}[2]{% + \uppercase{\TestCallCmd\AlphWrap{#1}}{#2}% + \lowercase{\TestCallCmd\alphwrap{#1}}{#2}% + \uppercase{\TestCallCmd\LaTeXAlphWrap{#1}}{#2}% + \lowercase{\TestCallCmd\LaTeXalphwrap{#1}}{#2}% +} +\newcommand*{\TestCallCmd}[3]{% + \TestCmd#1{#3}{#2}% +} +\begin{qstest}{AlphSymbols}{alphalph, AlphAlph, symbols} + \TestAlph{1}{a}% + \TestAlph{2}{b}% + \TestAlph{3}{c}% + \TestAlph{4}{d}% + \TestAlph{5}{e}% + \TestAlph{6}{f}% + \TestAlph{7}{g}% + \TestAlph{8}{h}% + \TestAlph{9}{i}% + \TestAlph{10}{j}% + \TestAlph{11}{k}% + \TestAlph{12}{l}% + \TestAlph{13}{m}% + \TestAlph{14}{n}% + \TestAlph{15}{o}% + \TestAlph{16}{p}% + \TestAlph{17}{q}% + \TestAlph{18}{r}% + \TestAlph{19}{s}% + \TestAlph{20}{t}% + \TestAlph{21}{u}% + \TestAlph{22}{v}% + \TestAlph{23}{w}% + \TestAlph{24}{x}% + \TestAlph{25}{y}% + \TestAlph{26}{z}% +\end{qstest} +\begin{qstest}{AlphRange}{alphalph, range} + \TestAlph{0}{}% + \TestAlph{-1}{}% + \TestAlph{-2147483647}{}% + \TestAlph{27}{aa}% + \TestAlph{28}{ab}% + \TestAlph{52}{az}% + \TestAlph{53}{ba}% + \TestAlph{78}{bz}% + \TestAlph{79}{ca}% + \TestAlph{702}{zz}% + \TestAlph{703}{aaa}% + \TestAlph{2147483647}{fxshrxw}% +\end{qstest} + +\makeatletter +\newcommand*{\myvocals}[1]{% + \ifcase#1X\or A\or E\or I\or O\or U\else Y\fi +} +\makeatother +\newalphalph\vocalsvocals\myvocals{5} +\newcommand*{\TestVocals}{% + \TestCmd\vocalsvocals +} +\begin{qstest}{vocals}{vocals} + \TestVocals{0}{}% + \TestVocals{1}{A}% + \TestVocals{2}{E}% + \TestVocals{3}{I}% + \TestVocals{4}{O}% + \TestVocals{5}{U}% + \TestVocals{6}{AA}% + \TestVocals{7}{AE}% + \TestVocals{8}{AI}% + \TestVocals{9}{AO}% + \TestVocals{10}{AU}% + \TestVocals{11}{EA}% + \TestVocals{24}{OO}% + \TestVocals{25}{OU}% + \TestVocals{26}{UA}% + \TestVocals{29}{UO}% + \TestVocals{30}{UU}% + \TestVocals{31}{AAA}% + \TestVocals{155}{UUU}% + \TestVocals{156}{AAAA}% + \TestVocals{2147483647}{AIIOOEEIOIIUOE}% +\end{qstest} + +\makeatletter +\newalphalph\AlphMult[mult]{\alphalph@Alph}{26} +\newalphalph\alphmult[mult]{\alphalph@alph}{26} +\newalphalph\LaTeXAlphMult[mult]{\@Alph}{26} +\newalphalph\LaTeXalphmult[mult]{\@alph}{26} +\makeatother +\newcommand*{\TestMult}[2]{% + \uppercase{\TestCallCmd\AlphMult{#2}}{#1}% + \lowercase{\TestCallCmd\alphmult{#2}}{#1}% + \uppercase{\TestCallCmd\LaTeXAlphMult{#2}}{#1}% + \lowercase{\TestCallCmd\LaTeXalphmult{#2}}{#1}% +} +\begin{qstest}{mult}{mult} + \TestMult{0}{}% + \TestMult{-1}{}% + \TestMult{-2147483647}{}% + \TestMult{1}{a}% + \TestMult{2}{b}% + \TestMult{26}{z}% + \TestMult{27}{aa}% + \TestMult{28}{bb}% + \TestMult{52}{zz}% + \TestMult{53}{aaa}% + \TestMult{54}{bbb}% + \TestMult{259}{yyyyyyyyyy}% + \TestMult{260}{zzzzzzzzzz}% + \TestMult{261}{aaaaaaaaaaa}% + \TestMult{262}{bbbbbbbbbbb}% +\end{qstest} + +\def\myvocalsB#1{% + \ifcase#1\or A\or E\or I\or O\or U\fi +} +\begin{qstest}{symbolnum}{symbolnum} + \makeatletter + \def\Test#1#2{% + \let\TestCmd\relax + \newalphalph\TestCmd{#1}{}% + \Expect*{\AlPh@Number}{#2}% + }% + \Test\@alph{26}% + \Test\@Alph{26}% + \Test\@fnsymbol{9}% + \Test\myvocalsB{5}% + \Test\alphalph@alph{26}% + \Test\alphalph@Alph{26}% +\end{qstest} + +\begin{qstest}{list}{list} + \makeatletter + \def\catch#1\relax{% + \def\FoundList{\catch#1}% + }% + \def\Test[#1]#2#3#4{% + \let\testcmd\relax + \newalphalph\testcmd[{#1}]{\catch}{#2}% + \testcmd{#3}|\relax + \expandafter\Expect\expandafter{\FoundList}{#4|}% + % + \let\SavedCatch\catch + \def\catch{\noexpand\catch\noexpand\foo}% + \edef\Result{#4|}% + \@onelevel@sanitize\Result + \let\catch\SavedCatch + \let\testcmd\relax + \newalphalph\testcmd[{#1}]{\catch\foo}{#2}% + \testcmd{#3}|\relax + \@onelevel@sanitize\FoundList + \Expect*{\FoundList}*{\Result}% + }% + \Test[alph]{26}{3}{\catch{3}}% + \Test[alph]{26}{12}{\catch{12}}% + \Test[alph]{26}{27}{\catch{1}\catch{1}}% + \Test[alph]{26}{78}{\catch{2}\catch{26}}% + \Test[wrap]{26}{7}{\catch{7}}% + \Test[wrap]{26}{14}{\catch{14}}% + \Test[wrap]{26}{80}{\catch{2}}% + \Test[wrap]{26}{700}{\catch{24}}% + \Test[mult]{26}{4}{\catch{4}}% + \Test[mult]{26}{17}{\catch{17}}% + \Test[mult]{26}{54}{\catch{2}\catch{2}\catch{2}}% +\end{qstest} + +\begin{document} +\end{document} +%</test2> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -862,6 +1586,9 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % alphalph.sty & tex/generic/oberdiek/alphalph.sty\\ % alphalph.pdf & doc/latex/oberdiek/alphalph.pdf\\ +% alphalph-test1.tex & doc/latex/oberdiek/alphalph-test1.tex\\ +% alphalph-test2.tex & doc/latex/oberdiek/alphalph-test2.tex\\ +% alphalph-test3.tex & doc/latex/oberdiek/alphalph-test3.tex\\ % alphalph.dtx & source/latex/oberdiek/alphalph.dtx\\ % \end{tabular}^^A % }^^A @@ -1034,6 +1761,15 @@ and the derived files % \item % Line ends sanitized. % \end{Version} +% \begin{Version}{2007/09/09 v2.0} +% \item +% New implementation that uses package \cs{intcalc}. +% This removes the dependency on \eTeX. +% \item +% \cs{newalphalph} is extended to support new methods `wrap' and 'multi'. +% \item +% Documentation rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx b/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx index aff5a5fb9bf..8709755cd7f 100644 --- a/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx @@ -18,7 +18,7 @@ % and the derived files % atbegshi.sty, atbegshi.pdf, atbegshi.ins, atbegshi.drv, % atbegshi-example.tex, atbegshi-test1.tex, -% atbegshi-test2.tex. +% atbegshi-test2.tex, atbegshi-test3.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/atbegshi.dtx @@ -56,6 +56,7 @@ % TDS:doc/latex/oberdiek/atbegshi-example.tex % TDS:doc/latex/oberdiek/atbegshi-test1.tex % TDS:doc/latex/oberdiek/atbegshi-test2.tex +% TDS:doc/latex/oberdiek/atbegshi-test3.tex % TDS:source/latex/oberdiek/atbegshi.dtx % %<*ignore> @@ -71,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: atbegshi 2007/06/06 v1.5 At begin shipout hook (HO)} +\Msg{* Package: atbegshi 2007/09/09 v1.6 At begin shipout hook (HO)} \Msg{************************************************************************} \keepsilent @@ -99,7 +100,7 @@ This work consists of the main source file atbegshi.dtx and the derived files atbegshi.sty, atbegshi.pdf, atbegshi.ins, atbegshi.drv, atbegshi-example.tex, atbegshi-test1.tex, - atbegshi-test2.tex. + atbegshi-test2.tex, atbegshi-test3.tex. \endpreamble @@ -112,6 +113,7 @@ and the derived files \file{atbegshi-example.tex}{\from{atbegshi.dtx}{example}}% \file{atbegshi-test1.tex}{\from{atbegshi.dtx}{test1}}% \file{atbegshi-test2.tex}{\from{atbegshi.dtx}{test2}}% + \file{atbegshi-test3.tex}{\from{atbegshi.dtx}{test3}}% } \obeyspaces @@ -137,7 +139,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{atbegshi.drv}% - [2007/06/06 v1.5 At begin shipout hook (HO)]% + [2007/09/09 v1.6 At begin shipout hook (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -146,7 +148,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{1239} +% \CheckSum{1283} % % \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 @@ -167,7 +169,7 @@ and the derived files % \GetFileInfo{atbegshi.drv} % % \title{The \xpackage{atbegshi} package} -% \date{2007/06/06 v1.5} +% \date{2007/09/09 v1.6} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -787,35 +789,33 @@ The last page. \fi \expandafter\x\csname ver@atbegshi.sty\endcsname \ProvidesPackage{atbegshi}% - [2007/06/06 v1.5 At begin shipout hook (HO)] + [2007/09/09 v1.6 At begin shipout hook (HO)] % \end{macrocode} % % \subsection{Catcodes} % % \begin{macrocode} -\expandafter\edef\csname AtBegShi@End\endcsname{% - \catcode40 \the\catcode40\relax % ( - \catcode41 \the\catcode41\relax % ) - \catcode44 \the\catcode44\relax % , - \catcode45 \the\catcode45\relax % - - \catcode46 \the\catcode46\relax % . - \catcode58 \the\catcode58\relax % : - \catcode61 \the\catcode61\relax % = - \catcode64 \the\catcode64\relax % @ - \catcode94 \the\catcode94\relax % ^ - \catcode96 \the\catcode96\relax % ` - \noexpand\endinput +\expandafter\edef\csname AtBegShi@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode40 12 % ( -\catcode41 12 % ) -\catcode44 12 % , -\catcode45 12 % - -\catcode46 12 % . -\catcode58 12 % : -\catcode61 12 % = \catcode64 11 % @ -\catcode94 7 % ^ -\catcode96 12 % ` +\def\TMP@EnsureCode#1#2{% + \edef\AtBegShi@AtEnd{% + \AtBegShi@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{94}{7}% ^(superscript) +\TMP@EnsureCode{96}{12}% ` % \end{macrocode} % % \subsection{Preparations} @@ -825,7 +825,7 @@ The last page. \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi % \end{macrocode} % @@ -1180,7 +1180,8 @@ X \endgroup \def\AtBegShi@AbortIfUndefined#1{% \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname#1\endcsname\relax - \expandafter\AtBegShi@End + \AtBegShi@AtEnd + \expandafter\endinput \fi } \AtBegShi@AbortIfUndefined{currentgrouplevel} @@ -1461,20 +1462,72 @@ X \endgroup % \end{macrocode} % % \begin{macrocode} -\AtBegShi@End +\AtBegShi@AtEnd %</package> % \end{macrocode} % % \section{Test} % +% \subsection{Catcode checks for loading} +% % \begin{macrocode} %<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input atbegshi.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \begin{macrocode} +%<*test2> \input atbegshi.sty\relax \def\msg#{\immediate\write16} -\msg{File: atbegshi-test1.tex 2007/06/06 v1.5 Test file for plain-TeX} +\msg{File: atbegshi-test2.tex 2007/09/09 v1.6 Test file for plain-TeX} \def\testmsg#1#2{% \msg{}% - \msg{*** Test with box (#1), expected page output [#2]}% + \msg{*** Test with box (#1), expected page output [#2]}% hash-ok } \newbox\voidbox @@ -1562,13 +1615,13 @@ Hello World \shipout\null \end -%</test1> +%</test2> % \end{macrocode} % % \begin{macrocode} -%<*test2> +%<*test3> \NeedsTeXFormat{LaTeX2e} -\ProvidesFile{atbegshi-test2.tex}[2007/06/06 v1.5 Test file for LaTeX] +\ProvidesFile{atbegshi-test3.tex}[2007/09/09 v1.6 Test file for LaTeX] \RequirePackage{color} \pagecolor{yellow} \documentclass[a5paper,showtrims]{memoir} @@ -1614,8 +1667,9 @@ Hello World \shipout\box\csname voidb@x\endcsname \section{Hello World} \end{document} -%</test2> +%</test3> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -1680,6 +1734,7 @@ Hello World % atbegshi-example.tex & doc/latex/oberdiek/atbegshi-example.tex\\ % atbegshi-test1.tex & doc/latex/oberdiek/atbegshi-test1.tex\\ % atbegshi-test2.tex & doc/latex/oberdiek/atbegshi-test2.tex\\ +% atbegshi-test3.tex & doc/latex/oberdiek/atbegshi-test3.tex\\ % atbegshi.dtx & source/latex/oberdiek/atbegshi.dtx\\ % \end{tabular}^^A % }^^A @@ -1838,6 +1893,10 @@ Hello World % \item % Fix in second test file for newer version of \xclass{memoir}. % \end{Version} +% \begin{Version}{2007/09/09 v1.6} +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/atenddvi.dtx b/Master/texmf-dist/source/latex/oberdiek/atenddvi.dtx index 32095839d01..8c2455e655e 100644 --- a/Master/texmf-dist/source/latex/oberdiek/atenddvi.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/atenddvi.dtx @@ -358,6 +358,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/attachfile2.dtx b/Master/texmf-dist/source/latex/oberdiek/attachfile2.dtx index 4a3210d660c..4f52381c348 100644 --- a/Master/texmf-dist/source/latex/oberdiek/attachfile2.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/attachfile2.dtx @@ -1929,6 +1929,7 @@ __END__ %</pdfatfi> % \end{macrocode} % +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/auxhook.dtx b/Master/texmf-dist/source/latex/oberdiek/auxhook.dtx index b3f81c660f8..8aa39aca79e 100644 --- a/Master/texmf-dist/source/latex/oberdiek/auxhook.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/auxhook.dtx @@ -359,6 +359,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx b/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx index 6d385ef9db9..1531bd66606 100644 --- a/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx @@ -3643,6 +3643,7 @@ and the derived files %</test> % \end{macrocode} % +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx b/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx index 2bcc725a400..6fd099d53a5 100644 --- a/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx @@ -2195,6 +2195,7 @@ and the derived files \fi %</dvipdfm|vtex> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx b/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx index 58dfe9abef8..ca87b190bad 100644 --- a/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx @@ -17,7 +17,8 @@ % This work consists of the main source file catchfile.dtx % and the derived files % catchfile.sty, catchfile.pdf, catchfile.ins, catchfile.drv, -% catchfile-test1.tex, catchfile-test2.tex. +% catchfile-test1.tex, catchfile-test2.tex, +% catchfile-test3.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/catchfile.dtx @@ -54,6 +55,7 @@ % TDS:doc/latex/oberdiek/catchfile.pdf % TDS:doc/latex/oberdiek/catchfile-test1.tex % TDS:doc/latex/oberdiek/catchfile-test2.tex +% TDS:doc/latex/oberdiek/catchfile-test3.tex % TDS:source/latex/oberdiek/catchfile.dtx % %<*ignore> @@ -69,7 +71,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: catchfile 2007/05/30 v1.0 Catches the contents of a file (HO)} +\Msg{* Package: catchfile 2007/09/09 v1.1 Catches the contents of a file (HO)} \Msg{************************************************************************} \keepsilent @@ -96,7 +98,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file catchfile.dtx and the derived files catchfile.sty, catchfile.pdf, catchfile.ins, catchfile.drv, - catchfile-test1.tex, catchfile-test2.tex. + catchfile-test1.tex, catchfile-test2.tex, + catchfile-test3.tex. \endpreamble @@ -108,6 +111,7 @@ and the derived files \usedir{doc/latex/oberdiek}% \file{catchfile-test1.tex}{\from{catchfile.dtx}{test1}}% \file{catchfile-test2.tex}{\from{catchfile.dtx}{test2}}% + \file{catchfile-test3.tex}{\from{catchfile.dtx}{test3}}% } \obeyspaces @@ -133,7 +137,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{catchfile.drv}% - [2007/05/30 v1.0 Catches the contents of a file (HO)]% + [2007/09/09 v1.1 Catches the contents of a file (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -142,7 +146,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{419} +% \CheckSum{481} % % \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 @@ -163,7 +167,7 @@ and the derived files % \GetFileInfo{catchfile.drv} % % \title{The \xpackage{catchfile} package} -% \date{2007/05/30 v1.0} +% \date{2007/09/09 v1.1} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -258,27 +262,30 @@ and the derived files \fi \expandafter\x\csname ver@catchfile.sty\endcsname \ProvidesPackage{catchfile}% - [2007/05/30 v1.0 Catches the contents of a file (HO)] + [2007/09/09 v1.1 Catches the contents of a file (HO)] % \end{macrocode} % % \subsection{Catcodes} % % \begin{macrocode} -\expandafter\edef\csname CatchFile@End\endcsname{% - \catcode44 \the\catcode44\relax % , - \catcode45 \the\catcode45\relax % - - \catcode46 \the\catcode46\relax % . - \catcode61 \the\catcode61\relax % = - \catcode64 \the\catcode64\relax % @ - \catcode96 \the\catcode96\relax % ` - \noexpand\endinput +\expandafter\edef\csname CatchFile@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode44 12 % , -\catcode45 12 % - -\catcode46 12 % . -\catcode61 12 % = \catcode64 11 % @ -\catcode96 12 % ` +\def\TMP@EnsureCode#1#2{% + \edef\CatchFile@AtEnd{% + \CatchFile@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{96}{12}% ` % \end{macrocode} % % \subsection{Preparations} @@ -288,7 +295,7 @@ and the derived files \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi % \end{macrocode} % @@ -305,7 +312,8 @@ and the derived files package loading is aborted% }\@ehd \endgroup - \expandafter\CatchFile@End + \CatchFile@AtEnd + \expandafter\endinput \fi \endgroup % \end{macrocode} @@ -343,7 +351,8 @@ and the derived files package loading is aborted% }\@ehd \csname endgroup\endcsname - \CatchFile@End + \CatchFile@AtEnd + \endinput \endgroup % \end{macrocode} % \end{macro} @@ -471,21 +480,73 @@ and the derived files % \end{macro} % % \begin{macrocode} -\CatchFile@End +\CatchFile@AtEnd %</package> % \end{macrocode} % % \section{Test} % -% \subsection{\LaTeX} +% \subsection{Catcode checks for loading} % % \begin{macrocode} %<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input catchfile.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{\LaTeX} +% +% \begin{macrocode} +%<*test2> \NeedsTeXFormat{LaTeX2e} \nofiles \listfiles \documentclass{minimal} -\usepackage{catchfile}[2007/05/30] +\usepackage{catchfile}[2007/09/09] \makeatletter \def\mysetup{% \let\do\@makeother @@ -504,13 +565,13 @@ and the derived files } \typeout{\contents} \end{document} -%</test1> +%</test2> % \end{macrocode} % % \subsection{\plainTeX} % % \begin{macrocode} -%<*test2> +%<*test3> \def\msg#{\immediate\write16} \newlinechar=10 % \input catchfile.sty\relax @@ -534,8 +595,9 @@ and the derived files \csname @@end\endcsname \end -%</test2> +%</test3> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -599,6 +661,7 @@ and the derived files % catchfile.pdf & doc/latex/oberdiek/catchfile.pdf\\ % catchfile-test1.tex & doc/latex/oberdiek/catchfile-test1.tex\\ % catchfile-test2.tex & doc/latex/oberdiek/catchfile-test2.tex\\ +% catchfile-test3.tex & doc/latex/oberdiek/catchfile-test3.tex\\ % catchfile.dtx & source/latex/oberdiek/catchfile.dtx\\ % \end{tabular}^^A % }^^A @@ -724,6 +787,10 @@ and the derived files % \item % First version. % \end{Version} +% \begin{Version}{2007/09/09 v1.1} +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/centernot.dtx b/Master/texmf-dist/source/latex/oberdiek/centernot.dtx index 40c1f5354c5..d83553b6df3 100644 --- a/Master/texmf-dist/source/latex/oberdiek/centernot.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/centernot.dtx @@ -132,10 +132,10 @@ and the derived files \usepackage{centernot} \usepackage{amssymb} \DeclareFontFamily{U}{matha}{\hyphenchar\font45} -\DeclareFontShape{U}{matha}{m}{n}{ - <5> <6> <7> <8> <9> <10> gen * matha - <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12 - }{} +\DeclareFontShape{U}{matha}{m}{n}{% + <5> <6> <7> <8> <9> <10> gen * matha % + <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12 % +}{} \DeclareSymbolFont{matha}{U}{matha}{m}{n} \DeclareMathSymbol{\notdivides}{3}{matha}{"1F} \DeclareMathSymbol{\notrightarrow}{3}{matha}{"DB} @@ -295,6 +295,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/chemarr.dtx b/Master/texmf-dist/source/latex/oberdiek/chemarr.dtx index 5872185b439..5a598a4d72d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/chemarr.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/chemarr.dtx @@ -294,6 +294,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/classlist.dtx b/Master/texmf-dist/source/latex/oberdiek/classlist.dtx index b5a752a41f7..17fa2ef4ede 100644 --- a/Master/texmf-dist/source/latex/oberdiek/classlist.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/classlist.dtx @@ -383,6 +383,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/colonequals.dtx b/Master/texmf-dist/source/latex/oberdiek/colonequals.dtx index 4f9f5ff9233..fab1da60832 100644 --- a/Master/texmf-dist/source/latex/oberdiek/colonequals.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/colonequals.dtx @@ -407,6 +407,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/dvipscol.dtx b/Master/texmf-dist/source/latex/oberdiek/dvipscol.dtx index 82de766dd0f..3494cb322bd 100644 --- a/Master/texmf-dist/source/latex/oberdiek/dvipscol.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/dvipscol.dtx @@ -292,6 +292,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx index f0734245cb7..c2ce95e1f4a 100644 --- a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx @@ -17,7 +17,9 @@ % This work consists of the main source file embedfile.dtx % and the derived files % embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv, -% dtx-attach.sty, embedfile-example-plain.tex. +% dtx-attach.sty, embedfile-example-plain.tex, +% embedfile-test1.tex, embedfile-test2.tex, +% embedfile-test3.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/embedfile.dtx @@ -54,6 +56,9 @@ % TDS:tex/latex/oberdiek/dtx-attach.sty % TDS:doc/latex/oberdiek/embedfile.pdf % TDS:doc/latex/oberdiek/embedfile-example-plain.tex +% TDS:doc/latex/oberdiek/embedfile-test1.tex +% TDS:doc/latex/oberdiek/embedfile-test2.tex +% TDS:doc/latex/oberdiek/embedfile-test3.tex % TDS:source/latex/oberdiek/embedfile.dtx % %<*ignore> @@ -69,7 +74,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: embedfile 2007/04/11 v1.1 embed files into PDF (HO)} +\Msg{* Package: embedfile 2007/09/09 v1.2 embed files into PDF (HO)} \Msg{************************************************************************} \keepsilent @@ -96,7 +101,9 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file embedfile.dtx and the derived files embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv, - dtx-attach.sty, embedfile-example-plain.tex. + dtx-attach.sty, embedfile-example-plain.tex, + embedfile-test1.tex, embedfile-test2.tex, + embedfile-test3.tex. \endpreamble @@ -108,6 +115,9 @@ and the derived files \file{dtx-attach.sty}{\from{embedfile.dtx}{dtxattach}}% \usedir{doc/latex/oberdiek}% \file{embedfile-example-plain.tex}{\from{embedfile.dtx}{exampleplain}}% + \file{embedfile-test1.tex}{\from{embedfile.dtx}{test1}}% + \file{embedfile-test2.tex}{\from{embedfile.dtx}{test2}}% + \file{embedfile-test3.tex}{\from{embedfile.dtx}{test3}}% } \obeyspaces @@ -133,7 +143,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{embedfile.drv}% - [2007/04/11 v1.1 embed files into PDF (HO)]% + [2007/09/09 v1.2 embed files into PDF (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -142,7 +152,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{0} +% \CheckSum{637} % % \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 @@ -163,14 +173,14 @@ and the derived files % \GetFileInfo{embedfile.drv} % % \title{The \xpackage{embedfile} package} -% \date{2007/04/11 v1.1} +% \date{2007/09/09 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle % % \begin{abstract} % This package embeds files to a PDF document. -% Currently \pdfTeX\ >= 1.30 in PDF mode is supported only. +% Currently the only supported driver is \pdfTeX\ $>=$ 1.30 in PDF mode. % \end{abstract} % % \tableofcontents @@ -234,7 +244,7 @@ and the derived files % safely use \cs{embedfile} before \verb|\end{document}|. % Embedding files using \cs{AtEndDocument} will only work, % if \cs{AtEndDocument} is called before loading the package -% \xpackage{embedfile} +% \xpackage{embedfile}. % % The \meta{options} are give as key value pairs. The following % keys are supported: @@ -266,13 +276,22 @@ and the derived files % the use of \cs{pdfescapestring}. % \end{description} % +% \begin{declcs}{embedfilefinish} +% \end{declcs} +% The list of all embedded files must be added as data structure +% in the PDF file. In case of \LaTeX\ this is automatically done. +% The package uses \cs{AtEndDocument}. Then the list of all +% files should be known. However, \plainTeX\ does not know +% about \cs{AtEndDocument}. Thus the user must call +% \cs{embedfilefinish} at the end of the document +% after the last file is embedded. +% % \subsection{Examples} % % \subsubsection{\plainTeX}\label{sec:plain} % -% The package can be used with \plainTeX. Because is uses -% package \xpackage{keyval} and \cs{@ifnextchar}, it needs -% a little help from \xfile{miniltx.tex}. +% The package can be used with \plainTeX. It can be used +% with or without help from \xfile{miniltx.tex}. % % If additionally package \xpackage{keyval} (\xpackage{graphicx}) % is needed, load it first. Then package \xpackage{embedfile} avoids @@ -330,8 +349,8 @@ This example document contains three embedded files. %<*dtxattach> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{dtx-attach} - [2007/04/11 v1.1 Embed \string\jobname.dtx (HO)]% -\RequirePackage{embedfile}[2007/04/11] + [2007/09/09 v1.2 Embed \string\jobname.dtx (HO)]% +\RequirePackage{embedfile}[2007/09/09] \embedfile[% stringmethod=escape,% mimetype=plain/text,% @@ -407,71 +426,59 @@ This example document contains three embedded files. \fi \expandafter\x\csname ver@embedfile.sty\endcsname \ProvidesPackage{embedfile}% - [2007/04/11 v1.1 embed files into PDF (HO)] + [2007/09/09 v1.2 embed files into PDF (HO)] % \end{macrocode} % +% \subsection{Catcodes} +% % \begin{macrocode} -\edef\EmbedFileRestoreCatcodes{% - \catcode39 \the\catcode39 % ' - \catcode40 \the\catcode40 % ( - \catcode41 \the\catcode41 % ) - \catcode47 \the\catcode47 % / - \catcode60 \the\catcode60 % < - \catcode62 \the\catcode62 % > - \catcode64 \the\catcode64 % @ - \catcode91 \the\catcode91 % [ - \catcode93 \the\catcode93 % ] - \catcode96 \the\catcode96 % ` +\expandafter\edef\csname EmbedFile@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode39 12 % ' -\catcode40 12 % ( -\catcode41 12 % ) -\catcode47 12 % / -\catcode60 12 % < -\catcode62 12 % > \catcode64 11 % @ -\catcode91 12 % [ -\catcode93 12 % ] -\catcode96 12 % ` +\def\TMP@EnsureCode#1#2{% + \edef\EmbedFile@AtEnd{% + \EmbedFile@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{91}{12}% [ +\TMP@EnsureCode{93}{12}% ] +\TMP@EnsureCode{96}{12}% ` % \end{macrocode} % % \subsection{Tools} % -% \begin{macro}{\EmbedFile@PackageError} +% \begin{macro}{\EmbedFile@RequirePackage} % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname PackageError\endcsname\relax - \def\EmbedFile@PackageError#1#2{% - \errhelp{#2}% - \errmessage{Package embedfile Error: #1.}% +\expandafter\ifx\csname RequirePackage\endcsname\relax + \def\EmbedFile@RequirePackage#1[#2]{% + \input #1.sty\relax }% \else - \def\EmbedFile@PackageError#1#2{% - \begingroup - \let\on@line\empty - \PackageError{embedfile}{#1}{#2}% - \endgroup - }% + \let\EmbedFile@RequirePackage\RequirePackage \fi % \end{macrocode} % \end{macro} % -% \begin{macro}{\EmbedFile@RequirePackage} +% \begin{macro}{\EmbedFile@PackageError} % \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname RequirePackage\endcsname\relax - \def\EmbedFile@RequirePackage#1#2{% - \expandafter\ifx\csname #2\encsname\relax - \input #1.sty\relax - \fi - }% -\else - \def\EmbedFile@RequirePackage#1#2{% - \expandafter\ifx\csname #2\endcsname\relax - \RequirePackage{#1}% - \fi - }% -\fi +\EmbedFile@RequirePackage{infwarerr}[2007/09/09]% +\def\EmbedFile@PackageError{% + \@PackageError{embedfile}% +} % \end{macrocode} % \end{macro} % @@ -479,15 +486,16 @@ This example document contains three embedded files. % % Load package \xpackage{ifpdf} and check mode. % \begin{macrocode} -\EmbedFile@RequirePackage{ifpdf}{ifpdf} +\EmbedFile@RequirePackage{ifpdf}[2007/09/09] \ifpdf \else \EmbedFile@PackageError{% Missing pdfTeX in PDF mode% }{% - Currently other drivers are not supported. Package loading is aborted.% + Currently other drivers are not supported. % + Package loading is aborted.% }% - \EmbedFileRestoreCatcodes + \EmbedFile@AtEnd \expandafter\endinput \fi % \end{macrocode} @@ -500,7 +508,7 @@ This example document contains three embedded files. }{% At least version 1.30 is necessary. Package loading is aborted.% }% - \EmbedFileRestoreCatcodes + \EmbedFile@AtEnd \expandafter\endinput \fi % \end{macrocode} @@ -508,7 +516,100 @@ This example document contains three embedded files. % \subsection{Key value definitions} % % \begin{macrocode} -\EmbedFile@RequirePackage{keyval}{define@key} +\expandafter\ifx\csname define@key\endcsname\relax + \chardef\EmbedFile@plain=\z@ + \def\EmbedFile@temp#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + \chardef\EmbedFile@plain=\@ne + \fi + }% + \EmbedFile@temp{NeedsTeXFormat}% + \EmbedFile@temp{ProvidesPackage}% + \EmbedFile@temp{DeclareOption}% + \EmbedFile@temp{ExecuteOptions}% + \EmbedFile@temp{ProcessOptions}% + \ifnum\EmbedFile@plain=\@ne + \def\EmbedFile@temp#1{% + \expandafter\let\csname EmbedFile@Org#1\expandafter\endcsname + \csname#1\endcsname + \expandafter\def\csname#1\endcsname + }% + \EmbedFile@temp{NeedsTeXFormat}#1{}% + \EmbedFile@temp{ProvidesPackage}#1[#2]{}% hash-ok + \EmbedFile@temp{DeclareOption}#1{}% + \EmbedFile@temp{ExecuteOptions}#1{}% + \EmbedFile@temp{ProcessOptions}{}% +% \end{macrocode} +% \begin{macro}{\KV@errx} +% \LaTeX's option processing is not available with +% \plainTeX. Thus we define the default error +% command \cs{KV@errx} here, also using package +% \xpackage{infwarerr}'s \cs{@PackageError}. +% \begin{macrocode} + \def\KV@errx#1{% + \@PackageError{keyval}{#1}\@ehc + }% +% \end{macrocode} +% \end{macro} +% Other macros from \LaTeX's kernel that are used by +% package \xpackage{keyval}. +% \begin{macro}{\@ifnextchar} +% \begin{macrocode} + \expandafter\ifx\csname @ifnextchar\endcsname\relax + \def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch + }% + \def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c + }% + \begingroup + \def\:{\global\let\@sptoken= }% + \: % this makes \@sptoken a space token + \def\:{\@xifnch}% + \expandafter\gdef\: {% + \futurelet\@let@token\@ifnch + }% + \endgroup + \fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@namedef} +% \begin{macrocode} + \expandafter\ifx\csname @namedef\endcsname\relax + \def\@namedef#1{% + \expandafter\def\csname#1\endcsname + }% + \fi +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \fi + \EmbedFile@RequirePackage{keyval}[1999/03/16]% + \ifnum\EmbedFile@plain=\@ne + \def\EmbedFile@temp#1{% + \expandafter\let\csname#1\expandafter\endcsname + \csname EmbedFile@Org#1\endcsname + }% + \EmbedFile@temp{NeedsTeXFormat}% + \EmbedFile@temp{ProvidesPackage}% + \EmbedFile@temp{DeclareOption}% + \EmbedFile@temp{ExecuteOptions}% + \EmbedFile@temp{ProcessOptions}% + \fi +\fi % \end{macrocode} % % \begin{macrocode} @@ -732,9 +833,94 @@ This example document contains three embedded files. % \end{macrocode} % % \begin{macrocode} -\EmbedFileRestoreCatcodes +\EmbedFile@AtEnd %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input embedfile.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Simple test} +% +% \begin{macrocode} +%<*test2> +\input embedfile.sty\relax +\embedfile[% + stringmethod=escape,% + mimetype=plain/text,% + desc={LaTeX docstrip source archive for package `embedfile'}% +]{embedfile.dtx} +\nopagenumbers +Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.% +\embedfilefinish +\bye +%</test2> +% \end{macrocode} +% \begin{macrocode} +%<*test3> +\NeedsTeXFormat{LaTeX2e} +\let\SavedJobname\jobname +\def\jobname{embedfile} +\RequirePackage{dtx-attach}[2007/09/09] +\let\jobname\SavedJobname +\documentclass{minimal} +\begin{document} + Test (\LaTeX): \texttt{embedfile.dtx} should be embedded.% +\end{document} +%</test3> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -798,6 +984,9 @@ This example document contains three embedded files. % dtx-attach.sty & tex/latex/oberdiek/dtx-attach.sty\\ % embedfile.pdf & doc/latex/oberdiek/embedfile.pdf\\ % embedfile-example-plain.tex & doc/latex/oberdiek/embedfile-example-plain.tex\\ +% embedfile-test1.tex & doc/latex/oberdiek/embedfile-test1.tex\\ +% embedfile-test2.tex & doc/latex/oberdiek/embedfile-test2.tex\\ +% embedfile-test3.tex & doc/latex/oberdiek/embedfile-test3.tex\\ % embedfile.dtx & source/latex/oberdiek/embedfile.dtx\\ % \end{tabular}^^A % }^^A @@ -956,6 +1145,12 @@ This example document contains three embedded files. % \item % Line ends sanitized. % \end{Version} +% \begin{Version}{2007/09/09 v1.2} +% \item +% Fixes for plain-TeX, wrapper for package \xpackage{keyval} added. +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/engord.dtx b/Master/texmf-dist/source/latex/oberdiek/engord.dtx index 02dd0afd063..a8ef4e5e11f 100644 --- a/Master/texmf-dist/source/latex/oberdiek/engord.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/engord.dtx @@ -17,7 +17,8 @@ % % This work consists of the main source file engord.dtx % and the derived files -% engord.sty, engord.pdf, engord.ins, engord.drv. +% engord.sty, engord.pdf, engord.ins, engord.drv, +% engord-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/engord.dtx @@ -52,6 +53,7 @@ % Installation: % TDS:tex/generic/oberdiek/engord.sty % TDS:doc/latex/oberdiek/engord.pdf +% TDS:doc/latex/oberdiek/engord-test1.tex % TDS:source/latex/oberdiek/engord.dtx % %<*ignore> @@ -67,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: engord 2007/04/26 v1.4 Provides the ifpdf switch (HO)} +\Msg{* Package: engord 2007/09/09 v1.5 Provides the ifpdf switch (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +96,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file engord.dtx and the derived files - engord.sty, engord.pdf, engord.ins, engord.drv. + engord.sty, engord.pdf, engord.ins, engord.drv, + engord-test1.tex. \endpreamble @@ -103,6 +106,8 @@ and the derived files \file{engord.drv}{\from{engord.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{engord.sty}{\from{engord.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{engord-test1.tex}{\from{engord.dtx}{test1}}% } \obeyspaces @@ -128,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{engord.drv}% - [2007/04/26 v1.4 Provides the ifpdf switch (HO)]% + [2007/09/09 v1.5 Provides the ifpdf switch (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -137,7 +142,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{281} +% \CheckSum{369} % % \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 @@ -158,7 +163,7 @@ and the derived files % \GetFileInfo{engord.drv} % % \title{The \xpackage{engord} package} -% \date{2007/04/26 v1.4} +% \date{2007/09/09 v1.5} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -318,18 +323,33 @@ and the derived files \fi \expandafter\x\csname ver@engord.sty\endcsname \ProvidesPackage{engord}% - [2007/04/26 v1.4 Provides the ifpdf switch (HO)] + [2007/09/09 v1.5 Provides the ifpdf switch (HO)] % \end{macrocode} % % \subsection{Help commands for plain compatibility} % -% \begin{macro}{\EO@atcode} -% Save catcode of |@|. % \begin{macrocode} -\expandafter\chardef\csname EO@atcode\endcsname\catcode`\@ -\catcode`\@=11 % +\expandafter\edef\csname EO@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\EO@AtEnd{% + \EO@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{36}{3}% $ +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{94}{7}% ^(superscript) +\TMP@EnsureCode{96}{12}% ` % \end{macrocode} -% \end{macro} % % \begin{macro}{\EO@def} % Definitions, \cs{newcommand} does not exist in \plainTeX. @@ -350,7 +370,7 @@ and the derived files \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi % \end{macrocode} % @@ -556,14 +576,68 @@ and the derived files % \end{macrocode} % \end{macro} % -% Restore catcode of |@|. % \begin{macrocode} -\catcode`\@=\EO@atcode +\EO@AtEnd % \end{macrocode} % % \begin{macrocode} %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input engord.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -625,6 +699,7 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % engord.sty & tex/generic/oberdiek/engord.sty\\ % engord.pdf & doc/latex/oberdiek/engord.pdf\\ +% engord-test1.tex & doc/latex/oberdiek/engord-test1.tex\\ % engord.dtx & source/latex/oberdiek/engord.dtx\\ % \end{tabular}^^A % }^^A @@ -774,6 +849,10 @@ and the derived files % \item % Use of package \xpackage{infwarerr}. % \end{Version} +% \begin{Version}{2007/09/09 v1.5} +% \item +% Catcode section added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/epstopdf.dtx b/Master/texmf-dist/source/latex/oberdiek/epstopdf.dtx index affab181594..3bc81e31388 100644 --- a/Master/texmf-dist/source/latex/oberdiek/epstopdf.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/epstopdf.dtx @@ -467,6 +467,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/etexcmds.dtx b/Master/texmf-dist/source/latex/oberdiek/etexcmds.dtx index e37941d6f5c..d2e94c4b67f 100644 --- a/Master/texmf-dist/source/latex/oberdiek/etexcmds.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/etexcmds.dtx @@ -17,7 +17,8 @@ % This work consists of the main source file etexcmds.dtx % and the derived files % etexcmds.sty, etexcmds.pdf, etexcmds.ins, etexcmds.drv, -% etexcmds-test1.tex, etexcmds-test2.tex, etexcmds-test3.tex. +% etexcmds-test1.tex, etexcmds-test2.tex, etexcmds-test3.tex, +% etexcmds-test4.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/etexcmds.dtx @@ -55,6 +56,7 @@ % TDS:doc/latex/oberdiek/etexcmds-test1.tex % TDS:doc/latex/oberdiek/etexcmds-test2.tex % TDS:doc/latex/oberdiek/etexcmds-test3.tex +% TDS:doc/latex/oberdiek/etexcmds-test4.tex % TDS:source/latex/oberdiek/etexcmds.dtx % %<*ignore> @@ -70,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: etexcmds 2007/05/06 v1.0 Providing prefix for e-TeX command names (HO)} +\Msg{* Package: etexcmds 2007/09/09 v1.1 Providing prefix for e-TeX command names (HO)} \Msg{************************************************************************} \keepsilent @@ -97,7 +99,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file etexcmds.dtx and the derived files etexcmds.sty, etexcmds.pdf, etexcmds.ins, etexcmds.drv, - etexcmds-test1.tex, etexcmds-test2.tex, etexcmds-test3.tex. + etexcmds-test1.tex, etexcmds-test2.tex, etexcmds-test3.tex, + etexcmds-test4.tex. \endpreamble @@ -110,6 +113,7 @@ and the derived files \file{etexcmds-test1.tex}{\from{etexcmds.dtx}{test1}}% \file{etexcmds-test2.tex}{\from{etexcmds.dtx}{test2}}% \file{etexcmds-test3.tex}{\from{etexcmds.dtx}{test3}}% + \file{etexcmds-test4.tex}{\from{etexcmds.dtx}{test4}}% } \obeyspaces @@ -135,7 +139,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{etexcmds.drv}% - [2007/05/06 v1.0 Providing prefix for e-TeX command names (HO)]% + [2007/09/09 v1.1 Providing prefix for e-TeX command names (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -144,7 +148,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{252} +% \CheckSum{315} % % \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 @@ -165,7 +169,7 @@ and the derived files % \GetFileInfo{etexcmds.drv} % % \title{The \xpackage{etexcmds} package} -% \date{2007/05/06 v1.0} +% \date{2007/09/09 v1.1} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -181,6 +185,8 @@ and the derived files % % \section{Documentation} % +% \begin{declcs}{etex@unexpanded} +% \end{declcs} % New primitive commands are introduced in \eTeX. Unhappily % \cs{unexpanded} collides with a macro in Con\TeX t with the % same name. This also affects the \LaTeX\ world. For example, @@ -188,6 +194,16 @@ and the derived files % that redefines \cs{unexpanded}. Thus this package defines % \cs{etex@unexpanded} to get rid of the name clash. % +% \begin{declcs}{ifetex@unexpanded} +% \end{declcs} +% Package \xpackage{etexcmds} can be loaded even if \eTeX\ is not +% present or \cs{unexpanded} cannot be found. The switch +% \cs{ifetex@unexpanded} tells whether it is safe to use +% \cs{etex@unexpanded}. +% The switch is true (\cs{iftrue}) only if the +% primitive \cs{unexpanded} has been found and \cs{etex@unexpanded} +% is available. +% % \StopEventually{ % } % @@ -255,25 +271,28 @@ and the derived files \fi \expandafter\x\csname ver@etexcmds.sty\endcsname \ProvidesPackage{etexcmds}% - [2007/05/06 v1.0 Providing prefix for e-TeX command names (HO)] + [2007/09/09 v1.1 Providing prefix for e-TeX command names (HO)] % \end{macrocode} % % \subsection{Catcodes} % % \begin{macrocode} -\expandafter\edef\csname etexcmds@End\endcsname{% - \catcode44 \the\catcode44\relax % , - \catcode45 \the\catcode45\relax % - - \catcode46 \the\catcode46\relax % . - \catcode61 \the\catcode61\relax % = - \catcode64 \the\catcode64\relax % @ - \noexpand\endinput +\expandafter\edef\csname etexcmds@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode44 12 % , -\catcode45 12 % - -\catcode46 12 % . -\catcode61 12 % = \catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\etexcmds@AtEnd{% + \etexcmds@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = % \end{macrocode} % % \subsection{Load package \xpackage{infwarerr}} @@ -283,7 +302,7 @@ and the derived files \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi % \end{macrocode} % @@ -333,47 +352,101 @@ and the derived files % \end{macro} % % \begin{macrocode} -\InfWarErr@End +\etexcmds@AtEnd %</package> % \end{macrocode} % % \section{Test} % +% \subsection{Catcode checks for loading} +% % \begin{macrocode} %<*test1> -\immediate\write16{etexcmds-test1.tex: test file for plainTeX} +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input etexcmds.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Macro tests} +% +% \begin{macrocode} +%<*test2> +\immediate\write16{etexcmds-test2.tex: test file for plainTeX} \input etexcmds.sty\relax \catcode`\@=11 % \edef\x{\string\unexpanded} \edef\y{\meaning\etex@unexpanded} \ifx\x\y \else - \@PackageError{etexcmds-test1}{Test failed}\@ehc + \@PackageError{etexcmds-test2}{Test failed}\@ehc \fi \end -%</test1> +%</test2> % \end{macrocode} % % \begin{macrocode} -%<*test2> +%<*test3> \NeedsTeXFormat{LaTeX2e} -\ProvidesFile{etexcmds-test2.tex}[2007/05/06 v1.0 Test file for LaTeX] +\ProvidesFile{etexcmds-test3.tex}[2007/09/09 v1.1 Test file for LaTeX] \RequirePackage{etexcmds} \makeatletter \edef\x{\string\unexpanded} \edef\y{\meaning\etex@unexpanded} \ifx\x\y \else - \@PackageError{etexcmds-test2}{Test failed}\@ehc + \@PackageError{etexcmds-test3}{Test failed}\@ehc \fi \stop -%</test2> +%</test3> % \end{macrocode} % % \begin{macrocode} -%<*test3> +%<*test4> \NeedsTeXFormat{LaTeX2e} -\ProvidesFile{etexcmds-test3.tex}[2007/05/06 v1.0 Test file for LaTeX] +\ProvidesFile{etexcmds-test4.tex}[2007/09/09 v1.1 Test file for LaTeX] \documentclass{article} \usepackage{m-pictex} \usepackage{m-ch-de} @@ -384,16 +457,17 @@ and the derived files \edef\y{\meaning\etex@unexpanded}% \ifx\x\y \else - \@PackageWarningNoLine{etexcmds-test3}{Test failed}% + \@PackageWarningNoLine{etexcmds-test4}{Test failed}% \fi \else - \@PackageWarningNoLine{etexcmds-test3}{% + \@PackageWarningNoLine{etexcmds-test4}{% Test failed because of ConTeXt% }% \fi \stop -%</test3> +%</test4> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -458,6 +532,7 @@ and the derived files % etexcmds-test1.tex & doc/latex/oberdiek/etexcmds-test1.tex\\ % etexcmds-test2.tex & doc/latex/oberdiek/etexcmds-test2.tex\\ % etexcmds-test3.tex & doc/latex/oberdiek/etexcmds-test3.tex\\ +% etexcmds-test4.tex & doc/latex/oberdiek/etexcmds-test4.tex\\ % etexcmds.dtx & source/latex/oberdiek/etexcmds.dtx\\ % \end{tabular}^^A % }^^A @@ -583,6 +658,12 @@ and the derived files % \item % First version. % \end{Version} +% \begin{Version}{2007/09/09 v1.1} +% \item +% Documentation for \cs{ifetex@unexpanded} added. +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/flags.dtx b/Master/texmf-dist/source/latex/oberdiek/flags.dtx index 60ddb3ac2fa..234d4ea98de 100644 --- a/Master/texmf-dist/source/latex/oberdiek/flags.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/flags.dtx @@ -431,6 +431,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx index baede332a65..0f5dc8745ff 100644 --- a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx @@ -643,6 +643,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/holtxdoc.dtx b/Master/texmf-dist/source/latex/oberdiek/holtxdoc.dtx index de76eaddd8a..dac8723d0f9 100644 --- a/Master/texmf-dist/source/latex/oberdiek/holtxdoc.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/holtxdoc.dtx @@ -391,6 +391,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx index 9e3d71e3edd..582f287166d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx @@ -1335,6 +1335,7 @@ and the derived files \end{document} %</test> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/hypbmsec.dtx b/Master/texmf-dist/source/latex/oberdiek/hypbmsec.dtx index 8f92c730904..2bd47a42786 100644 --- a/Master/texmf-dist/source/latex/oberdiek/hypbmsec.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/hypbmsec.dtx @@ -571,6 +571,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/hypcap.dtx b/Master/texmf-dist/source/latex/oberdiek/hypcap.dtx index 8219306ed6a..aee84cf8f25 100644 --- a/Master/texmf-dist/source/latex/oberdiek/hypcap.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/hypcap.dtx @@ -435,6 +435,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/hypdestopt.dtx b/Master/texmf-dist/source/latex/oberdiek/hypdestopt.dtx index 6957f95abda..426adabbeb1 100644 --- a/Master/texmf-dist/source/latex/oberdiek/hypdestopt.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/hypdestopt.dtx @@ -685,6 +685,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/hypdoc.dtx b/Master/texmf-dist/source/latex/oberdiek/hypdoc.dtx index 4c062061bb3..b5909672545 100644 --- a/Master/texmf-dist/source/latex/oberdiek/hypdoc.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/hypdoc.dtx @@ -813,6 +813,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/ifdraft.dtx b/Master/texmf-dist/source/latex/oberdiek/ifdraft.dtx index 8831cea3e66..1a9383cc958 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ifdraft.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ifdraft.dtx @@ -308,6 +308,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/iflang.dtx b/Master/texmf-dist/source/latex/oberdiek/iflang.dtx index 9932f23a351..94a700a37b5 100644 --- a/Master/texmf-dist/source/latex/oberdiek/iflang.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/iflang.dtx @@ -17,7 +17,8 @@ % This work consists of the main source file iflang.dtx % and the derived files % iflang.sty, iflang.pdf, iflang.ins, iflang.drv, -% iflang-test1.tex, iflang-test2.tex, iflang-test3.tex. +% iflang-test1.tex, iflang-test2.tex, iflang-test3.tex, +% iflang-test4.tex, iflang-test5.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/iflang.dtx @@ -55,6 +56,8 @@ % TDS:doc/latex/oberdiek/iflang-test1.tex % TDS:doc/latex/oberdiek/iflang-test2.tex % TDS:doc/latex/oberdiek/iflang-test3.tex +% TDS:doc/latex/oberdiek/iflang-test4.tex +% TDS:doc/latex/oberdiek/iflang-test5.tex % TDS:source/latex/oberdiek/iflang.dtx % %<*ignore> @@ -70,7 +73,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: iflang 2007/04/26 v1.3 Language checks (HO)} +\Msg{* Package: iflang 2007/09/09 v1.4 Language checks (HO)} \Msg{************************************************************************} \keepsilent @@ -97,7 +100,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file iflang.dtx and the derived files iflang.sty, iflang.pdf, iflang.ins, iflang.drv, - iflang-test1.tex, iflang-test2.tex, iflang-test3.tex. + iflang-test1.tex, iflang-test2.tex, iflang-test3.tex, + iflang-test4.tex, iflang-test5.tex. \endpreamble @@ -110,6 +114,8 @@ and the derived files \file{iflang-test1.tex}{\from{iflang.dtx}{test1}}% \file{iflang-test2.tex}{\from{iflang.dtx}{test2}}% \file{iflang-test3.tex}{\from{iflang.dtx}{test3}}% + \file{iflang-test4.tex}{\from{iflang.dtx}{test4}}% + \file{iflang-test5.tex}{\from{iflang.dtx}{test5}}% } \obeyspaces @@ -135,7 +141,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{iflang.drv}% - [2007/04/26 v1.3 Language checks (HO)]% + [2007/09/09 v1.4 Language checks (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -144,7 +150,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{608} +% \CheckSum{727} % % \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 @@ -165,7 +171,7 @@ and the derived files % \GetFileInfo{iflang.drv} % % \title{The \xpackage{iflang} package} -% \date{2007/04/26 v1.3} +% \date{2007/09/09 v1.4} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -316,23 +322,29 @@ and the derived files \fi \expandafter\x\csname ver@iflang.sty\endcsname \ProvidesPackage{iflang}% - [2007/04/26 v1.3 Language checks (HO)] + [2007/09/09 v1.4 Language checks (HO)] % \end{macrocode} % % \begin{macrocode} -\expandafter\edef\csname IfLang@endinput\endcsname{% - \catcode39 \the\catcode39\relax % ' - \catcode40 \the\catcode40\relax % ( - \catcode41 \the\catcode41\relax % ) - \catcode61 \the\catcode61\relax % = - \catcode64 \the\catcode64\relax % @ - \noexpand\endinput +\expandafter\edef\csname IfLang@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode39 12\relax % ' -\catcode40 12\relax % ( -\catcode41 12\relax % ) -\catcode61 12\relax % = -\catcode64 11\relax % @ +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\IfLang@AtEnd{% + \IfLang@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{61}{12}% = % \end{macrocode} % % \subsection{Tools} @@ -400,7 +412,7 @@ and the derived files \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi % \end{macrocode} % @@ -535,7 +547,7 @@ and the derived files % \begin{macrocode} \def\IfLanguageName#1{% \ifnum\IfLang@IfDefined{languagename}{% - \if\expandafter\IfLang@strequal\expandafter% + \if\expandafter\IfLang@StrEqual\expandafter% {\languagename}{#1}% 0% \else @@ -586,19 +598,72 @@ and the derived files % \end{macrocode} % % \begin{macrocode} -\IfLang@endinput +\IfLang@AtEnd %</package> % \end{macrocode} % % \section{Test} % -% \subsection{Test with \LaTeX} +% \subsection{Catcode checks for loading} % % \begin{macrocode} %<*test1> % \end{macrocode} % \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input iflang.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Test with \LaTeX} +% +% \begin{macrocode} +%<*test2|test3> +% \end{macrocode} +% \begin{macrocode} \NeedsTeXFormat{LaTeX2e} +%<test3>\let\pdfstrcmp\relax \nofiles \documentclass{minimal} \usepackage{qstest} @@ -626,6 +691,40 @@ and the derived files \test{ngerman}{false}% \test{naustrian}{true}% \test{foobar}{false}% + % + \def\languagename{naustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \edef\languagename{\string naustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \def\languagename{naustrian}% + \makeatletter + \@onelevel@sanitize\languagename + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \def\languagename{naustrian}% + \def\xaustrian{naustrian}% + \def\xgerman{ngerman}% + \test{\xaustrian}{true}% + \test{\xgerman}{false}% + % + \def\languagename{\xaustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + \test{\xaustrian}{true}% + \test{\xgerman}{false}% + \test{\languagename}{true}% + \test{\languagename\space}{false}% + % + \def\languagename{\empty\xaustrian\empty}% + \test{naustrian}{true}% + \test{ngerman}{false}% + \test{\empty\xaustrian\empty}{true}% + \test{\empty\xgerman\empty}{false}% \end{qstest} \begin{qstest}{IfDefined}{defined} \makeatletter @@ -640,13 +739,13 @@ and the derived files \end{document} % \end{macrocode} % \begin{macrocode} -%</test1> +%</test2|test3> % \end{macrocode} % % \subsection{Test with \plainTeX\ and \eTeX} % % \begin{macrocode} -%<*test2> +%<*test4> % \end{macrocode} % \begin{macrocode} %% Format `etex' based on `language.def' @@ -684,13 +783,13 @@ and the derived files \end % \end{macrocode} % \begin{macrocode} -%</test2> +%</test4> % \end{macrocode} % % \subsection{Test with \plainTeX\ and without \eTeX/\pdfTeX} % % \begin{macrocode} -%<*test3> +%<*test5> % \end{macrocode} % \begin{macrocode} %% Format `tex' (vanilla plain-TeX) @@ -755,8 +854,9 @@ and the derived files \end % \end{macrocode} % \begin{macrocode} -%</test3> +%</test5> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -821,6 +921,8 @@ and the derived files % iflang-test1.tex & doc/latex/oberdiek/iflang-test1.tex\\ % iflang-test2.tex & doc/latex/oberdiek/iflang-test2.tex\\ % iflang-test3.tex & doc/latex/oberdiek/iflang-test3.tex\\ +% iflang-test4.tex & doc/latex/oberdiek/iflang-test4.tex\\ +% iflang-test5.tex & doc/latex/oberdiek/iflang-test5.tex\\ % iflang.dtx & source/latex/oberdiek/iflang.dtx\\ % \end{tabular}^^A % }^^A @@ -968,6 +1070,13 @@ and the derived files % \item % Use of package \xpackage{infwarerr}. % \end{Version} +% \begin{Version}{2007/09/09 v1.4} +% \item +% Bug fix: \cs{IfLang@StrEqual} $\rightarrow$ \cs{IfLangStrEqual} +% (Gabriele Balducci). +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx b/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx index cd1020fce89..51c1870ecb6 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx @@ -17,7 +17,8 @@ % % This work consists of the main source file ifpdf.dtx % and the derived files -% ifpdf.sty, ifpdf.pdf, ifpdf.ins, ifpdf.drv. +% ifpdf.sty, ifpdf.pdf, ifpdf.ins, ifpdf.drv, +% ifpdf-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/ifpdf.dtx @@ -52,6 +53,7 @@ % Installation: % TDS:tex/generic/oberdiek/ifpdf.sty % TDS:doc/latex/oberdiek/ifpdf.pdf +% TDS:doc/latex/oberdiek/ifpdf-test1.tex % TDS:source/latex/oberdiek/ifpdf.dtx % %<*ignore> @@ -67,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: ifpdf 2006/02/20 v1.4 Provides the ifpdf switch (HO)} +\Msg{* Package: ifpdf 2007/09/09 v1.5 Provides the ifpdf switch (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +96,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file ifpdf.dtx and the derived files - ifpdf.sty, ifpdf.pdf, ifpdf.ins, ifpdf.drv. + ifpdf.sty, ifpdf.pdf, ifpdf.ins, ifpdf.drv, + ifpdf-test1.tex. \endpreamble @@ -103,6 +106,8 @@ and the derived files \file{ifpdf.drv}{\from{ifpdf.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{ifpdf.sty}{\from{ifpdf.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{ifpdf-test1.tex}{\from{ifpdf.dtx}{test1}}% } \obeyspaces @@ -128,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ifpdf.drv}% - [2006/02/20 v1.4 Provides the ifpdf switch (HO)]% + [2007/09/09 v1.5 Provides the ifpdf switch (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -137,7 +142,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{169} +% \CheckSum{271} % % \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 @@ -158,7 +163,7 @@ and the derived files % \GetFileInfo{ifpdf.drv} % % \title{The \xpackage{ifpdf} package} -% \date{2006/02/20 v1.4} +% \date{2007/09/09 v1.5} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -366,7 +371,34 @@ and the derived files \fi \expandafter\x\csname ver@ifpdf.sty\endcsname \ProvidesPackage{ifpdf}% - [2006/02/20 v1.4 Provides the ifpdf switch (HO)] + [2007/09/09 v1.5 Provides the ifpdf switch (HO)] +% \end{macrocode} +% +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname ifpdf@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\ifpdf@AtEnd{% + \ifpdf@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{10}{12}% ^^J +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{94}{7}% ^ +\TMP@EnsureCode{96}{12}% ` % \end{macrocode} % % \subsection{Check for previously defined \cs{ifpdf}} @@ -395,6 +427,7 @@ and the derived files therefore package loading is aborted.% }% \endgroup + \ifpdf@AtEnd \expandafter\endinput \fi \endgroup @@ -445,8 +478,66 @@ and the derived files \endgroup % \end{macrocode} % \begin{macrocode} +\ifpdf@AtEnd +% \end{macrocode} +% \begin{macrocode} %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input ifpdf.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -508,6 +599,7 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % ifpdf.sty & tex/generic/oberdiek/ifpdf.sty\\ % ifpdf.pdf & doc/latex/oberdiek/ifpdf.pdf\\ +% ifpdf-test1.tex & doc/latex/oberdiek/ifpdf-test1.tex\\ % ifpdf.dtx & source/latex/oberdiek/ifpdf.dtx\\ % \end{tabular}^^A % }^^A @@ -664,6 +756,10 @@ and the derived files % \item % Extended documentation. % \end{Version} +% \begin{Version}{2007/09/09 v1.5} +% \item +% Catcode settings added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/ifvtex.dtx b/Master/texmf-dist/source/latex/oberdiek/ifvtex.dtx index 7c49345733b..3b81603977f 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ifvtex.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ifvtex.dtx @@ -17,7 +17,8 @@ % % This work consists of the main source file ifvtex.dtx % and the derived files -% ifvtex.sty, ifvtex.pdf, ifvtex.ins, ifvtex.drv. +% ifvtex.sty, ifvtex.pdf, ifvtex.ins, ifvtex.drv, +% ifvtex-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/ifvtex.dtx @@ -52,6 +53,7 @@ % Installation: % TDS:tex/generic/oberdiek/ifvtex.sty % TDS:doc/latex/oberdiek/ifvtex.pdf +% TDS:doc/latex/oberdiek/ifvtex-test1.tex % TDS:source/latex/oberdiek/ifvtex.dtx % %<*ignore> @@ -67,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: ifvtex 2007/01/10 v1.2 Switches for detecting VTeX and its modes (HO)} +\Msg{* Package: ifvtex 2007/09/09 v1.3 Switches for detecting VTeX and its modes (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +96,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file ifvtex.dtx and the derived files - ifvtex.sty, ifvtex.pdf, ifvtex.ins, ifvtex.drv. + ifvtex.sty, ifvtex.pdf, ifvtex.ins, ifvtex.drv, + ifvtex-test1.tex. \endpreamble @@ -103,6 +106,8 @@ and the derived files \file{ifvtex.drv}{\from{ifvtex.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{ifvtex.sty}{\from{ifvtex.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{ifvtex-test1.tex}{\from{ifvtex.dtx}{test1}}% } \obeyspaces @@ -128,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ifvtex.drv}% - [2007/01/10 v1.2 Switches for detecting VTeX and its modes (HO)]% + [2007/09/09 v1.3 Switches for detecting VTeX and its modes (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -137,7 +142,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{237} +% \CheckSum{340} % % \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 @@ -158,7 +163,7 @@ and the derived files % \GetFileInfo{ifvtex.drv} % % \title{The \xpackage{ifvtex} package} -% \date{2007/01/10 v1.2} +% \date{2007/09/09 v1.3} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -277,9 +282,36 @@ and the derived files \fi \expandafter\x\csname ver@ifvtex.sty\endcsname \ProvidesPackage{ifvtex}% - [2007/01/10 v1.2 Switches for detecting VTeX and its modes (HO)] + [2007/09/09 v1.3 Switches for detecting VTeX and its modes (HO)] % \end{macrocode} % +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname ifvtex@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\ifvtex@AtEnd{% + \ifvtex@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{10}{12}% ^^J +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{94}{7}% ^ +\TMP@EnsureCode{96}{12}% ` +% \end{macrocode} % % \subsection{Check for previously defined \cs{ifvtex}} % @@ -307,6 +339,7 @@ and the derived files therefore package loading is aborted.% }% \endgroup + \ifvtex@AtEnd \expandafter\endinput \fi \endgroup @@ -394,8 +427,64 @@ and the derived files % \end{macrocode} % % \begin{macrocode} +\ifvtex@AtEnd %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input ifvtex.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -457,6 +546,7 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % ifvtex.sty & tex/generic/oberdiek/ifvtex.sty\\ % ifvtex.pdf & doc/latex/oberdiek/ifvtex.pdf\\ +% ifvtex-test1.tex & doc/latex/oberdiek/ifvtex-test1.tex\\ % ifvtex.dtx & source/latex/oberdiek/ifvtex.dtx\\ % \end{tabular}^^A % }^^A @@ -592,6 +682,10 @@ and the derived files % \item % Fix of the \cs{ProvidesPackage} description. % \end{Version} +% \begin{Version}{2007/09/09 v1.3} +% \item +% Catcode section added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/infwarerr.dtx b/Master/texmf-dist/source/latex/oberdiek/infwarerr.dtx index 52e9e4fae56..6d9adc0fae2 100644 --- a/Master/texmf-dist/source/latex/oberdiek/infwarerr.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/infwarerr.dtx @@ -17,7 +17,8 @@ % This work consists of the main source file infwarerr.dtx % and the derived files % infwarerr.sty, infwarerr.pdf, infwarerr.ins, infwarerr.drv, -% infwarerr-test1.tex, infwarerr-test2.tex. +% infwarerr-test1.tex, infwarerr-test2.tex, +% infwarerr-test3.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/infwarerr.dtx @@ -54,6 +55,7 @@ % TDS:doc/latex/oberdiek/infwarerr.pdf % TDS:doc/latex/oberdiek/infwarerr-test1.tex % TDS:doc/latex/oberdiek/infwarerr-test2.tex +% TDS:doc/latex/oberdiek/infwarerr-test3.tex % TDS:source/latex/oberdiek/infwarerr.dtx % %<*ignore> @@ -69,7 +71,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: infwarerr 2007/06/14 v1.1 Providing info/warning/message (HO)} +\Msg{* Package: infwarerr 2007/09/09 v1.2 Providing info/warning/message (HO)} \Msg{************************************************************************} \keepsilent @@ -96,7 +98,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file infwarerr.dtx and the derived files infwarerr.sty, infwarerr.pdf, infwarerr.ins, infwarerr.drv, - infwarerr-test1.tex, infwarerr-test2.tex. + infwarerr-test1.tex, infwarerr-test2.tex, + infwarerr-test3.tex. \endpreamble @@ -108,6 +111,7 @@ and the derived files \usedir{doc/latex/oberdiek}% \file{infwarerr-test1.tex}{\from{infwarerr.dtx}{test1}}% \file{infwarerr-test2.tex}{\from{infwarerr.dtx}{test2}}% + \file{infwarerr-test3.tex}{\from{infwarerr.dtx}{test3}}% } \obeyspaces @@ -133,7 +137,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{infwarerr.drv}% - [2007/06/14 v1.1 Providing info/warning/message (HO)]% + [2007/09/09 v1.2 Providing info/warning/message (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -142,7 +146,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{657} +% \CheckSum{692} % % \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 @@ -163,7 +167,7 @@ and the derived files % \GetFileInfo{infwarerr.drv} % % \title{The \xpackage{infwarerr} package} -% \date{2007/06/14 v1.1} +% \date{2007/09/09 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -270,39 +274,35 @@ and the derived files \fi \expandafter\x\csname ver@infwarerr.sty\endcsname \ProvidesPackage{infwarerr}% - [2007/06/14 v1.1 Providing info/warning/message (HO)] + [2007/09/09 v1.2 Providing info/warning/message (HO)] % \end{macrocode} % % \subsection{Catcodes} % % \begin{macrocode} -\expandafter\edef\csname InfWarErr@End\endcsname{% - \catcode39 \the\catcode39\relax % ' - \catcode40 \the\catcode40\relax % ( - \catcode41 \the\catcode41\relax % ) - \catcode44 \the\catcode44\relax % , - \catcode45 \the\catcode45\relax % - - \catcode46 \the\catcode46\relax % . - \catcode58 \the\catcode58\relax % : - \catcode60 \the\catcode60\relax % < - \catcode61 \the\catcode61\relax % = - \catcode62 \the\catcode62\relax % > - \catcode64 \the\catcode64\relax % @ - \catcode94 \the\catcode94\relax % ^ - \noexpand\endinput +\expandafter\edef\csname InfWarErr@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode39 12 % ' -\catcode40 12 % ( -\catcode41 12 % ) -\catcode44 12 % , -\catcode45 12 % - -\catcode46 12 % . -\catcode58 12 % : -\catcode60 12 % < -\catcode61 12 % = -\catcode62 12 % > \catcode64 11 % @ -\catcode94 7 % ^ +\def\TMP@EnsureCode#1#2{% + \edef\InfWarErr@AtEnd{% + \InfWarErr@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{10}{12}% ^^J +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{94}{7}% ^ % \end{macrocode} % % \subsection{\LaTeX\ detection} @@ -388,8 +388,8 @@ and the derived files % \end{macrocode} % \end{macro} % \begin{macrocode} - \csname fi\endcsname - \InfWarErr@End + \InfWarErr@AtEnd + \expandafter\endinput \fi % \end{macrocode} % @@ -604,38 +604,92 @@ and the derived files % \end{macro} % % \begin{macrocode} -\InfWarErr@End +\InfWarErr@AtEnd %</package> % \end{macrocode} % % \section{Test} % +% \subsection{Catcode checks for loading} +% % \begin{macrocode} %<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input infwarerr.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Macro tests} +% +% \begin{macrocode} +%<*test2> \let\PackageInfo\relax \input infwarerr.sty\relax \let\OrgWrite\write \chardef\WriteUnused=16 % \def\msg#{\immediate\OrgWrite\WriteUnused} -\msg{File: infwarerr-test1.tex 2007/06/14 v1.1 Test file for plain-TeX} +\msg{File: infwarerr-test2.tex 2007/09/09 v1.2 Test file for plain-TeX} \catcode64=11 % -%</test1> +%</test2> % \end{macrocode} % % \begin{macrocode} -%<*test2> +%<*test3> \NeedsTeXFormat{LaTeX2e} -\ProvidesFile{infwarerr-test2.tex}[2007/06/14 v1.1 Test file for LaTeX] -\RequirePackage{infwarerr} +\ProvidesFile{infwarerr-test3.tex}[2007/09/09 v1.2 Test file for LaTeX] +\RequirePackage{infwarerr}[2007/09/09] \makeatletter \let\OrgWrite\write \chardef\WriteUnused=\@unused \def\msg#{\immediate\OrgWrite\WriteUnused} -%</test2> +%</test3> % \end{macrocode} % % \begin{macrocode} -%<*test1|test2> +%<*test2|test3> \def\pkgname{PACKAGE} \def\clsname{CLASS} \def\msgtext{MESSAGE\MessageBreak SECOND LINE} @@ -736,9 +790,9 @@ and the derived files }% } \def\TestError{% -%<test2> \let\write\OrgWrite -%<test2> \def\plaindots{} -%<test1> \def\plaindots{.^^J ...^^J} +%<test3> \let\write\OrgWrite +%<test3> \def\plaindots{} +%<test2> \def\plaindots{.^^J ...^^J} \@PackageError\pkgname\msgtext\hlptext \@TestError\@PackageError{% ! Package PACKAGE Error: MESSAGE^^J% @@ -788,8 +842,8 @@ and the derived files \begingroup \let~\space \edef\x{#2}% -%<test2> \@onelevel@sanitize\x -%<test2> \@onelevel@sanitize\ErrMessage +%<test3> \@onelevel@sanitize\x +%<test3> \@onelevel@sanitize\ErrMessage \ifx\x\ErrMessage \else \msg{}% @@ -813,11 +867,12 @@ and the derived files \TestInfo \TestWarning \TestError -%</test1|test2> -%<test1>\end -%<test2>\@@end +%</test2|test3> +%<test2>\end +%<test3>\@@end % \end{macrocode} % +% % \section{Installation} % % \subsection{Download} @@ -881,6 +936,7 @@ and the derived files % infwarerr.pdf & doc/latex/oberdiek/infwarerr.pdf\\ % infwarerr-test1.tex & doc/latex/oberdiek/infwarerr-test1.tex\\ % infwarerr-test2.tex & doc/latex/oberdiek/infwarerr-test2.tex\\ +% infwarerr-test3.tex & doc/latex/oberdiek/infwarerr-test3.tex\\ % infwarerr.dtx & source/latex/oberdiek/infwarerr.dtx\\ % \end{tabular}^^A % }^^A @@ -1008,7 +1064,11 @@ and the derived files % \end{Version} % \begin{Version}{2007/06/14 v1.1} % \item -% Small fixes +% Small fixes. +% \end{Version} +% \begin{Version}{2007/09/09 v1.2} +% \item +% Catcode section extended. % \end{Version} % \end{History} % diff --git a/Master/texmf-dist/source/latex/oberdiek/inputenx.dtx b/Master/texmf-dist/source/latex/oberdiek/inputenx.dtx index 4f400d15f0c..002832059c4 100644 --- a/Master/texmf-dist/source/latex/oberdiek/inputenx.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/inputenx.dtx @@ -10168,6 +10168,7 @@ and the derived files % \begin{macrocode} %</dfudoc> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/intcalc.dtx b/Master/texmf-dist/source/latex/oberdiek/intcalc.dtx new file mode 100644 index 00000000000..2cef807d937 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/intcalc.dtx @@ -0,0 +1,3701 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file intcalc.dtx +% and the derived files +% intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv, +% intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex, +% intcalc-test4.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/intcalc.dtx +% CTAN:macros/latex/contrib/oberdiek/intcalc.pdf +% +% Unpacking: +% (a) If intcalc.ins is present: +% tex intcalc.ins +% (b) Without intcalc.ins: +% tex intcalc.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{intcalc.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If intcalc.drv is present: +% latex intcalc.drv +% (b) Without intcalc.drv: +% latex intcalc.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex intcalc.dtx +% makeindex -s gind.ist intcalc.idx +% pdflatex intcalc.dtx +% makeindex -s gind.ist intcalc.idx +% pdflatex intcalc.dtx +% +% Installation: +% TDS:tex/generic/oberdiek/intcalc.sty +% TDS:doc/latex/oberdiek/intcalc.pdf +% TDS:doc/latex/oberdiek/intcalc-test1.tex +% TDS:doc/latex/oberdiek/intcalc-test2.tex +% TDS:doc/latex/oberdiek/intcalc-test3.tex +% TDS:doc/latex/oberdiek/intcalc-test4.tex +% TDS:source/latex/oberdiek/intcalc.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: intcalc 2007/09/09 v1.0 Expandable integer calculations (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file intcalc.dtx +and the derived files + intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv, + intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex, + intcalc-test4.tex. + +\endpreamble + +\generate{% + \file{intcalc.ins}{\from{intcalc.dtx}{install}}% + \file{intcalc.drv}{\from{intcalc.dtx}{driver}}% + \usedir{tex/generic/oberdiek}% + \file{intcalc.sty}{\from{intcalc.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{intcalc-test1.tex}{\from{intcalc.dtx}{test1}}% + \file{intcalc-test2.tex}{\from{intcalc.dtx}{test2,etex}}% + \file{intcalc-test3.tex}{\from{intcalc.dtx}{test3,noetex}}% + \file{intcalc-test4.tex}{\from{intcalc.dtx}{test4,etex}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* intcalc.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `intcalc.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{intcalc.drv}% + [2007/09/09 v1.0 Expandable integer calculations (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\usepackage{wasysym} +\let\iint\relax +\let\iiint\relax +\usepackage[fleqn]{amsmath} + +\DeclareMathOperator{\opInv}{Inv} +\DeclareMathOperator{\opAbs}{Abs} +\DeclareMathOperator{\opSgn}{Sgn} +\DeclareMathOperator{\opMin}{Min} +\DeclareMathOperator{\opMax}{Max} +\DeclareMathOperator{\opCmp}{Cmp} +\DeclareMathOperator{\opInc}{Inc} +\DeclareMathOperator{\opDec}{Dec} +\DeclareMathOperator{\opAdd}{Add} +\DeclareMathOperator{\opSub}{Sub} +\DeclareMathOperator{\opShl}{Shl} +\DeclareMathOperator{\opShr}{Shr} +\DeclareMathOperator{\opMul}{Mul} +\DeclareMathOperator{\opSqr}{Sqr} +\DeclareMathOperator{\opFac}{Fac} +\DeclareMathOperator{\opPow}{Pow} +\DeclareMathOperator{\opDiv}{Div} +\DeclareMathOperator{\opMod}{Mod} +\DeclareMathOperator{\opInt}{Int} +\DeclareMathOperator{\opOdd}{ifodd} + +\newcommand*{\Def}{% + \ensuremath{% + \mathrel{\mathop{:}}=% + }% +} +\newcommand*{\op}[1]{% + \textsf{#1}% +} +\begin{document} + \DocInput{intcalc.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{2665} +% +% \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 \~} +% +% \GetFileInfo{intcalc.drv} +% +% \title{The \xpackage{intcalc} package} +% \date{2007/09/09 v1.0} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% This package provides expandable arithmetic operations +% with integers. +% \end{abstract} +% +% \tableofcontents +% +% \section{Documentation} +% +% \subsection{Introduction} +% +% Package \xpackage{intcalc} defines arithmetic operations +% that deal with integers. Integers mean numbers in \TeX. +% The same restrictions apply, the range is limited to +% [-2147483647, 2147483647]. +% +% The operations have the form of macros that take one or +% two integers as parameter and return the integer result. +% The macro name is a three letter operation name prefixed +% by the package name, e.g. \cs{intcalcAdd}{10}{43} returns +% |53|. +% +% The macros are fully expandable, exactly two expansion +% steps generate the result. Therefore the operations +% may be used nearly everywhere in \TeX, even inside +% \cs{number}, \cs{csname}, file names, or other +% expandable contexts. +% +% The package contains two implementations of the operations. +% If \eTeX\ is detected then the macros are implemented +% using its features (\cs{numexpr}). Otherwise the slower +% implementation without \eTeX's help is choosen. +% +% \subsection{Conditions} +% +% \subsubsection{Preconditions} +% +% \begin{itemize} +% \item +% Arguments can be anything that \TeX\ interprets as ``number''. +% Examples: plain numbers, count or length register, macros +% that expands to a number. +% \item +% The arguments are limited to the range +% -2147483647 until 2147483647. These numbers belong to the range. +% Note that some operations +% have additionals restrictions to the range. +% \item +% The argument may be expressions that \cs{numexpr} +% understands if \eTeX\ is available. +% \item +% The resulting number must fit in the allowed range. +% \end{itemize} +% +% \subsubsection{Postconditions} +% +% Additional properties of the macros apart from calculating +% a correct result (of course \smiley): +% \begin{itemize} +% \item +% The macros are fully expandable. Thus they can +% be used inside \cs{edef}, \cs{csname}, after \cs{number}, +% for example. +% \item +% Furthermore exactly two expansion steps calculate the result. +% \item +% The number consists of one optional minus sign and one to +% ten digits. The first digit is larger than zero for +% numbers that consists of more than one digit. +% +% In short, the number format is exactly the same as +% \cs{number} generates. And the tokens (minus sign, digits) +% have catcode 12 (other). +% \item +% Call by value is simulated. First the arguments are +% converted to numbers. Then these numbers are used +% in the calculations. +% +% Remember that arguments +% may contain expensive macros or \eTeX\ expressions. +% This strategy avoids multiple evaluations of such +% arguments. +% \end{itemize} +% +% \subsection{Error handling} +% +% There are two kinds of errors if a precondition is violated: +% Some errors are detected by the macros, example: division by zero. +% In this cases an undefined control sequence is called and causes +% a TeX error message, example: \cs{IntCalcError:DivisionByZero}. +% The name of the control sequence contains +% the reason for the error. The \TeX\ error may be ignored. +% Then the operation returns zero as result. +% Because the macros are supposed to work in expandible contexts. +% An traditional error message, however, is not expandable and +% would break these contexts. +% +% If a number exceeds the range of -2147483647 until 2147483647, then +% \TeX\ throws an error ``Number too big'' and recovers by +% using biggest allowed value. +% Example for the negative number -3000000000 is replaced +% by -2147483647. +% +% \subsection{Operations} +% +% Some definition equations below use the function $\opInt$ +% that converts a real number to an integer. The number +% is truncated that means rounding to zero: +% \begin{gather*} +% \opInt(x) \Def +% \begin{cases} +% \lfloor x\rfloor & \text{if $x\geq0$}\\ +% \lceil x\rceil & \text{otherwise} +% \end{cases} +% \end{gather*} +% +% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}} +% +% \begin{declcs}{intcalcInv} \M{x} +% \end{declcs} +% Macro \cs{intcalcInv} switches the sign. +% \begin{gather*} +% \opInv(x) \Def -x +% \end{gather*} +% +% \begin{declcs}{intcalcAbs} \M{x} +% \end{declcs} +% Macro \cs{intcalcAbs} returns the absolute value +% of integer \meta{x}. +% \begin{gather*} +% \opAbs(x) \Def \vert x\vert +% \end{gather*} +% +% \begin{declcs}{intcalcSgn} \M{x} +% \end{declcs} +% Macro \cs{intcalcSgn} encodes the sign of \meta{x} as number. +% \begin{gather*} +% \opSgn(x) \Def +% \begin{cases} +% -1& \text{if $x<0$}\\ +% 0& \text{if $x=0$}\\ +% 1& \text{if $x>0$} +% \end{cases} +% \end{gather*} +% These return values can easily be distinguished by \cs{ifcase}: +%\begin{quote} +%\begin{verbatim} +%\ifcase\intcalcSgn{<x>} +% $x=0$ +%\or +% $x>0$ +%\else +% $x<0$ +%\fi +%\end{verbatim} +%\end{quote} +% +% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}} +% +% \begin{declcs}{intcalcMin} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcMin} returns the smaller of the two integers. +% \begin{gather*} +% \opMin(x,y) \Def +% \begin{cases} +% x & \text{if $x<y$}\\ +% y & \text{otherwise} +% \end{cases} +% \end{gather*} +% +% \begin{declcs}{intcalcMax} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcMax} returns the larger of the two integers. +% \begin{gather*} +% \opMax(x,y) \Def +% \begin{cases} +% x & \text{if $x>y$}\\ +% y & \text{otherwise} +% \end{cases} +% \end{gather*} +% +% \begin{declcs}{intcalcCmp} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcCmp} encodes the comparison result as number: +% \begin{gather*} +% \opCmp(x,y) \Def +% \begin{cases} +% -1 & \text{if $x<y$}\\ +% 0 & \text{if $x=y$}\\ +% 1 & \text{if $x>y$} +% \end{cases} +% \end{gather*} +% These values can be distinguished by \cs{ifcase}: +%\begin{quote} +%\begin{verbatim} +%\ifcase\intcalcCmp{<x>}{<y>} +% $x=y$ +%\or +% $x>y$ +%\else +% $x<y$ +%\fi +%\end{verbatim} +%\end{quote} +% +% \subsubsection{\op{Inc}, \op{Dec}, \op{Add}, \op{Sub}} +% +% \begin{declcs}{intcalcInc} \M{x} +% \end{declcs} +% Macro \cs{intcalcInc} increments \meta{x} by one. +% \begin{gather*} +% \opInc(x) \Def x + 1 +% \end{gather*} +% +% \begin{declcs}{intcalcDec} \M{x} +% \end{declcs} +% Macro \cs{intcalcDec} decrements \meta{x} by one. +% \begin{gather*} +% \opDec(x) \Def x - 1 +% \end{gather*} +% +% \begin{declcs}{intcalcAdd} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcAdd} adds the two numbers. +% \begin{gather*} +% \opAdd(x, y) \Def x + y +% \end{gather*} +% +% \begin{declcs}{intcalcSub} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcSub} calculates the difference. +% \begin{gather*} +% \opSub(x, y) \Def x - y +% \end{gather*} +% +% \subsubsection{\op{Shl}, \op{Shr}} +% +% \begin{declcs}{intcalcShl} \M{x} +% \end{declcs} +% Macro \cs{intcalcShl} implements shifting to the left that +% means the number is multiplied by two. Overflow is possible. +% Negative values are not permitted. +% \begin{gather*} +% \opShl(x) \Def x*2\qquad\text{for $x\geq0$} +% \end{gather*} +% +% \begin{declcs}{intcalcShr} \M{x} +% \end{declcs} +% Macro \cs{intcalcShr} implements shifting to the right. +% That is equivalent to an integer division by two. +% Negative values are not permitted. +% \begin{gather*} +% \opShr(x) \Def \opInt(x/2)\qquad\text{for $x\geq0$} +% \end{gather*} +% +% \subsubsection{\op{Mul}, \op{Sqr}, \op{Fac}, \op{Pow}} +% +% \begin{declcs}{intcalcMul} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcMul} calculates the product of +% \meta{x} and \meta{y}. +% \begin{gather*} +% \opMul(x,y) \Def x*y +% \end{gather*} +% +% \begin{declcs}{intcalcSqr} \M{x} +% \end{declcs} +% Macro \cs{intcalcSqr} returns the square product. +% \begin{gather*} +% \opSqr(x) \Def x^2 +% \end{gather*} +% +% \begin{declcs}{intcalcFac} \M{x} +% \end{declcs} +% Macro \cs{intcalcFac} returns the factorial of \meta{x}. +% Negative numbers are not permitted. +% \begin{gather*} +% \opFac(x) \Def x!\qquad\text{for $x\geq0$} +% \end{gather*} +% ($0! = 1$) +% +% \begin{declcs}{intcalcPow} M{x} M{y} +% \end{declcs} +% Macro \cs{intcalcPow} calculates the value of \meta{x} to the +% power of \meta{y}. The error ``division by zero'' is thrown +% if \meta{x} is zero and \meta{y} is negative. +% permitted: +% \begin{gather*} +% \opPow(x,y) \Def +% \opInt(x^y)\qquad\text{for $x\neq0$ or $y\geq0$} +% \end{gather*} +% ($0^0 = 1$) +% +% \subsubsection{\op{Div}, \op{Mul}} +% +% \begin{declcs}{intcalcDiv} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcDiv} performs an integer division. +% Argument \meta{y} must not be zero. +% \begin{gather*} +% \opDiv(x,y) \Def \opInt(x/y)\qquad\text{for $y\neq0$} +% \end{gather*} +% +% \begin{declcs}{intcalcMod} \M{x} \M{y} +% \end{declcs} +% Macro \cs{intcalcMod} gets the remainder of the integer +% division. The sign follows the divisor \meta{y}. +% Argument \meta{y} must not be zero. +% \begin{gather*} +% \opMod(x,y) \Def x\mathrel{\%}y\qquad\text{for $y\neq0$} +% \end{gather*} +% The result ranges: +% \begin{gather*} +% -\vert y\vert < \opMod(x,y) \leq 0\qquad\text{for $y<0$}\\ +% 0 \leq \opMod(x,y) < y\qquad\text{for $y\geq0$} +% \end{gather*} +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Reload check and package identification} +% Reload check, especially if the package is not used with \LaTeX. +% \begin{macrocode} +\begingroup + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\let\expandafter\x\csname ver@intcalc.sty\endcsname + \ifcase 0% + \ifx\x\relax % plain + \else + \ifx\x\empty % LaTeX + \else + 1% + \fi + \fi + \else + \expandafter\ifx\csname PackageInfo\endcsname\relax + \def\x#1#2{% + \immediate\write-1{Package #1 Info: #2.}% + }% + \else + \def\x#1#2{\PackageInfo{#1}{#2, stopped}}% + \fi + \x{intcalc}{The package is already loaded}% + \endgroup + \expandafter\endinput + \fi +\endgroup +% \end{macrocode} +% Package identification: +% \begin{macrocode} +\begingroup + \catcode40 12 % ( + \catcode41 12 % ) + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode47 12 % / + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1#2#3[#4]{\endgroup + \immediate\write-1{Package: #3 #4}% + \xdef#1{#4}% + }% + \else + \def\x#1#2[#3]{\endgroup + #2[{#3}]% + \ifx#1\relax + \xdef#1{#3}% + \fi + }% + \fi +\expandafter\x\csname ver@intcalc.sty\endcsname +\ProvidesPackage{intcalc}% + [2007/09/09 v1.0 Expandable integer calculations (HO)] +% \end{macrocode} +% +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname IntCalc@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\IntCalc@AtEnd{% + \IntCalc@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{11}% : (letter!) +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{63}{14}% ? (comment!) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname IntCalc@TestMode\endcsname\relax +\else + \catcode63=9 % ? (ignore) +\fi +? \let\IntCalc@@TestMode\IntCalc@TestMode +% \end{macrocode} +% +% \subsection{Macros independent of \eTeX} +% +% \begin{macro}{\IntCalc@Space} +% \begin{macrocode} +\def\IntCalc@Space{ } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Abs}, \op{Sgn}} +% +% \begin{macro}{\IntCalc@Abs} +% \begin{macrocode} +\def\IntCalc@Abs#1#2!{% + \ifx#1-% + #2% + \else + #1#2% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@Sgn} +% \begin{macrocode} +\def\IntCalc@Sgn#1#2!{% + \ifx#1-% + -1% + \else + \ifx#10% + 0% + \else + 1% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}} +% +% \begin{macro}{\IntCalc@Min} +% \begin{macrocode} +\def\IntCalc@Min#1!#2!{% + \ifnum#1<#2 % + #1% + \else + #2% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@Max} +% \begin{macrocode} +\def\IntCalc@Max#1!#2!{% + \ifnum#1>#2 % + #1% + \else + #2% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@Cmp} +% \begin{macrocode} +\def\IntCalc@Cmp#1!#2!{% + \ifnum#1=#2 % + 0% + \else + \ifnum#1<#2 % + -% + \fi + 1% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Fac}} +% +% \begin{macro}{\IntCalc@Fac} +% It does not make much sense to calculate the +% faculty by an general algorithm. The allowed +% range of arguments is too low because of the +% limited integer domain. +% \begin{macrocode} +\def\IntCalc@Fac#1!{% + \ifcase#1 1% 0! + \or 1% 1! + \or 2% 2! + \or 6% 3! + \or 24% 4! + \or 120% 5! + \or 720% 6! + \or 5040% 7! + \or 40320% 8! + \or 362880% 9! + \or 3628800% 10! + \or 39916800% 11! + \or 479001600% 12! + \else + \ifnum#1<\z@ + 0\IntCalcError:FacNegative% + \else + 0\IntCalcError:FacOverflow% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Implementation based on \eTeX} +% +% Only \cs{numexpr} is used from \eTeX. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname numexpr\endcsname\relax +\else +% \end{macrocode} +% +% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}} +% +% \begin{macro}{\intcalcInv} +% \begin{macrocode} + \def\intcalcInv#1{% + \number-\the\numexpr#1\relax\IntCalc@Space + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcAbs} +% \begin{macrocode} + \def\intcalcAbs#1{% + \number\expandafter\IntCalc@Abs\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcSgn} +% \begin{macrocode} + \def\intcalcSgn#1{% + \number\expandafter\IntCalc@Sgn\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}} +% +% \begin{macro}{\intcalcMin} +% \begin{macrocode} + \def\intcalcMin#1#2{% + \number\expandafter\IntCalc@Min + \the\numexpr#1\expandafter!% + \the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcMax} +% \begin{macrocode} + \def\intcalcMax#1#2{% + \number\expandafter\IntCalc@Max + \the\numexpr#1\expandafter!% + \the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcCmp} +% \begin{macrocode} + \def\intcalcCmp#1#2{% + \number\expandafter\IntCalc@Cmp + \the\numexpr#1\expandafter!\the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Inc}, \op{Dec}} +% +% \begin{macro}{\intcalcInc} +% \begin{macrocode} + \def\intcalcInc#1{% + \the\numexpr#1+1\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcDec} +% \begin{macrocode} + \def\intcalcDec#1{% + \the\numexpr#1-1\relax + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Add}, \op{Sub}} +% +% \begin{macro}{\intcalcAdd} +% \begin{macrocode} + \def\intcalcAdd#1#2{% + \the\numexpr#1+(#2)\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcSub} +% \begin{macrocode} + \def\intcalcSub#1#2{% + \the\numexpr#1-(#2)\relax + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Shl}, \op{Shr}} +% +% \begin{macro}{\intcalcShl} +% \begin{macrocode} + \def\intcalcShl#1{% + \number\expandafter\IntCalc@Shl\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Shl} +% \begin{macrocode} + \def\IntCalc@Shl#1#2!{% + \ifx#1-% + 0\IntCalcError:ShlNegativeNumber% + \else + \the\numexpr#1#2*2\relax + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcShr} +% \begin{macrocode} + \def\intcalcShr#1{% + \number\expandafter\IntCalc@Shr\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Shr} +% \begin{macrocode} + \def\IntCalc@Shr#1#2!{% + \ifx#1-% + 0\IntCalcError:ShrNegativeNumber% + \else + \ifodd#1#2 % + \the\numexpr(#1#2-1)/2\relax + \else + \the\numexpr#1#2/2\relax + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Mul}, \op{Sqr}, \op{Fac}} +% +% \begin{macro}{\intcalcMul} +% \begin{macrocode} + \def\intcalcMul#1#2{% + \the\numexpr(#1)*(#2)\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcSqr} +% \begin{macrocode} + \def\intcalcSqr#1{% + \number\expandafter\IntCalc@Sqr\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Sqr} +% \begin{macrocode} + \def\IntCalc@Sqr#1!{% + \the\numexpr#1*#1\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcFac} +% \begin{macrocode} + \def\intcalcFac#1{% + \number\expandafter\IntCalc@Fac\the\numexpr#1! % + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Pow}} +% +% \begin{macro}{\intcalcPow} +% \begin{macrocode} + \def\intcalcPow#1#2{% + \number\expandafter\IntCalc@Pow + \the\numexpr#1\expandafter!% + \the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Pow} +% \begin{macrocode} + \def\IntCalc@Pow#1#2!#3#4!{% + \ifcase#3#4 % power = 0 + 1% + \or % power = 1 + #1#2% + \or % power = 2 + \the\numexpr#1#2*#1#2\relax + \else + \ifcase#1#2 % basis = 0, power <> 0 + 0% + \ifx#3-% power < 0 + 0\IntCalcError:DivisionByZero% + \fi + \or + 1% basis = 1 + \else + \ifnum#1#2=\m@ne % basis = -1 + \ifodd#3#4 % + -% + \fi + 1% + \else % |basis| > 1 + \ifx#3-% power < 0 + 0% + \else % power > 2 + \IntCalc@PowRec#1#2!#3#4!1!% + \fi + \fi + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@PowRec} +%\begin{quote} +%\begin{verbatim} +%Pow(b, p) { +% PowRec(b, p, 1) +%} +%PowRec(b, p, r) { +% if p == 1 then +% return r +% else +% ifodd p then +% return PowRec(b*b, (p-1)/2, r*b) % p div 2 = (p-1)/2 +% else +% return PowRec(b*b, (p-1)/2, r) +% fi +% fi +%} +%\end{verbatim} +%\end{quote} +% \begin{macrocode} + \def\IntCalc@PowRec#1!#2!#3!{% + \ifnum#2=\@ne + \the\numexpr#1*#3\relax + \else + \ifodd#2 % + \expandafter\IntCalc@PowRec + \the\numexpr#1*#1\expandafter!% + \the\numexpr(#2-1)/2\expandafter!% + \the\numexpr#1*#3\expandafter\expandafter\expandafter!% + \else + \expandafter\IntCalc@PowRec + \the\numexpr#1*#1\expandafter!% + \the\numexpr(#2-1)/2\expandafter!% + \number#3\expandafter\expandafter\expandafter!% + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Div}, \op{Mod}} +% +% \TeX's \cs{divide} truncates, +% \eTeX's \cs{numexpr} rounds the result of a division. +% The rounding method is called ``Symmetric Arithmetic Rounding'' +% or ``Round-Half-Up'' (``Kaufm\"annisches Runden'' in German): +% \begin{quote} +% | 1 = 3 divide 2 = 1.5 = numexpr 3/2 = 2|\\ +% |-1 = -3 divide 2 = -1.5 = numexpr -3/2 = -2| +% \end{quote} +% Macro \cs{intcalcDiv} follows \TeX\ and truncates. +% The calculation is done by the following formula: +% \begin{gather} +% \opDiv(X,Y) = (X - (Y-1)/2)/Y\qquad\text{for $X, Y > 0$} +% \end{gather} +% The operator `/' is \cs{numexpr}'s division. +% \begin{macro}{\intcalcDiv} +% \begin{macrocode} + \def\intcalcDiv#1#2{% + \number\expandafter\IntCalc@Div + \the\numexpr#1\expandafter!% + \the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Div} +% \begin{macrocode} + \def\IntCalc@Div#1!#2!{% + \ifcase#2 % + 0\IntCalcError:DivisionByZero% + \else + \ifcase#1 % + 0% + \else + \expandafter\IntCalc@@Div + \romannumeral 0% + \ifnum#1<\z@ + \expandafter-\number-#1% + \else + \expandafter+\number#1% + \fi + \expandafter!% + \romannumeral 0% + \ifnum#2<\z@ + \expandafter-\number-#2% + \else + \expandafter+\number#2% + \fi + !% + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@Div} +% \begin{macrocode} + \def\IntCalc@@Div#1#2!#3#4!{% + #1#3% + \the\numexpr(#2-(#4-1)/2)/#4\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcMod} +% \begin{macrocode} + \def\intcalcMod#1#2{% + \number\expandafter\IntCalc@Mod + \the\numexpr#1\expandafter!% + \the\numexpr#2! % + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Mod} +% \begin{macrocode} + \def\IntCalc@Mod#1!#2!{% + \ifcase#2 % + 0\IntCalcError:DivisionByZero% + \else + \ifcase#1 % + 0% + \else + \expandafter\IntCalc@@Mod + \romannumeral 0% + \ifnum#1<\z@ + \expandafter-\number-#1% + \else + \expandafter+\number#1% + \fi + \expandafter!% + \romannumeral 0% + \ifnum#2<\z@ + \expandafter-\number-#2% + \else + \expandafter+\number#2% + \fi + !% + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@Mod} +% \begin{macrocode} + \def\IntCalc@@Mod#1#2!#3#4!{% + \if#3+% + \if#1+% + \the\numexpr#2-\IntCalc@@Div+#2!+#4!*#4\relax + \else + \expandafter\IntCalc@ModX + \the\numexpr-#2+\IntCalc@@Div+#2!+#4!*#4!#4!% + \fi + \else + -% + \if#1+% + \expandafter\IntCalc@ModX + \the\numexpr-#2+\IntCalc@@Div+#2!+#4!*#4!#4!% + \else + \the\numexpr#2-\IntCalc@@Div+#2!+#4!*#4\relax + \fi + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ModX} +% \begin{macrocode} + \def\IntCalc@ModX#1!#2!{% + \ifcase#1 % + 0% + \else + \the\numexpr#1+#2\relax + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + \IntCalc@AtEnd + \expandafter\endinput +\fi +% \end{macrocode} +% +% \subsection{Implementation without \eTeX} +% +% \subsubsection{\op{Inv}, \op{Abs}, \op{Sgn}} +% +% \begin{macro}{\intcalcInv} +% \begin{macrocode} +\def\intcalcInv#1{% + \number\expandafter\IntCalc@Inv\number-#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Inv} +% \begin{macrocode} +\def\IntCalc@Inv#1!{#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcAbs} +% \begin{macrocode} +\def\intcalcAbs#1{% + \number\expandafter\IntCalc@Abs\number#1! % +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcSgn} +% \begin{macrocode} +\def\intcalcSgn#1{% + \number\expandafter\IntCalc@Sgn\number#1! % +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Min}, \op{Max}, \op{Cmp}} +% +% \begin{macro}{\intcalcMin} +% \begin{macrocode} +\def\intcalcMin#1#2{% + \number\expandafter\IntCalc@Min + \number\number#1\expandafter!\number#2! % +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcMax} +% \begin{macrocode} +\def\intcalcMax#1#2{% + \number\expandafter\IntCalc@Max + \number\number#1\expandafter!\number#2! % +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcCmp} +% \begin{macrocode} +\def\intcalcCmp#1#2{% + \number\expandafter\IntCalc@Cmp + \number\number#1\expandafter!\number#2! % +}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Inc}, \op{Dec}} +% +% \begin{macro}{\intcalcInc} +% \begin{macrocode} +\def\intcalcInc#1{% + \number\expandafter\IntCalc@IncSwitch\number#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@IncSwitch} +% \begin{macrocode} +\def\IntCalc@IncSwitch#1#2!{% + \ifx#1-% + -% + \csname IntCalc@Empty% + \IntCalc@Dec#2!% + \else + \csname IntCalc@Empty% + \IntCalc@Inc#1#2!% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\intcalcDec} +% \begin{macrocode} +\def\intcalcDec#1{% + \number\expandafter\IntCalc@DecSwitch\number#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DecSwitch} +% \begin{macrocode} +\def\IntCalc@DecSwitch#1#2!{% + \ifx#1-% + -% + \csname IntCalc@Empty% + \expandafter\IntCalc@Inc#2!% + \else + \ifx#10% + -1% + \else + \csname IntCalc@Empty% + \IntCalc@Dec#1#2!% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@Inc} +% \begin{macrocode} +\def\IntCalc@Inc#1#2{% + \ifx#2!% + \csname IntCalc@IncDigit#1\endcsname1% + \else + \csname IntCalc@IncDigit#1% + \expandafter\IntCalc@Inc\expandafter#2% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@IncDigit[0-8]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2{% + \expandafter\def\csname IntCalc@IncDigit#1\endcsname##1{% + \endcsname + 0% + \ifcase##1 % + #1% + \else + #2% + \fi + }% +} +\IntCalc@Temp 01 +\IntCalc@Temp 12 +\IntCalc@Temp 23 +\IntCalc@Temp 34 +\IntCalc@Temp 45 +\IntCalc@Temp 56 +\IntCalc@Temp 67 +\IntCalc@Temp 78 +\IntCalc@Temp 89 +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@IncDigit9} +% \begin{macrocode} +\expandafter\def\csname IntCalc@IncDigit9\endcsname#1{% + \expandafter\endcsname + \ifcase#1 % + 09% + \else + 10% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@Dec} +% \begin{macrocode} +\def\IntCalc@Dec#1#2{% + \ifx#2!% + \csname IntCalc@DecDigit#1\endcsname1% + \else + \csname IntCalc@DecDigit#1% + \expandafter\IntCalc@Dec\expandafter#2% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DecDigit[1-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2{% + \expandafter\def\csname IntCalc@DecDigit#1\endcsname##1{% + \endcsname + 0% + \ifcase##1 % + #1% + \else + #2% + \fi + }% +} +\IntCalc@Temp 98 +\IntCalc@Temp 87 +\IntCalc@Temp 76 +\IntCalc@Temp 65 +\IntCalc@Temp 54 +\IntCalc@Temp 43 +\IntCalc@Temp 32 +\IntCalc@Temp 21 +\IntCalc@Temp 10 +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DecDigit0} +% \begin{macrocode} +\expandafter\def\csname IntCalc@DecDigit0\endcsname#1{% + \expandafter\endcsname + \ifcase#1 % + 00% + \else + 19% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Add}, \op{Sub}} +% +% \begin{macro}{\intcalcAdd} +% \begin{macrocode} +\def\intcalcAdd#1#2{% + \number + \expandafter\IntCalc@AddSwitch + \number\number#1\expandafter!% + \number#2!% + \IntCalc@Space +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\intcalcSub} +% \begin{macrocode} +\def\intcalcSub#1#2{% + \number + \expandafter\IntCalc@AddSwitch + \number\number#1\expandafter!% + \number-\number#2!% + \IntCalc@Space +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@AddSwitch} +% Decision table for \cs{IntCalc@AddSwitch}. +% By using less than zero operations, the sign +% of negative numbers can be removed by a simple \cs{IntCalc@Gobble} +% instead of the more expensive |\number-|. +% \begin{quote} +% \begin{tabular}[t]{@{}|l|l|l|l|l|@{}} +% \hline +% $x<0$ & $y<0$ & $ x< y$ & $-$ & $\opAdd(-x,-y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opAdd(-y,-x)$\\ +% \cline{2-5} +% & else & $-x> y$ & $-$ & $\opSub(-x, y)$\\ +% \cline{3-5} +% & & else & $+$ & $\opSub( y,-x)$\\ +% \hline +% else & $y<0$ & $ x>-y$ & $+$ & $\opSub( x,-y)$\\ +% \cline{3-5} +% & & else & $-$ & $\opSub(-y, x)$\\ +% \cline{2-5} +% & else & $ x> y$ & $+$ & $\opAdd( x, y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opAdd( y, x)$\\ +% \hline +% \end{tabular} +% \end{quote} +% \begin{macrocode} +\def\IntCalc@AddSwitch#1!#2!{% + \ifnum#1<\z@ + \ifnum#2<\z@ + -% + \ifnum#1<#2 % + \expandafter\IntCalc@Add\number-#1\expandafter!% + \IntCalc@Gobble#2!% + \else + \expandafter\IntCalc@Add\number-#2\expandafter!% + \IntCalc@Gobble#1!% + \fi + \else + \ifnum-#1>#2 % + -% + \expandafter\IntCalc@Sub\IntCalc@Gobble#1!#2!% + \else + \expandafter\IntCalc@Sub\number#2\expandafter!% + \IntCalc@Gobble#1!% + \fi + \fi + \else + \ifnum#2<\z@ + \ifnum#1>-#2 % + \expandafter\IntCalc@Sub\number#1\expandafter!% + \IntCalc@Gobble#2!% + \else + -% + \expandafter\IntCalc@Sub\IntCalc@Gobble#2!#1!% + \fi + \else + \ifnum#1>#2 % + \IntCalc@Add#1!#2!% + \else + \IntCalc@Add#2!#1!% + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Add} +% \begin{macrocode} +\def\IntCalc@Add#1!#2!{% + \ifcase#2 % + #1% + \else + \IntCalc@@Add#1!#2!000000000\IntCalc@Space + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Sub} +% \begin{macrocode} +\def\IntCalc@Sub#1!#2!{% + \ifnum#1=#2 % + 0% + \else + \IntCalc@@Sub#1!#2!000000000\IntCalc@Space + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@Add} +% \begin{macrocode} +\def\IntCalc@@Add#1!#2#3!{% + \ifx\IntCalc@Empty#3\IntCalc@Empty + \@ReturnAfterElseFi{% + \IntCalc@@@Add!!#1!#2% + }% + \else + \@ReturnAfterFi{% + \IntCalc@@Add#1!#3!#2% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@Sub} +% \begin{macrocode} +\def\IntCalc@@Sub#1!#2#3!{% + \ifx\IntCalc@Empty#3\IntCalc@Empty + \@ReturnAfterElseFi{% + \IntCalc@@@Sub!!#1!#2% + }% + \else + \@ReturnAfterFi{% + \IntCalc@@Sub#1!#3!#2% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@@@Add} +% \begin{macrocode} +\def\IntCalc@@@Add#1!#2!#3#4!#5{% + \ifx\IntCalc@Empty#4\IntCalc@Empty + \csname IntCalc@Empty% + \@ReturnAfterElseFi{% + \IntCalc@ProcessAdd#1#3!#5#2% + }% + \else + \@ReturnAfterFi{% + \IntCalc@@@Add#1#3!#5#2!#4!% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@@Sub} +% \begin{macrocode} +\def\IntCalc@@@Sub#1!#2!#3#4!#5{% + \ifx\IntCalc@Empty#4\IntCalc@Empty + \csname IntCalc@Gobble% + \@ReturnAfterElseFi{% + \IntCalc@ProcessSub#1#3!#5#2% + }% + \else + \@ReturnAfterFi{% + \IntCalc@@@Sub#1#3!#5#2!#4!% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@ProcessAdd} +% \begin{macrocode} +\def\IntCalc@ProcessAdd#1#2!#3#4{% + \ifx\IntCalc@Empty#2\IntCalc@Empty + \csname IntCalc@AddDigit#1\endcsname#3% + \romannumeral0#4% + \else + \csname IntCalc@AddDigit#1\csname IntCalc@DigitCarry#3% + \@ReturnAfterFi{% + \IntCalc@ProcessAdd#2!#4% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ProcessSub} +% \begin{macrocode} +\def\IntCalc@ProcessSub#1#2!#3#4{% + \ifx\IntCalc@Empty#2\IntCalc@Empty + \csname IntCalc@SubDigit#1\endcsname#3% + \romannumeral0#4% + \else + \csname IntCalc@SubDigit#1\csname IntCalc@DigitCarry#3% + \@ReturnAfterFi{% + \IntCalc@ProcessSub#2!#4% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DigitCarry[0-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2{% + \expandafter\def\csname IntCalc@DigitCarry#1\endcsname##1{% + \ifcase##1 % + \endcsname#1% + \else + \endcsname#2% + \fi + }% +} +\IntCalc@Temp 01 +\IntCalc@Temp 12 +\IntCalc@Temp 23 +\IntCalc@Temp 34 +\IntCalc@Temp 45 +\IntCalc@Temp 56 +\IntCalc@Temp 67 +\IntCalc@Temp 78 +\IntCalc@Temp 89 +\IntCalc@Temp 9{{10}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@AddDigit0} +% \begin{macrocode} +\expandafter\def\csname IntCalc@AddDigit0\endcsname#1{% + \ifnum#1>9 % + \endcsname10% + \else + \endcsname0#1% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@AddDigit[1-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2#3{% + \expandafter\def\csname IntCalc@AddDigit#1\endcsname##1{% + \ifnum##1>#2 % + \endcsname 1% + \else + \endcsname 0% + \fi + \ifcase##1 #1% 0 + #3% + \else #1% 10 + \fi + }% +} +\IntCalc@Temp 18{% + \or 2% 1 + \or 3% 2 + \or 4% 3 + \or 5% 4 + \or 6% 5 + \or 7% 6 + \or 8% 7 + \or 9% 8 + \or 0% 9 +}% +\IntCalc@Temp 27{% + \or 3% 1 + \or 4% 2 + \or 5% 3 + \or 6% 4 + \or 7% 5 + \or 8% 6 + \or 9% 7 + \or 0% 8 + \or 1% 9 +}% +\IntCalc@Temp 36{% + \or 4% 1 + \or 5% 2 + \or 6% 3 + \or 7% 4 + \or 8% 5 + \or 9% 6 + \or 0% 7 + \or 1% 8 + \or 2% 9 +}% +\IntCalc@Temp 45{% + \or 5% 1 + \or 6% 2 + \or 7% 3 + \or 8% 4 + \or 9% 5 + \or 0% 6 + \or 1% 7 + \or 2% 8 + \or 3% 9 +}% +\IntCalc@Temp 54{% + \or 6% 1 + \or 7% 2 + \or 8% 3 + \or 9% 4 + \or 0% 5 + \or 1% 6 + \or 2% 7 + \or 3% 8 + \or 4% 9 +}% +\IntCalc@Temp 63{% + \or 7% 1 + \or 8% 2 + \or 9% 3 + \or 0% 4 + \or 1% 5 + \or 2% 6 + \or 3% 7 + \or 4% 8 + \or 5% 9 +}% +\IntCalc@Temp 72{% + \or 8% 1 + \or 9% 2 + \or 0% 3 + \or 1% 4 + \or 2% 5 + \or 3% 6 + \or 4% 7 + \or 5% 8 + \or 6% 9 +}% +\IntCalc@Temp 81{% + \or 9% 1 + \or 0% 2 + \or 1% 3 + \or 2% 4 + \or 3% 5 + \or 4% 6 + \or 5% 7 + \or 6% 8 + \or 7% 9 +}% +\IntCalc@Temp 90{% + \or 0% 1 + \or 1% 2 + \or 2% 3 + \or 3% 4 + \or 4% 5 + \or 5% 6 + \or 6% 7 + \or 7% 8 + \or 8% 9 +}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@SubDigit[0-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2{% + \expandafter\def\csname IntCalc@SubDigit#1\endcsname##1{% + \ifnum##1>#1 % + \endcsname 1% + \else + \endcsname 0% + \fi + \ifcase##1 #1% 0 + #2% + \else #1% 10 + \fi + }% +} +\IntCalc@Temp 0{% + \or 9% 1 + \or 8% 2 + \or 7% 3 + \or 6% 4 + \or 5% 5 + \or 4% 6 + \or 3% 7 + \or 2% 8 + \or 1% 9 +} +\IntCalc@Temp 1{% + \or 0% 1 + \or 9% 2 + \or 8% 3 + \or 7% 4 + \or 6% 5 + \or 5% 6 + \or 4% 7 + \or 3% 8 + \or 2% 9 +} +\IntCalc@Temp 2{% + \or 1% 1 + \or 0% 2 + \or 9% 3 + \or 8% 4 + \or 7% 5 + \or 6% 6 + \or 5% 7 + \or 4% 8 + \or 3% 9 +} +\IntCalc@Temp 3{% + \or 2% 1 + \or 1% 2 + \or 0% 3 + \or 9% 4 + \or 8% 5 + \or 7% 6 + \or 6% 7 + \or 5% 8 + \or 4% 9 +} +\IntCalc@Temp 4{% + \or 3% 1 + \or 2% 2 + \or 1% 3 + \or 0% 4 + \or 9% 5 + \or 8% 6 + \or 7% 7 + \or 6% 8 + \or 5% 9 +} +\IntCalc@Temp 5{% + \or 4% 1 + \or 3% 2 + \or 2% 3 + \or 1% 4 + \or 0% 5 + \or 9% 6 + \or 8% 7 + \or 7% 8 + \or 6% 9 +} +\IntCalc@Temp 6{% + \or 5% 1 + \or 4% 2 + \or 3% 3 + \or 2% 4 + \or 1% 5 + \or 0% 6 + \or 9% 7 + \or 8% 8 + \or 7% 9 +} +\IntCalc@Temp 7{% + \or 6% 1 + \or 5% 2 + \or 4% 3 + \or 3% 4 + \or 2% 5 + \or 1% 6 + \or 0% 7 + \or 9% 8 + \or 8% 9 +} +\IntCalc@Temp 8{% + \or 7% 1 + \or 6% 2 + \or 5% 3 + \or 4% 4 + \or 3% 5 + \or 2% 6 + \or 1% 7 + \or 0% 8 + \or 9% 9 +} +\IntCalc@Temp 9{% + \or 8% 1 + \or 7% 2 + \or 6% 3 + \or 5% 4 + \or 4% 5 + \or 3% 6 + \or 2% 7 + \or 1% 8 + \or 0% 9 +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Shl}, \op{Shr}} +% +% \begin{macro}{\intcalcShl} +% \begin{macrocode} +\def\intcalcShl#1{% + \number\expandafter\IntCalc@ShlSwitch\number#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ShlSwitch} +% \begin{macrocode} +\def\IntCalc@ShlSwitch#1!{% + \ifnum#1<\z@ + 0\IntCalcError:ShlNegativeNumber% + \else + \csname IntCalc@Empty% + \IntCalc@Shl#1!% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCal@ShlDigit} +% \begin{macrocode} +\def\IntCalc@Shl#1#2{% + \ifx#2!% + \csname IntCalc@ShlDigit#1\endcsname0% + \else + \csname IntCalc@ShlDigit#1% + \@ReturnAfterFi{% + \IntCalc@Shl#2% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ShlDigit0} +% \begin{macrocode} +\expandafter\def\csname IntCalc@ShlDigit0\endcsname{% + \endcsname0% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ShlDigit[1-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2#3#4#5{% + \expandafter\def\csname IntCalc@ShlDigit#1\endcsname##1{% + \expandafter\endcsname + \ifcase##1 % + #2#3% + \else + #4#5% + \fi + }% +} +\IntCalc@Temp 10203 +\IntCalc@Temp 20405 +\IntCalc@Temp 30607 +\IntCalc@Temp 40809 +\IntCalc@Temp 51011 +\IntCalc@Temp 61213 +\IntCalc@Temp 71415 +\IntCalc@Temp 81617 +\IntCalc@Temp 91819 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcShr} +% \begin{macrocode} +\def\intcalcShr#1{% + \number\expandafter\IntCalc@ShrSwitch\number#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ShrSwitch} +% \begin{macrocode} +\def\IntCalc@ShrSwitch#1!{% + \ifnum#1<\z@ + 0\IntCalcError:ShrNegativeNumber% + \else + \IntCalc@Shr#1!% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Shr} +% \begin{macrocode} +\def\IntCalc@Shr#1#2{% + \IntCalc@ShrDigit#1!% + \ifx#2!% + \else + \@ReturnAfterFi{% + \ifodd#1 % + \@ReturnAfterElseFi{% + \IntCalc@Shr{1#2}% + }% + \else + \expandafter\IntCalc@Shr\expandafter#2% + \fi + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\IntCalc@ShrDigit#1!{% + \ifcase#1 0% 0 + \or 0% 1 + \or 1% 2 + \or 1% 3 + \or 2% 4 + \or 2% 5 + \or 3% 6 + \or 3% 7 + \or 4% 8 + \or 4% 9 + \or 5% 10 + \or 5% 11 + \or 6% 12 + \or 6% 13 + \or 7% 14 + \or 7% 15 + \or 8% 16 + \or 8% 17 + \or 9% 18 + \or 9% 19 + \fi +} +% \end{macrocode} +% +% \subsubsection{\cs{IntCalc@Tim}} +% +% \begin{macro}{\IntCalc@Tim} +% Macro \cs{IntCalc@Tim} implements +% ``Number \emph{tim}es digit''. +% \begin{macrocode} +\def\IntCalc@Tim#1#2{% + \number + \ifcase#2 % 0 + 0% + \or % 1 + #1% + \else % 2-9 + \csname IntCalc@Empty% + \IntCalc@ProcessTim#2#1!% + \fi + \IntCalc@Space +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ProcessTim} +% \begin{macrocode} +\def\IntCalc@ProcessTim#1#2#3{% + \ifx#3!% + \csname IntCalc@TimDigit#2\endcsname#10% + \else + \csname IntCalc@TimDigit#2\csname IntCalc@Param#1% + \@ReturnAfterFi{% + \IntCalc@ProcessTim#1#3% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Param[0-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1{% + \expandafter\def\csname IntCalc@Param#1\endcsname{% + \endcsname#1% + }% +} +\IntCalc@Temp 0% +\IntCalc@Temp 1% +\IntCalc@Temp 2% +\IntCalc@Temp 3% +\IntCalc@Temp 4% +\IntCalc@Temp 5% +\IntCalc@Temp 6% +\IntCalc@Temp 7% +\IntCalc@Temp 8% +\IntCalc@Temp 9% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@TimDigit0} +% \begin{macrocode} +\expandafter\def\csname IntCalc@TimDigit0\endcsname#1#2{% + \endcsname + 0#2% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@TimDigit1} +% \begin{macrocode} +\expandafter\def\csname IntCalc@TimDigit1\endcsname#1#2{% + \ifcase#2 % + \endcsname 0#1% + \else + \csname IntCalc@AddDigit#1\endcsname #2% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@TimDigit[2-9]} +% \begin{macrocode} +\def\IntCalc@Temp#1#2{% + \expandafter\def\csname IntCalc@TimDigit#1\endcsname##1{% + \expandafter\IntCalc@TimDigitCarry + \number + \ifcase##1 0% 0 + #2% + \fi + !% + }% +} +\IntCalc@Temp 2{% + \or 2% 1 + \or 4% 2 + \or 6% 3 + \or 8% 4 + \or 10% 5 + \or 12% 6 + \or 14% 7 + \or 16% 8 + \or 18% 9 +} +\IntCalc@Temp 3{% + \or 3% 1 + \or 6% 2 + \or 9% 3 + \or 12% 4 + \or 15% 5 + \or 18% 6 + \or 21% 7 + \or 24% 8 + \or 27% 9 +} +\IntCalc@Temp 4{% + \or 4% 1 + \or 8% 2 + \or 12% 3 + \or 16% 4 + \or 20% 5 + \or 24% 6 + \or 28% 7 + \or 32% 8 + \or 36% 9 +} +\IntCalc@Temp 5{% + \or 5% 1 + \or 10% 2 + \or 15% 3 + \or 20% 4 + \or 25% 5 + \or 30% 6 + \or 35% 7 + \or 40% 8 + \or 45% 9 +} +\IntCalc@Temp 6{% + \or 6% 1 + \or 12% 2 + \or 18% 3 + \or 24% 4 + \or 30% 5 + \or 36% 6 + \or 42% 7 + \or 48% 8 + \or 54% 9 +} +\IntCalc@Temp 7{% + \or 7% 1 + \or 14% 2 + \or 21% 3 + \or 28% 4 + \or 35% 5 + \or 42% 6 + \or 49% 7 + \or 56% 8 + \or 63% 9 +} +\IntCalc@Temp 8{% + \or 8% 1 + \or 16% 2 + \or 24% 3 + \or 32% 4 + \or 40% 5 + \or 48% 6 + \or 56% 7 + \or 64% 8 + \or 72% 9 +} +\IntCalc@Temp 9{% + \or 9% 1 + \or 18% 2 + \or 27% 3 + \or 36% 4 + \or 45% 5 + \or 54% 6 + \or 63% 7 + \or 72% 8 + \or 81% 9 +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@TimDigitCarry} +% \begin{macrocode} +\def\IntCalc@TimDigitCarry#1!{% + \ifnum#1<10 % + \csname IntCalc@AddDigit#1\expandafter\endcsname + \else + \@ReturnAfterFi{% + \IntCalc@@TimDigitCarry#1!% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@TimDigitCarry} +% \begin{macrocode} +\def\IntCalc@@TimDigitCarry#1#2!#3{% + \csname IntCalc@DigitCarry#1% + \csname IntCalc@AddDigit#2\endcsname #3% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Mul}} +% +% \begin{macro}{\intcalcMul} +% \begin{macrocode} +\def\intcalcMul#1#2{% + \number + \expandafter\IntCalc@MulSwitch + \number\number#1\expandafter!% + \number#2!% + \IntCalc@Space +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IntCalc@MulSwitch} +% Decision table for \cs{IntCalc@MulSwitch}. +% \begin{quote} +% \begin{tabular}[t]{@{}|l|l|l|l|l|@{}} +% \hline +% $x<0$ & $y<0$ & $ x< y$ & $+$ & $\opMul(-x,-y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opMul(-y,-x)$\\ +% \cline{2-5} +% & else & $-x> y$ & $-$ & $\opMul(-x, y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opMul( y,-x)$\\ +% \hline +% else & $y<0$ & $ x>-y$ & $-$ & $\opMul( x,-y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opMul(-y, x)$\\ +% \cline{2-5} +% & else & $ x> y$ & $+$ & $\opMul( x, y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opMul( y, x)$\\ +% \hline +% \end{tabular} +% \end{quote} +% \begin{macrocode} +\def\IntCalc@MulSwitch#1!#2!{% + \ifnum#1<\z@ + \ifnum#2<\z@ + \ifnum#1<#2 % + \expandafter\IntCalc@Mul\number-#1\expandafter!% + \IntCalc@Gobble#2!% + \else + \expandafter\IntCalc@Mul\number-#2\expandafter!% + \IntCalc@Gobble#1!% + \fi + \else + -% + \ifnum-#1>#2 % + \expandafter\IntCalc@Mul\IntCalc@Gobble#1!#2!% + \else + \expandafter\IntCalc@Mul\number#2\expandafter!% + \IntCalc@Gobble#1!% + \fi + \fi + \else + \ifnum#2<\z@ + -% + \ifnum#1>-#2 % + \expandafter\IntCalc@Mul\number#1\expandafter!% + \IntCalc@Gobble#2!% + \else + \expandafter\IntCalc@Mul\IntCalc@Gobble#2!#1!% + \fi + \else + \ifnum#1>#2 % + \IntCalc@Mul#1!#2!% + \else + \IntCalc@Mul#2!#1!% + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Mul} +% \begin{macrocode} +\def\IntCalc@Mul#1!#2!{% + \ifcase#2 % + 0% + \or + #1% + \or + \csname IntCalc@Empty% + \expandafter\IntCalc@Shl#1!% + \else + \ifnum#2<10 % + \IntCalc@Tim{#1}#2% + \else + \IntCalc@ProcessMul!#2!#1!% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Mul} +% \begin{macrocode} +\def\IntCalc@ProcessMul#1!#2#3!#4!{% + \ifx\IntCalc@Empty#3\IntCalc@Empty + \expandafter\IntCalc@Add\number + #10\expandafter\expandafter\expandafter!% + \IntCalc@Tim{#4}#2!% + \else + \ifx\IntCalc@Empty#1\IntCalc@Empty + \expandafter\expandafter\expandafter\IntCalc@ProcessMul + \IntCalc@Tim{#4}#2!% + #3!#4!% + \else + \expandafter\IntCalc@ProcessMul\number + \expandafter\IntCalc@Add\number% + #10\expandafter\expandafter\expandafter!% + \IntCalc@Tim{#4}#2!!% + #3!#4!% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Sqr}, \op{Fac}} +% +% \begin{macro}{\intcalcSqr} +% \begin{macrocode} +\def\intcalcSqr#1{% + \number\expandafter\IntCalc@Sqr\number#1! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Sqr} +% \begin{macrocode} +\def\IntCalc@Sqr#1#2!{% + \ifx#1-% + \IntCalc@Mul#2!#2!% + \else + \IntCalc@Mul#1#2!#1#2!% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intcalcFac} +% \begin{macrocode} +\def\intcalcFac#1{% + \number\expandafter\IntCalc@Fac\number#1! % +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Pow}} +% +% \begin{macro}{\intcalcPow} +% \begin{macrocode} +\def\intcalcPow#1#2{% + \number\expandafter\IntCalc@Pow + \number\number#1\expandafter!% + \number#2! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Pow} +% \begin{macrocode} +\def\IntCalc@Pow#1#2!#3#4!{% + \ifcase#3#4 % power = 0 + 1% + \or % power = 1 + #1#2% + \or % power = 2 + \ifx#1-% + \IntCalc@Mul#2!#2!% + \else + \IntCalc@Mul#1#2!#1#2!% + \fi + \else + \ifcase#1#2 % basis = 0, power <> 0 + 0% + \ifx#3-% power < 0 + 0\IntCalcError:DivisionByZero% + \fi + \or + 1% basis = 1 + \else + \ifnum#1#2=\m@ne % basis = -1 + \ifodd#3#4 % + -% + \fi + 1% + \else % |basis| > 1 + \ifx#3-% power < 0 + 0% + \else % power > 2 + \ifx#1-% basis < 0 + \ifodd#3#4 % + -% + \fi + \IntCalc@PowRec#2!#3#4!1!% + \else + \IntCalc@PowRec#1#2!#3#4!1!% + \fi + \fi + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@PowRec} +%\begin{quote} +%\begin{verbatim} +%Pow(b, p) { +% PowRec(b, p, 1) +%} +%PowRec(b, p, r) { +% if p == 1 then +% return r +% else +% ifodd p then +% return PowRec(b*b, p div 2, r*b) % p div 2 = (p-1)/2 +% else +% return PowRec(b*b, p div 2, r) +% fi +% fi +%} +%\end{verbatim} +%\end{quote} +% \begin{macrocode} +\def\IntCalc@PowRec#1!#2!#3!{% + \ifnum#2=\@ne + \ifnum#1>#3 % + \IntCalc@Mul#1!#3!% + \else + \IntCalc@Mul#3!#1!% + \fi + \else + \expandafter\IntCalc@PowRec + \number\IntCalc@Mul#1!#1!\expandafter!% + \number\intcalcShr{#2}\expandafter!% + \number + \ifodd#2 % + \ifnum#1>#3 % + \IntCalc@Mul#1!#3!% + \else + \IntCalc@Mul#3!#1!% + \fi + \else + #3% + \fi + \expandafter!% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Div}} +% +% \begin{macro}{\intcalcDiv} +% \begin{macrocode} +\def\intcalcDiv#1#2{% + \number\expandafter\IntCalc@Div + \number\number#1\expandafter!% + \number#2! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Div} +% \begin{macrocode} +\def\IntCalc@Div#1!#2!{% + \ifcase#2 % + 0\IntCalcError:DivisionByZero% + \else + \ifcase#1 % + 0% + \else + \expandafter\IntCalc@DivSwitch + \number#1\expandafter!% + \number#2!% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DivSwitch} +% Decision table for \cs{IntCalc@DivSwitch}. +% \begin{quote} +% \begin{tabular}[t]{@{}|l|l|l|l|l|@{}} +% \hline +% $x<0$ & $y<0$ & $ x< y$ & $+$ & $\opDiv(-x,-y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opDiv(-y,-x)$\\ +% \cline{2-5} +% & else & $-x> y$ & $-$ & $\opDiv(-x, y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opDiv( y,-x)$\\ +% \hline +% else & $y<0$ & $ x>-y$ & $-$ & $\opDiv( x,-y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opDiv(-y, x)$\\ +% \cline{2-5} +% & else & $ x> y$ & $+$ & $\opDiv( x, y)$\\ +% \cline{3-3}\cline{5-5} +% & & else & & $\opDiv( y, x)$\\ +% \hline +% \end{tabular} +% \end{quote} +% \begin{macrocode} +\def\IntCalc@DivSwitch#1!#2!{% + \ifnum#1<\z@ + \ifnum#2<\z@ + \expandafter\IntCalc@@Div\number-#1\expandafter!% + \IntCalc@Gobble#2!% + \else + -% + \expandafter\IntCalc@@Div\IntCalc@Gobble#1!#2!% + \fi + \else + \ifnum#2<\z@ + -% + \expandafter\IntCalc@@Div\number#1\expandafter!% + \IntCalc@Gobble#2!% + \else + \IntCalc@@Div#1!#2!% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@Div} +% \begin{macrocode} +\def\IntCalc@@Div#1!#2!{% + \ifnum#1>#2 % + \ifcase#2 % 0 already catched +? \IntCalcError:ThisCannotHappen% + \or % 1 + #1% + \or % 2 + \IntCalc@Shr#1!% + \else + \IntCalc@DivStart!#1!#2!#2!% + \fi + \else + \ifnum#1=#2 % + 1% + \else + 0% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@DivStart} +% \begin{macrocode} +\def\IntCalc@DivStart#1!#2#3!#4#5{% + \ifx#5!% + \@ReturnAfterElseFi{% + \IntCalc@DivStartI{#1#2}#3=!% + }% + \else + \@ReturnAfterFi{% + \IntCalc@DivStart{#1#2}!#3!#5% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@StartI} +% \begin{macrocode} +\def\IntCalc@DivStartI#1!#2!{% + \expandafter\IntCalc@DivStartII + \number#2\expandafter\expandafter\expandafter!% + \intcalcShl{#2}!% + #1!% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@StartII} +% \begin{macrocode} +\def\IntCalc@DivStartII#1!#2!{% + \expandafter\IntCalc@DivStartIII + \number#1\expandafter!% + \number#2\expandafter\expandafter\expandafter!% + \intcalcShl{#2}!% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@StartIII} +% \begin{macrocode} +\def\IntCalc@DivStartIII#1!#2!#3!{% + \expandafter\IntCalc@DivStartIV + \number#1\expandafter!% + \number#2\expandafter!% + \number#3\expandafter!% + \number\IntCalc@Add#3!#2!\expandafter\expandafter\expandafter!% + \intcalcShl{#3}!% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@StartIV} +% \begin{macrocode} +\def\IntCalc@DivStartIV#1!#2!#3!#4!#5!#6!{% + \IntCalc@ProcessDiv#6!#1!#2!#3!#4!#5!/% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ProcessDiv} +% \begin{macrocode} +\def\IntCalc@ProcessDiv#1#2#3!#4!#5!#6!#7!#8!#9/{% + #9% + \ifnum#1<#4 % 0 + 0% + \ifx#2=% + \else + \IntCalc@ProcessDiv{#1#2}#3!#4!#5!#6!#7!#8!% + \fi + \else % 1-9 + \ifnum#1<#5 % 1 + 1% + \ifx#2=% + \else + \expandafter\IntCalc@ProcessDiv\expandafter{% + \number\IntCalc@Sub#1!#4!% + #2% + }#3!#4!#5!#6!#7!#8!% + \fi + \else % 2-9 + \ifnum#1<#7 % 2 3 4 5 + \ifnum#1<#6 % 2 3 + \@ReturnAfterElseFi{% + \expandafter\IntCalc@@ProcessDiv + \number\IntCalc@Sub#1!#5!!% + 23% + }% + \else % 4 5 + \@ReturnAfterFi{% + \expandafter\IntCalc@@ProcessDiv + \number\IntCalc@Sub#1!#6!!% + 45% + }% + \fi + #2#3!#4!#5!#6!#7!#8!% + \else % 6 7 8 9 + \ifnum#1<#8 % 6 7 + \@ReturnAfterElseFi{% + \expandafter\IntCalc@@ProcessDiv + \number\IntCalc@Sub#1!#7!!% + 67% + }% + \else % 8 9 + \@ReturnAfterFi{% + \expandafter\IntCalc@@ProcessDiv + \number\IntCalc@Sub#1!#8!!% + 89% + }% + \fi + #2#3!#4!#5!#6!#7!#8!% + \fi + \fi + \fi + \ifx#2=% + \expandafter\IntCalc@Gobble + \fi + /% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@@ProcessDiv} +% \begin{macrocode} +\def\IntCalc@@ProcessDiv#1!#2#3#4#5!#6!{% + \ifnum#1<#6 % + #2% + \@ReturnAfterElseFi{% + \ifx#4=% + \expandafter\IntCalc@CleanupIV + \else + \@ReturnAfterFi{% + \IntCalc@ProcessDiv{#1#4}#5!#6!% + }% + \fi + }% + \else + #3% + \@ReturnAfterFi{% + \ifx#4=% + \expandafter\IntCalc@CleanupIV + \else + \@ReturnAfterFi{% + \expandafter\IntCalc@ProcessDiv\expandafter{% + \number\IntCalc@Sub#1!#6!\IntCalc@Space + #4% + }#5!#6!% + }% + \fi + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@CleanupIV} +% \begin{macrocode} +\def\IntCalc@CleanupIV#1!#2!#3!#4!{} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\op{Mod}} +% +% \begin{macro}{\intcalcMod} +% \begin{macrocode} +\def\intcalcMod#1#2{% + \number\expandafter\IntCalc@Mod + \number\number#1\expandafter!% + \number#2! % +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\intcalc@Mod} +% Pseudocode/decision table for \cs{intcalc@Mod}. +% \begin{quote} +% \begin{tabular}{@{}lll@{}} +% if & $y=0$ & DivisionByZero\\ +% elsif & $y<0$ & $-\opMod(-x,-y)$\\ +% elsif & $x=0$ & 0\\ +% elsif & $y=1$ & 0\\ +% elsif & $y=2$ & $\opOdd(x)\mathbin{?}1\mathbin{:}0$\\ +% elsif & $x<0$ & +% $z\leftarrow x+(x/y)*x;\quad (z<0)\mathbin{?}z+x\mathbin{:}z$\\ +% else & & $x-(x/y)*x$\\ +% \\ +% \end{tabular} +% \end{quote} +% \begin{macrocode} +\def\IntCalc@Mod#1!#2!{% + \ifcase#2 % + 0\IntCalcError:DivisionByZero% + \else + \ifnum#2<\z@ + -% + \expandafter\IntCalc@Mod + \number-#1\expandafter!% + \number-#2!% + \else + \ifcase#1 % + 0% + \else + \ifcase#2 % 0 already catched +? \IntCalcError:ThisCannotHappen% + \or % 1 + 0% + \or % 2 + \ifodd#1 % + 1% + \else + 0% + \fi + \else + \ifnum#1<\z@ + \expandafter\IntCalc@ModShift + \number-% + \expandafter\IntCalc@Sub + \number\IntCalc@Gobble#1\expandafter!% + \number\intcalcMul{#2}{% + \expandafter\IntCalc@Div\IntCalc@Gobble#1!#2!% + }!% + !#2!% + \else + \expandafter\IntCalc@Sub\number#1\expandafter!% + \number\intcalcMul{#2}{\IntCalc@Div#1!#2!}!% + \fi + \fi + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@ModShift} +% \begin{macrocode} +\def\IntCalc@ModShift#1!#2!{% + \ifnum#1<\z@ + \expandafter\IntCalc@Sub\number#2\expandafter!% + \IntCalc@Gobble#1!% + \else + #1% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Help macros} +% +% \begin{macro}{\IntCalc@Empty} +% \begin{macrocode} +\def\IntCalc@Empty{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\IntCalc@Gobble} +% \begin{macrocode} +\def\IntCalc@Gobble#1{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@ReturnAfterFi} +% \begin{macrocode} +\long\def\@ReturnAfterFi#1\fi{\fi#1}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@ReturnAfterElseFi} +% \begin{macrocode} +\long\def\@ReturnAfterElseFi#1\else#2\fi{\fi#1}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\IntCalc@AtEnd +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input intcalc.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Macro tests} +% +% \subsubsection{Preamble with test macro definitions} +% +% \begin{macrocode} +%<*test2|test3|test4> +\NeedsTeXFormat{LaTeX2e} +\nofiles +\documentclass{article} +%<noetex>\let\SavedNumexpr\numexpr +%<noetex>\let\numexpr\UNDEFINED +\makeatletter +\chardef\IntCalc@TestMode=1 % +\makeatother +\usepackage{intcalc}[2007/09/09] +%<noetex>\let\numexpr\SavedNumexpr +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +%</test2|test3|test4> +%<*test2|test3> +\newcommand*{\TestSpaceAtEnd}[1]{% +%<noetex> \let\SavedNumexpr\numexpr +%<noetex> \let\numexpr\UNDEFINED + \edef\resultA{#1}% + \edef\resultB{#1 }% +%<noetex> \let\numexpr\SavedNumexpr + \Expect*{\resultA\space}*{\resultB}% +} +\newcommand*{\TestResult}[2]{% +%<noetex> \let\SavedNumexpr\numexpr +%<noetex> \let\numexpr\UNDEFINED + \edef\result{#1}% +%<noetex> \let\numexpr\SavedNumexpr + \Expect*{\result}{#2}% +} +\newcommand*{\TestResultTwoExpansions}[2]{% +%<*noetex> + \begingroup + \let\numexpr\UNDEFINED + \expandafter\expandafter\expandafter + \endgroup +%</noetex> + \expandafter\expandafter\expandafter\Expect + \expandafter\expandafter\expandafter{#1}{#2}% +} +\newcount\TestCount +%<etex>\newcommand*{\TestArg}[1]{\numexpr#1\relax} +%<noetex>\newcommand*{\TestArg}[1]{#1} +\newcommand*{\TestTeXDivide}[2]{% + \TestCount=\TestArg{#1}\relax + \divide\TestCount by \TestArg{#2}\relax + \Expect*{\intcalcDiv{#1}{#2}}*{\the\TestCount}% +} +\newcommand*{\Test}[2]{% + \TestResult{#1}{#2}% + \TestResultTwoExpansions{#1}{#2}% + \TestSpaceAtEnd{#1}% +} +\newcommand*{\TestExch}[2]{\Test{#2}{#1}} +\newcommand*{\TestInv}[2]{% + \Test{\intcalcInv{#1}}{#2}% +} +\newcommand*{\TestAbs}[2]{% + \Test{\intcalcAbs{#1}}{#2}% +} +\newcommand*{\TestSgn}[2]{% + \Test{\intcalcSgn{#1}}{#2}% +} +\newcommand*{\TestMin}[3]{% + \Test{\intcalcMin{#1}{#2}}{#3}% +} +\newcommand*{\TestMax}[3]{% + \Test{\intcalcMax{#1}{#2}}{#3}% +} +\newcommand*{\TestCmp}[3]{% + \Test{\intcalcCmp{#1}{#2}}{#3}% +} +\newcommand*{\TestInc}[2]{% + \Test{\intcalcInc{#1}}{#2}% +} +\newcommand*{\TestDec}[2]{% + \Test{\intcalcDec{#1}}{#2}% +} +\newcommand*{\TestAdd}[3]{% + \Test{\intcalcAdd{#1}{#2}}{#3}% +} +\newcommand*{\TestSub}[3]{% + \Test{\intcalcSub{#1}{#2}}{#3}% +} +\newcommand*{\TestShl}[2]{% + \Test{\intcalcShl{#1}}{#2}% +} +\newcommand*{\TestShr}[2]{% + \Test{\intcalcShr{#1}}{#2}% +} +\newcommand*{\TestMul}[3]{% + \Test{\intcalcMul{#1}{#2}}{#3}% +} +\newcommand*{\TestSqr}[2]{% + \Test{\intcalcSqr{#1}}{#2}% +} +\newcommand*{\TestFac}[2]{% + \expandafter\TestExch\expandafter{\the\numexpr#2}{\intcalcFac{#1}}% +} +\newcommand*{\TestPow}[3]{% + \Test{\intcalcPow{#1}{#2}}{#3}% +} +\newcommand*{\TestDiv}[3]{% + \Test{\intcalcDiv{#1}{#2}}{#3}% + \TestTeXDivide{#1}{#2}% +} +\newcommand*{\TestMod}[3]{% + \Test{\intcalcMod{#1}{#2}}{#3}% +} +%</test2|test3> +%<*test4> +\newcommand*{\TestDo}[2]{% + \ifcase\numexpr#2\relax + \else + \edef\temp{\intcalcMod{#1}{#2}}% + \Expect*{% + \the\numexpr + \intcalcMul{% + \intcalcDiv{\intcalcAbs{#1}}{\intcalcAbs{#2}}% + }{\intcalcAbs{#2}}% + +\intcalcMod{\intcalcAbs{#1}}{\intcalcAbs{#2}}\relax + }*{\the\numexpr\intcalcAbs{#1}\relax}% + \fi +} +\newcommand*{\TestOne}[2]{% + \TestDo{#1}{#1}% +} +\newcommand*{\TestTwo}[3]{% + \TestDo{#1}{#2}% + \TestDo{#2}{#1}% +} +\let\TestInv\TestOne +\let\TestAbs\TestOne +\let\TestSgn\TestOne +\let\TestMin\TestTwo +\let\TestMax\TestTwo +\let\TestCmp\TestTwo +\let\TestInc\TestOne +\let\TestDec\TestOne +\let\TestAdd\TestTwo +\let\TestSub\TestTwo +\let\TestShl\TestOne +\let\TestShr\TestOne +\let\TestMul\TestTwo +\let\TestSqr\TestOne +\def\TestFac#1#2{} +\let\TestPow\TestTwo +\let\TestDiv\TestTwo +\let\TestMod\TestTwo +%</test4> +% \end{macrocode} +% +% \subsubsection{Test sets} +% +% \begin{macrocode} +%<*test2|test3|test4> +\makeatletter + +\begin{qstest}{inv}{inv}% + \TestInv{0}{0}% + \TestInv{1}{-1}% + \TestInv{-1}{1}% + \TestInv{10}{-10}% + \TestInv{-10}{10}% + \TestInv{2147483647}{-2147483647}% + \TestInv{-2147483647}{2147483647}% + \TestInv{ 0 }{0}% + \TestInv{ 1 }{-1}% + \TestInv{--1}{-1}% + \TestInv{\z@}{0}% + \TestInv{\@ne}{-1}% + \TestInv{\m@ne}{1}% +%<*etex> + \TestInv{-10+30}{-20}% + \TestInv{10-30}{20}% +%</etex> +\end{qstest} + +\begin{qstest}{abs}{abs}% + \TestAbs{0}{0}% + \TestAbs{1}{1}% + \TestAbs{-1}{1}% + \TestAbs{10}{10}% + \TestAbs{-10}{10}% + \TestAbs{2147483647}{2147483647}% + \TestAbs{-2147483647}{2147483647}% + \TestAbs{ 0 }{0}% + \TestAbs{ 1 }{1}% + \TestAbs{--1}{1}% + \TestAbs{\z@}{0}% + \TestAbs{\@ne}{1}% + \TestAbs{\m@ne}{1}% +%<*etex> + \TestAbs{-10+30}{20}% + \TestAbs{10-30}{20}% +%</etex> +\end{qstest} + +\begin{qstest}{sign}{sign}% + \TestSgn{0}{0}% + \TestSgn{1}{1}% + \TestSgn{-1}{-1}% + \TestSgn{10}{1}% + \TestSgn{-10}{-1}% + \TestSgn{2147483647}{1}% + \TestSgn{-2147483647}{-1}% + \TestSgn{ 0 }{0}% + \TestSgn{ 2 }{1}% + \TestSgn{ -2 }{-1}% + \TestSgn{--2}{1}% + \TestSgn{\z@}{0}% + \TestSgn{\@ne}{1}% + \TestSgn{\m@ne}{-1}% +%<*etex> + \TestSgn{-10+30}{1}% + \TestSgn{10-30}{-1}% +%</etex> +\end{qstest} + +\begin{qstest}{min}{min}% + \TestMin{0}{1}{0}% + \TestMin{1}{0}{0}% + \TestMin{-10}{-20}{-20}% + \TestMin{ 1 }{ 2 }{1}% + \TestMin{ 2 }{ 1 }{1}% + \TestMin{1}{1}{1}% + \TestMin{\z@}{\@ne}{0}% + \TestMin{\@ne}{\m@ne}{-1}% +%<*etex> + \TestMin{1+2}{3+4}{3}% +%</etex> +\end{qstest} + +\begin{qstest}{max}{max}% + \TestMax{0}{1}{1}% + \TestMax{1}{0}{1}% + \TestMax{-10}{-20}{-10}% + \TestMax{ 1 }{ 2 }{2}% + \TestMax{ 2 }{ 1 }{2}% + \TestMax{1}{1}{1}% + \TestMax{\z@}{\@ne}{1}% + \TestMax{\@ne}{\m@ne}{1}% +%<*etex> + \TestMax{1+2}{3+4}{7}% +%</etex> +\end{qstest} + +\begin{qstest}{cmp}{cmp}% + \TestCmp{0}{0}{0}% + \TestCmp{-21}{17}{-1}% + \TestCmp{3}{4}{-1}% + \TestCmp{-10}{-10}{0}% + \TestCmp{-10}{-11}{1}% + \TestCmp{100}{5}{1}% + \TestCmp{2147483647}{-2147483647}{1}% + \TestCmp{-2147483647}{2147483647}{-1}% + \TestCmp{2147483647}{2147483647}{0}% + \TestCmp{\z@}{\@ne}{-1}% + \TestCmp{\@ne}{\m@ne}{1}% + \TestCmp{ 4 }{ 5 }{-1}% + \TestCmp{ -3 }{ -7 }{1}% +%<*etex> + \TestCmp{1+2}{3+4}{-1}% +%</etex> +\end{qstest} + +\begin{qstest}{fac}{fac} + \TestFac{0}{1}% + \TestFac{1}{1}% + \TestFac{2}{2}% + \TestFac{3}{2*3}% + \TestFac{4}{2*3*4}% + \TestFac{5}{2*3*4*5}% + \TestFac{6}{2*3*4*5*6}% + \TestFac{7}{2*3*4*5*6*7}% + \TestFac{8}{2*3*4*5*6*7*8}% + \TestFac{9}{2*3*4*5*6*7*8*9}% + \TestFac{10}{2*3*4*5*6*7*8*9*10}% + \TestFac{11}{2*3*4*5*6*7*8*9*10*11}% + \TestFac{12}{2*3*4*5*6*7*8*9*10*11*12}% +\end{qstest} + +\begin{qstest}{inc}{inc}% + \TestInc{0}{1}% + \TestInc{1}{2}% + \TestInc{-1}{0}% + \TestInc{10}{11}% + \TestInc{-10}{-9}% + \TestInc{999}{1000}% + \TestInc{-1000}{-999}% + \TestInc{129}{130}% + \TestInc{2147483646}{2147483647}% + \TestInc{-2147483647}{-2147483646}% +\end{qstest} + +\begin{qstest}{dec}{dec}% + \TestDec{0}{-1}% + \TestDec{1}{0}% + \TestDec{-1}{-2}% + \TestDec{10}{9}% + \TestDec{-10}{-11}% + \TestDec{1000}{999}% + \TestDec{-999}{-1000}% + \TestDec{130}{129}% + \TestDec{2147483647}{2147483646}% + \TestDec{-2147483646}{-2147483647}% +\end{qstest} + +\begin{qstest}{add}{add}% + \TestAdd{0}{0}{0}% + \TestAdd{1}{0}{1}% + \TestAdd{0}{1}{1}% + \TestAdd{1}{2}{3}% + \TestAdd{-1}{-1}{-2}% + \TestAdd{2147483646}{1}{2147483647}% + \TestAdd{-2147483647}{2147483647}{0}% + \TestAdd{20}{-5}{15}% + \TestAdd{-4}{-1}{-5}% + \TestAdd{-1}{-4}{-5}% + \TestAdd{-4}{1}{-3}% + \TestAdd{-1}{4}{3}% + \TestAdd{4}{-1}{3}% + \TestAdd{1}{-4}{-3}% + \TestAdd{-4}{-1}{-5}% + \TestAdd{-1}{-4}{-5}% + \TestAdd{ -4 }{ -1 }{-5}% + \TestAdd{ -1 }{ -4 }{-5}% + \TestAdd{ -4 }{ 1 }{-3}% + \TestAdd{ -1 }{ 4 }{3}% + \TestAdd{ 4 }{ -1 }{3}% + \TestAdd{ 1 }{ -4 }{-3}% + \TestAdd{ -4 }{ -1 }{-5}% + \TestAdd{ -1 }{ -4 }{-5}% + \TestAdd{876543210}{111111111}{987654321}% + \TestAdd{999999999}{2}{1000000001}% +%<*etex> + \TestAdd{100}{50+150}{300}% + \TestAdd{2147483647}{10-2147483647}{10}% +%</etex> +\end{qstest} + +\begin{qstest}{sub}{sub} + \TestSub{0}{0}{0}% + \TestSub{1}{0}{1}% + \TestSub{1}{2}{-1}% + \TestSub{-1}{-1}{0}% + \TestSub{2147483646}{-1}{2147483647}% + \TestSub{-2147483647}{-2147483647}{0}% + \TestSub{-4}{-1}{-3}% + \TestSub{-1}{-4}{3}% + \TestSub{-4}{1}{-5}% + \TestSub{-1}{4}{-5}% + \TestSub{4}{-1}{5}% + \TestSub{1}{-4}{5}% + \TestSub{-4}{-1}{-3}% + \TestSub{-1}{-4}{3}% + \TestSub{ -4 }{ -1 }{-3}% + \TestSub{ -1 }{ -4 }{3}% + \TestSub{ -4 }{ 1 }{-5}% + \TestSub{ -1 }{ 4 }{-5}% + \TestSub{ 4 }{ -1 }{5}% + \TestSub{ 1 }{ -4 }{5}% + \TestSub{ -4 }{ -1 }{-3}% + \TestSub{ -1 }{ -4 }{3}% + \TestSub{1000000000}{2}{999999998}% + \TestSub{987654321}{111111111}{876543210}% +%<*etex> + \TestSub{100}{50+150}{-100}% + \TestSub{2147483647}{-10+2147483647}{10}% +%</etex> +\end{qstest} + +\begin{qstest}{shl}{shl} + \TestShl{0}{0}% + \TestShl{1}{2}% + \TestShl{5621}{11242}% + \TestShl{1073741823}{2147483646}% +\end{qstest} + +\begin{qstest}{shr}{shr} + \TestShr{0}{0}% + \TestShr{1}{0}% + \TestShr{2}{1}% + \TestShr{3}{1}% + \TestShr{4}{2}% + \TestShr{5}{2}% + \TestShr{6}{3}% + \TestShr{7}{3}% + \TestShr{8}{4}% + \TestShr{9}{4}% + \TestShr{10}{5}% + \TestShr{11}{5}% + \TestShr{12}{6}% + \TestShr{13}{6}% + \TestShr{14}{7}% + \TestShr{15}{7}% + \TestShr{16}{8}% + \TestShr{17}{8}% + \TestShr{18}{9}% + \TestShr{19}{9}% + \TestShr{20}{10}% + \TestShr{21}{10}% + \TestShr{22}{11}% + \TestShr{11241}{5620}% + \TestShr{73054202}{36527101}% + \TestShr{2147483646}{1073741823}% +\end{qstest} + +\begin{qstest}{mul}{mul} + \TestMul{0}{0}{0}% + \TestMul{1}{0}{0}% + \TestMul{0}{1}{0}% + \TestMul{1}{1}{1}% + \TestMul{3}{1}{3}% + \TestMul{1}{-3}{-3}% + \TestMul{-4}{-5}{20}% + \TestMul{3}{7}{21}% + \TestMul{7}{3}{21}% + \TestMul{3}{-7}{-21}% + \TestMul{7}{-3}{-21}% + \TestMul{-3}{7}{-21}% + \TestMul{-7}{3}{-21}% + \TestMul{-3}{-7}{21}% + \TestMul{-7}{-3}{21}% + \TestMul{12}{11}{132}% + \TestMul{999}{333}{332667}% + \TestMul{1000}{4321}{4321000}% + \TestMul{12345}{173955}{2147474475}% + \TestMul{1073741823}{2}{2147483646}% + \TestMul{2}{1073741823}{2147483646}% + \TestMul{-1073741823}{2}{-2147483646}% + \TestMul{2}{-1073741823}{-2147483646}% +%<*etex> + \TestMul{2+3}{5+7}{60}% + \TestMul{2147483647}{2147483647/2147483647}{2147483647}% +%</etex> +\end{qstest} + +\begin{qstest}{sqr}{sqr} + \TestSqr{0}{0}% + \TestSqr{1}{1}% + \TestSqr{2}{4}% + \TestSqr{3}{9}% + \TestSqr{4}{16}% + \TestSqr{9}{81}% + \TestSqr{10}{100}% + \TestSqr{46340}{2147395600}% + \TestSqr{-1}{1}% + \TestSqr{-2}{4}% + \TestSqr{-46340}{2147395600}% +\end{qstest} + +\begin{qstest}{pow}{pow} + \TestPow{-2}{0}{1}% + \TestPow{-1}{0}{1}% + \TestPow{0}{0}{1}% + \TestPow{1}{0}{1}% + \TestPow{2}{0}{1}% + \TestPow{3}{0}{1}% + \TestPow{-2}{1}{-2}% + \TestPow{-1}{1}{-1}% + \TestPow{1}{1}{1}% + \TestPow{2}{1}{2}% + \TestPow{3}{1}{3}% + \TestPow{-2}{2}{4}% + \TestPow{-1}{2}{1}% + \TestPow{0}{2}{0}% + \TestPow{1}{2}{1}% + \TestPow{2}{2}{4}% + \TestPow{3}{2}{9}% + \TestPow{0}{1}{0}% + \TestPow{1}{-2}{1}% + \TestPow{1}{-1}{1}% + \TestPow{-1}{-2}{1}% + \TestPow{-1}{-1}{-1}% + \TestPow{-1}{3}{-1}% + \TestPow{-1}{4}{1}% + \TestPow{-2}{-1}{0}% + \TestPow{-2}{-2}{0}% + \TestPow{2}{3}{8}% + \TestPow{2}{4}{16}% + \TestPow{2}{5}{32}% + \TestPow{2}{6}{64}% + \TestPow{2}{7}{128}% + \TestPow{2}{8}{256}% + \TestPow{2}{9}{512}% + \TestPow{2}{10}{1024}% + \TestPow{-2}{3}{-8}% + \TestPow{-2}{4}{16}% + \TestPow{-2}{5}{-32}% + \TestPow{-2}{6}{64}% + \TestPow{-2}{7}{-128}% + \TestPow{-2}{8}{256}% + \TestPow{-2}{9}{-512}% + \TestPow{-2}{10}{1024}% + \TestPow{3}{3}{27}% + \TestPow{3}{4}{81}% + \TestPow{3}{5}{243}% + \TestPow{-3}{3}{-27}% + \TestPow{-3}{4}{81}% + \TestPow{-3}{5}{-243}% + \TestPow{2}{30}{1073741824}% + \TestPow{-3}{19}{-1162261467}% + \TestPow{5}{13}{1220703125}% + \TestPow{-7}{11}{-1977326743}% +\end{qstest} + +\begin{qstest}{div}{div} + \TestDiv{1}{1}{1}% + \TestDiv{2}{1}{2}% + \TestDiv{-2}{1}{-2}% + \TestDiv{2}{-1}{-2}% + \TestDiv{-2}{-1}{2}% + \TestDiv{15}{2}{7}% + \TestDiv{-16}{2}{-8}% + \TestDiv{1}{2}{0}% + \TestDiv{1}{3}{0}% + \TestDiv{2}{3}{0}% + \TestDiv{-2}{3}{0}% + \TestDiv{2}{-3}{0}% + \TestDiv{-2}{-3}{0}% + \TestDiv{13}{3}{4}% + \TestDiv{-13}{-3}{4}% + \TestDiv{-13}{3}{-4}% + \TestDiv{-6}{5}{-1}% + \TestDiv{-5}{5}{-1}% + \TestDiv{-4}{5}{0}% + \TestDiv{-3}{5}{0}% + \TestDiv{-2}{5}{0}% + \TestDiv{-1}{5}{0}% + \TestDiv{0}{5}{0}% + \TestDiv{1}{5}{0}% + \TestDiv{2}{5}{0}% + \TestDiv{3}{5}{0}% + \TestDiv{4}{5}{0}% + \TestDiv{5}{5}{1}% + \TestDiv{6}{5}{1}% + \TestDiv{-5}{4}{-1}% + \TestDiv{-4}{4}{-1}% + \TestDiv{-3}{4}{0}% + \TestDiv{-2}{4}{0}% + \TestDiv{-1}{4}{0}% + \TestDiv{0}{4}{0}% + \TestDiv{1}{4}{0}% + \TestDiv{2}{4}{0}% + \TestDiv{3}{4}{0}% + \TestDiv{4}{4}{1}% + \TestDiv{5}{4}{1}% + \TestDiv{12345}{678}{18}% + \TestDiv{32372}{5952}{5}% + \TestDiv{284271294}{18162}{15651}% + \TestDiv{217652429}{12561}{17327}% + \TestDiv{462028434}{5439}{84947}% + \TestDiv{2147483647}{1000}{2147483}% + \TestDiv{2147483647}{-1000}{-2147483}% + \TestDiv{-2147483647}{1000}{-2147483}% + \TestDiv{-2147483647}{-1000}{2147483}% +\end{qstest} + +\begin{qstest}{mod}{mod} + \TestMod{-6}{5}{4}% + \TestMod{-5}{5}{0}% + \TestMod{-4}{5}{1}% + \TestMod{-3}{5}{2}% + \TestMod{-2}{5}{3}% + \TestMod{-1}{5}{4}% + \TestMod{0}{5}{0}% + \TestMod{1}{5}{1}% + \TestMod{2}{5}{2}% + \TestMod{3}{5}{3}% + \TestMod{4}{5}{4}% + \TestMod{5}{5}{0}% + \TestMod{6}{5}{1}% + \TestMod{-5}{4}{3}% + \TestMod{-4}{4}{0}% + \TestMod{-3}{4}{1}% + \TestMod{-2}{4}{2}% + \TestMod{-1}{4}{3}% + \TestMod{0}{4}{0}% + \TestMod{1}{4}{1}% + \TestMod{2}{4}{2}% + \TestMod{3}{4}{3}% + \TestMod{4}{4}{0}% + \TestMod{5}{4}{1}% + \TestMod{-6}{-5}{-1}% + \TestMod{-5}{-5}{0}% + \TestMod{-4}{-5}{-4}% + \TestMod{-3}{-5}{-3}% + \TestMod{-2}{-5}{-2}% + \TestMod{-1}{-5}{-1}% + \TestMod{0}{-5}{0}% + \TestMod{1}{-5}{-4}% + \TestMod{2}{-5}{-3}% + \TestMod{3}{-5}{-2}% + \TestMod{4}{-5}{-1}% + \TestMod{5}{-5}{0}% + \TestMod{6}{-5}{-4}% + \TestMod{-5}{-4}{-1}% + \TestMod{-4}{-4}{0}% + \TestMod{-3}{-4}{-3}% + \TestMod{-2}{-4}{-2}% + \TestMod{-1}{-4}{-1}% + \TestMod{0}{-4}{0}% + \TestMod{1}{-4}{-3}% + \TestMod{2}{-4}{-2}% + \TestMod{3}{-4}{-1}% + \TestMod{4}{-4}{0}% + \TestMod{5}{-4}{-3}% + \TestMod{2147483647}{1000}{647}% + \TestMod{2147483647}{-1000}{-353}% + \TestMod{-2147483647}{1000}{353}% + \TestMod{-2147483647}{-1000}{-647}% + \TestMod{ 0 }{ 4 }{0}% + \TestMod{ 1 }{ 4 }{1}% + \TestMod{ -1 }{ 4 }{3}% + \TestMod{ 0 }{ -4 }{0}% + \TestMod{ 1 }{ -4 }{-3}% + \TestMod{ -1 }{ -4 }{-1}% +%<*etex> + \TestMod{1+2}{1+3}{3}% + \TestMod{1-2}{1+3}{3}% + \TestMod{1-2}{1-4}{-1}% + \TestMod{1+2}{1-4}{0}% + \TestMod{1+2}{1-5}{-1}% +%</etex> +\end{qstest} +%</test2|test3|test4> + +%<*test2|test3> +\newcommand*{\TestError}[2]{% + \begingroup + \expandafter\def\csname IntCalcError:#1\endcsname{}% + \Expect*{#2}{0}% + \expandafter\def\csname IntCalcError:#1\endcsname{ERROR}% + \Expect*{#2}{0ERROR }% + \endgroup +} +\begin{qstest}{error}{error} + \TestError{FacNegative}{\intcalcFac{-1}}% + \TestError{FacNegative}{\intcalcFac{-2147483647}}% + \TestError{FacOverflow}{\intcalcFac{13}}% + \TestError{FacOverflow}{\intcalcFac{2147483647}}% + \TestError{ShlNegativeNumber}{\intcalcShl{-1}}% + \TestError{ShrNegativeNumber}{\intcalcShr{-1}}% + \TestError{DivisionByZero}{\intcalcPow{0}{-1}}% + \TestError{DivisionByZero}{\intcalcDiv{1}{0}}% + \TestError{DivisionByZero}{\intcalcMod{1}{0}}% +\end{qstest} +%</test2|test3> + +%<*test2|test3|test4> +\begin{document} +\end{document} +%</test2|test3|test4> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/intcalc.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/intcalc.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek-tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex intcalc.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% intcalc.sty & tex/generic/oberdiek/intcalc.sty\\ +% intcalc.pdf & doc/latex/oberdiek/intcalc.pdf\\ +% intcalc-test1.tex & doc/latex/oberdiek/intcalc-test1.tex\\ +% intcalc-test2.tex & doc/latex/oberdiek/intcalc-test2.tex\\ +% intcalc-test3.tex & doc/latex/oberdiek/intcalc-test3.tex\\ +% intcalc-test4.tex & doc/latex/oberdiek/intcalc-test4.tex\\ +% intcalc.dtx & source/latex/oberdiek/intcalc.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk intcalc.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{intcalc.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex intcalc.dtx +%makeindex -s gind.ist intcalc.idx +%pdflatex intcalc.dtx +%makeindex -s gind.ist intcalc.idx +%pdflatex intcalc.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{History} +% \begin{Version}{2007/09/09 v1.0} +% \item +% First version. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx index 556725c570f..03b34445f49 100644 --- a/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/kvoptions.dtx @@ -2151,6 +2151,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/kvsetkeys.dtx b/Master/texmf-dist/source/latex/oberdiek/kvsetkeys.dtx index 6af482fd905..6d9d13470f6 100644 --- a/Master/texmf-dist/source/latex/oberdiek/kvsetkeys.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/kvsetkeys.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% Copyright (C) 2006, 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -17,7 +17,7 @@ % This work consists of the main source file kvsetkeys.dtx % and the derived files % kvsetkeys.sty, kvsetkeys.pdf, kvsetkeys.ins, kvsetkeys.drv, -% kvsetkeys-example.tex. +% kvsetkeys-example.tex, kvsetkeys-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/kvsetkeys.dtx @@ -53,6 +53,7 @@ % TDS:tex/generic/oberdiek/kvsetkeys.sty % TDS:doc/latex/oberdiek/kvsetkeys.pdf % TDS:doc/latex/oberdiek/kvsetkeys-example.tex +% TDS:doc/latex/oberdiek/kvsetkeys-test1.tex % TDS:source/latex/oberdiek/kvsetkeys.dtx % %<*ignore> @@ -68,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: kvsetkeys 2006/10/19 v1.1 Key value parser with default handler support (HO)} +\Msg{* Package: kvsetkeys 2007/09/09 v1.2 Key value parser with default handler support (HO)} \Msg{************************************************************************} \keepsilent @@ -78,7 +79,7 @@ This is a generated file. -Copyright (C) 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +Copyright (C) 2006, 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -95,7 +96,7 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file kvsetkeys.dtx and the derived files kvsetkeys.sty, kvsetkeys.pdf, kvsetkeys.ins, kvsetkeys.drv, - kvsetkeys-example.tex. + kvsetkeys-example.tex, kvsetkeys-test1.tex. \endpreamble @@ -106,6 +107,7 @@ and the derived files \file{kvsetkeys.sty}{\from{kvsetkeys.dtx}{package}}% \usedir{doc/latex/oberdiek}% \file{kvsetkeys-example.tex}{\from{kvsetkeys.dtx}{example}}% + \file{kvsetkeys-test1.tex}{\from{kvsetkeys.dtx}{test1}}% } \obeyspaces @@ -131,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{kvsetkeys.drv}% - [2006/10/19 v1.1 Key value parser with default handler support (HO)]% + [2007/09/09 v1.2 Key value parser with default handler support (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -140,7 +142,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{598} +% \CheckSum{625} % % \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 @@ -161,7 +163,7 @@ and the derived files % \GetFileInfo{kvsetkeys.drv} % % \title{The \xpackage{kvsetkeys} package} -% \date{2006/10/19 v1.1} +% \date{2007/09/09 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -437,28 +439,29 @@ and the derived files \fi \expandafter\x\csname ver@kvsetkeys.sty\endcsname \ProvidesPackage{kvsetkeys}% - [2006/10/19 v1.1 Key value parser with default handler support (HO)] + [2007/09/09 v1.2 Key value parser with default handler support (HO)] % \end{macrocode} % % \begin{macrocode} -\expandafter\edef\csname KVS@endinput\endcsname{% - \catcode39 \the\catcode39 % ' - \catcode44 \the\catcode44 % , - \catcode61 \the\catcode61 % = - \catcode64 \the\catcode64 % @ - \catcode94 \the\catcode94 % ^ - \catcode96 \the\catcode96 % ` - \catcode126 \the\catcode126 % ~ - \relax - \noexpand\endinput +\expandafter\edef\csname KVS@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax } -\catcode39 12 % ' -\catcode44 12 % , -\catcode61 12 % = \catcode64 11 % @ -\catcode94 7 % ^ -\catcode96 12 % ` -\catcode126 13 % ~ +\def\TMP@EnsureCode#1#2{% + \edef\KVS@AtEnd{% + \KVS@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{94}{7}% ^ (superscript) +\TMP@EnsureCode{96}{12}% ` +\TMP@EnsureCode{126}{13}% ~ (active) % \end{macrocode} % % \begin{macrocode} @@ -754,54 +757,40 @@ and the derived files % % \subsection{Error handling} % -% \begin{macro}{\kv@error@novalue} -% Only a poor \cs{PackageError} is provided by \xfile{miniltx.tex}. % \begin{macrocode} -\expandafter\ifx\csname MessageBreak\endcsname\relax - \def\MessageBreak{^^J}% -\fi -\expandafter\ifx\csname @ehc\endcsname\relax - \def\@ehc{% - Try typing \space\string<return\string> % - \space to proceed.\MessageBreak - If that doesn't work, type \space X % - \string<return\string> \space to quit\string.% - }% +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax + \input infwarerr.sty\relax +\else + \RequirePackage{infwarerr}[2007/09/09]% \fi +% \end{macrocode} +% +% \begin{macro}{\kv@error@novalue} +% \begin{macrocode} \def\kv@error@novalue{% \kv@error@generic{No value specified for}% } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\kv@error@unknownkey} +% \begin{macrocode} \def\kv@error@unknownkey{% \kv@error@generic{Undefined}% } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\kv@error@generic} +% \begin{macrocode} \def\kv@error@generic#1#2#3{% - \begingroup - \newlinechar=10 % - \def\MessageBreak{^^J}% - \expandafter\ifx\csname PackageError\endcsname\relax - \edef\x{% - \errhelp{% - The keyval family of the key `#3' is `#2'.\MessageBreak - \MessageBreak - \@ehc - }% - }% - \x - \errmessage{kvsetkeys: #1 key `#3'}% - \else - \edef\x{% - \noexpand\PackageError{kvsetkeys}{% - #1 key `#3'% - }{% - The keyval family of the key `#3' is `#2'.\MessageBreak - \MessageBreak - \@ehc - }% - }% - \x - \fi - \endgroup -}% + \@PackageError{kvsetkeys}{% + #1 key `#3'% + }{% + The keyval family of the key `#3' is `#2'.\MessageBreak + \MessageBreak + \@ehc + }% +} % \end{macrocode} % \end{macro} % @@ -816,9 +805,64 @@ and the derived files % \end{macro} % % \begin{macrocode} -\KVS@endinput +\KVS@AtEnd %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input kvsetkeys.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -881,6 +925,7 @@ and the derived files % kvsetkeys.sty & tex/generic/oberdiek/kvsetkeys.sty\\ % kvsetkeys.pdf & doc/latex/oberdiek/kvsetkeys.pdf\\ % kvsetkeys-example.tex & doc/latex/oberdiek/kvsetkeys-example.tex\\ +% kvsetkeys-test1.tex & doc/latex/oberdiek/kvsetkeys-test1.tex\\ % kvsetkeys.dtx & source/latex/oberdiek/kvsetkeys.dtx\\ % \end{tabular}^^A % }^^A @@ -1022,6 +1067,12 @@ and the derived files % \item % Example added. % \end{Version} +% \begin{Version}{2007/09/09 v1.2} +% \item +% Using package \xpackage{infwarerr} for error messages. +% \item +% Catcode section rewritten. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/makerobust.dtx b/Master/texmf-dist/source/latex/oberdiek/makerobust.dtx index 08ab6cb3c80..3783bafc84f 100644 --- a/Master/texmf-dist/source/latex/oberdiek/makerobust.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/makerobust.dtx @@ -293,6 +293,7 @@ Second page. % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/oberdiek.ins b/Master/texmf-dist/source/latex/oberdiek/oberdiek.ins index 9371e53e31d..6e1f3d9784a 100644 --- a/Master/texmf-dist/source/latex/oberdiek/oberdiek.ins +++ b/Master/texmf-dist/source/latex/oberdiek/oberdiek.ins @@ -1,5 +1,5 @@ % oberdiek.ins -% 2007/08/16 +% 2007/09/14 % % Copyright (C) 1999, 2001, 2006 by % Heiko Oberdiek <oberdiek@uni-freiburg.de> @@ -55,12 +55,16 @@ \batchinput{ifvtex.dtx} \batchinput{infwarerr.dtx} \batchinput{inputenx.dtx} +\batchinput{intcalc.dtx} \batchinput{kvoptions.dtx} \batchinput{kvsetkeys.dtx} \batchinput{makerobust.dtx} \batchinput{pagesel.dtx} +\batchinput{pdfcol.dtx} \batchinput{pdfcolfoot.dtx} \batchinput{pdfcolmk.dtx} +\batchinput{pdfcolparallel.dtx} +\batchinput{pdfcolparcolumns.dtx} \batchinput{pdfcrypt.dtx} \batchinput{pdfescape.dtx} \batchinput{pdflscape.dtx} @@ -70,6 +74,7 @@ \batchinput{selinput.dtx} \batchinput{setouterhbox.dtx} \batchinput{settobox.dtx} +\batchinput{soulutf8.dtx} \batchinput{stackrel.dtx} \batchinput{stringenc.dtx} \batchinput{tabularht.dtx} diff --git a/Master/texmf-dist/source/latex/oberdiek/oberdiek.tex b/Master/texmf-dist/source/latex/oberdiek/oberdiek.tex index e1eafdfba25..fcad0f2255d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/oberdiek.tex +++ b/Master/texmf-dist/source/latex/oberdiek/oberdiek.tex @@ -6,7 +6,7 @@ \newcommand*{\Subject}{CTAN:\CTANdir} \newcommand*{\Author}{Heiko Oberdiek} \newcommand*{\Email}{oberdiek@uni-freiburg.de} -\newcommand*{\Date}{2007/08/16} +\newcommand*{\Date}{2007/09/14} % Copyright (C) 2006 by % Heiko Oberdiek <oberdiek@uni-freiburg.de> @@ -160,9 +160,9 @@ [\entrysep] \entry{aliascnt}{2006/09/25}{1.2}{Alias counter}% [\entrysep] -\entry{alphalph}{2007/04/11}{1.5}{Converting numbers to letters}% +\entry{alphalph}{2007/04/11}{2.0}{Converting numbers to letters}% [\entrysep] -\entry{atbegshi}{2007/06/06}{1.5}{At begin shipout hook}% +\entry{atbegshi}{2007/09/09}{1.6}{At begin shipout hook}% [\entrysep] \entry{atenddvi}{2007/04/17}{1.1}{At end DVI hook}% [\entrysep] @@ -174,7 +174,7 @@ [\entrysep] \entry{bookmark}{2007/07/13}{1.1}{PDF bookmarks}% [\entrysep] -\entry{catchfile}{2007/05/30}{1.0}{Catches the contents of a file}% +\entry{catchfile}{2007/09/09}{1.1}{Catches the contents of a file}% [\entrysep] \entry{centernot}{2007/05/31}{1.1}{Centers the not symbol horizontally}% [\entrysep] @@ -186,13 +186,13 @@ [\entrysep] \entry{dvipscol}{2006/02/20}{1.1}{Fix for dvips.def}% [\entrysep] -\entry{embedfile}{2007/04/11}{1.1}{embed files into PDF}% +\entry{embedfile}{2007/09/09}{1.2}{embed files into PDF}% [\entrysep] -\entry{engord}{2007/04/26}{1.4}{Provides the ifpdf switch}% +\entry{engord}{2007/09/09}{1.5}{Provides the ifpdf switch}% [\entrysep] \entry{epstopdf}{2007/04/26}{1.4}{Conversion with epstopdf on the fly}% [\entrysep] -\entry{etexcmds}{2007/05/06}{1.0}{Providing prefix for e-TeX command names}% +\entry{etexcmds}{2007/09/09}{1.1}{Providing prefix for e-TeX command names}% [\entrysep] \entry{flags}{2007/03/07}{0.3}{Flag setting in bit fields}% [\entrysep] @@ -212,31 +212,39 @@ [\entrysep] \entry{ifdraft}{2006/02/20}{1.2}{Switch for option draft}% [\entrysep] -\entry{iflang}{2007/04/26}{1.3}{Language checks}% +\entry{iflang}{2007/09/09}{1.4}{Language checks}% [\entrysep] -\entry{ifpdf}{2006/02/20}{1.4}{Provides the ifpdf switch}% +\entry{ifpdf}{2007/09/09}{1.5}{Provides the ifpdf switch}% [\entrysep] -\entry{ifvtex}{2007/01/10}{1.2}{Switches for detecting VTeX and its modes}% +\entry{ifvtex}{2007/09/09}{1.3}{Switches for detecting VTeX and its modes}% [\entrysep] -\entry{infwarerr}{2007/06/14}{1.1}{Providing info/warning/message}% +\entry{infwarerr}{2007/09/09}{1.2}{Providing info/warning/message}% [\entrysep] \entry{inputenx}{2007/08/16}{1.3}{Enhanced input encoding handling}% [\entrysep] +\entry{intcalc}{2007/09/09}{1.0}{Expandable integer calculations}% +[\entrysep] \entry{kvoptions}{2007/06/11}{2.7}{Connects package keyval with \LaTeX{} options}% [\entrysep] -\entry{kvsetkeys}{2006/10/19}{1.1}{Key value parser with default handler support}% +\entry{kvsetkeys}{2007/09/09}{1.2}{Key value parser with default handler support}% [\entrysep] \entry{makerobust}{2006/03/18}{1.0}{Making a macro robust}% [\entrysep] \entry{pagesel}{2007/04/12}{1.7}{Selecting shipout output pages}% [\entrysep] -\entry{pdfcolfoot}{2007/01/08}{1.0}{pdfTeX's color stack for footnotes}% +\entry{pdfcol}{2007/09/09}{1.0}{Maintaining additional color stacks for pdfTeX}% +[\entrysep] +\entry{pdfcolfoot}{2007/09/09}{1.1}{pdfTeX's color stack for footnotes}% [\entrysep] \entry{pdfcolmk}{2007/04/11}{1.1}{PDFtex COLor MarK}% [\entrysep] +\entry{pdfcolparallel}{2007/09/09}{1.0}{Color stacks support for parallel}% +[\entrysep] +\entry{pdfcolparcolumns}{2007/09/09}{1.1}{Color stacks support for parcolumns}% +[\entrysep] \entry{pdfcrypt}{2007/04/26}{1.0}{Setting pdf encryption}% [\entrysep] -\entry{pdfescape}{2007/04/21}{1.4}{Provides hex, PDF name and string conversions}% +\entry{pdfescape}{2007/09/09}{1.6}{Provides hex, PDF name and string conversions}% [\entrysep] \entry{pdflscape}{2007/04/17}{0.8}{Landscape pages in PDF}% [\entrysep] @@ -246,21 +254,23 @@ [\entrysep] \entry{refcount}{2006/02/20}{3.0}{Data extraction from references}% [\entrysep] -\entry{selinput}{2007/06/20}{1.1}{Select input encoding}% +\entry{selinput}{2007/09/09}{1.2}{Select input encoding}% [\entrysep] -\entry{setouterhbox}{2007/05/17}{1.6}{Set hbox in outer horizontal mode}% +\entry{setouterhbox}{2007/09/09}{1.7}{Set hbox in outer horizontal mode}% [\entrysep] \entry{settobox}{2007/04/11}{1.3}{Getting box sizes}% [\entrysep] +\entry{soulutf8}{2007/09/09}{1.0}{Adding support for UTF-8 to soul}% +[\entrysep] \entry{stackrel}{2007/05/06}{1.1}{Adding subscript option to stackrel}% [\entrysep] -\entry{stringenc}{2007/06/16}{1.1}{Converts strings between encodings}% +\entry{stringenc}{2007/09/09}{1.2}{Converts strings between encodings}% [\entrysep] \entry{tabularht}{2007/04/11}{2.5}{Tabular with height specification}% [\entrysep] \entry{tabularkv}{2006/02/20}{1.1}{Key value interface for tabular parameters}% [\entrysep] -\entry{telprint}{2007/04/11}{1.8}{Formatting of German phone numbers}% +\entry{telprint}{2007/09/09}{1.9}{Formatting of German phone numbers}% [\entrysep] \entry{transparent}{2007/01/08}{1.0}{Using a pdfTeX's color stack for transparency}% [\entrysep] @@ -296,9 +306,8 @@ share the same counter register and clear list. \subsection{\pkgsectformat{alphalph}} \label{alphalph} \begin{abstract} -The package provides the new expandable commands \cs{alphalph} -and \cs{AlphAlph}. They are like \cs{number}, but the expansion -consists of lowercase and uppercase letters respectively. +The package provides methods to represent numbers with a limited +set of symbols. Both \LaTeX\ and \plainTeX are supported. \end{abstract} \tocinclude{alphalph} @@ -439,7 +448,7 @@ uses of the stack to avoid the error ``out of coor stack space''. \label{embedfile} \begin{abstract} This package embeds files to a PDF document. -Currently \pdfTeX\ >= 1.30 in PDF mode is supported only. +Currently the only supported driver is \pdfTeX\ $>=$ 1.30 in PDF mode. \end{abstract} \tocinclude{embedfile} @@ -622,6 +631,15 @@ serves as more uptodate replacement for package \xpackage{inputenc}. \tocinclude{inputenx} \newpage +\subsection{\pkgsectformat{intcalc}} +\label{intcalc} +\begin{abstract} +This package provides expandable arithmetic operations +with integers. +\end{abstract} +\tocinclude{intcalc} + +\newpage \subsection{\pkgsectformat{kvoptions}} \label{kvoptions} \begin{abstract} @@ -660,6 +678,18 @@ Single pages or page areas can be selected for output. \tocinclude{pagesel} \newpage +\subsection{\pkgsectformat{pdfcol}} +\label{pdfcol} +\begin{abstract} +Since version 1.40 \pdfTeX\ supports color stacks. +The driver file \xfile{pdftex.def} for package \xpackage{color} +defines and uses a main color stack since version v0.04b. +Package \xpackage{pdfcol} is intended for package writers. +It defines macros for setting and maintaining new color stacks. +\end{abstract} +\tocinclude{pdfcol} + +\newpage \subsection{\pkgsectformat{pdfcolfoot}} \label{pdfcolfoot} \begin{abstract} @@ -679,6 +709,26 @@ stack of \pdfTeX. \tocinclude{pdfcolmk} \newpage +\subsection{\pkgsectformat{pdfcolparallel}} +\label{pdfcolparallel} +\begin{abstract} +Since version 1.40 \pdfTeX\ supports several color stacks. +This package uses them to fix color problems in +package \xpackage{parallel}. +\end{abstract} +\tocinclude{pdfcolparallel} + +\newpage +\subsection{\pkgsectformat{pdfcolparcolumns}} +\label{pdfcolparcolumns} +\begin{abstract} +Since version 1.40 \pdfTeX\ supports several color stacks. +This package uses them to fix color problems in +package \xpackage{parcolumns}. +\end{abstract} +\tocinclude{pdfcolparcolumns} + +\newpage \subsection{\pkgsectformat{pdfcrypt}} \label{pdfcrypt} \begin{abstract} @@ -772,6 +822,17 @@ to \LaTeX's \cs{settowidth} commands. \tocinclude{settobox} \newpage +\subsection{\pkgsectformat{soulutf8}} +\label{soulutf8} +\begin{abstract} +This package extends package \xpackage{soul} and adds some support +for UTF-8. Namely the input encodings \xfile{utf8.def} +from package \xpackage{inputenc} and +package \xpackage{ucs}'s \xfile{utf8x.def} are supported. +\end{abstract} +\tocinclude{soulutf8} + +\newpage \subsection{\pkgsectformat{stackrel}} \label{stackrel} \begin{abstract} diff --git a/Master/texmf-dist/source/latex/oberdiek/pagesel.dtx b/Master/texmf-dist/source/latex/oberdiek/pagesel.dtx index 02f8721db94..f1c0b78606e 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pagesel.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pagesel.dtx @@ -607,6 +607,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcol.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcol.dtx new file mode 100644 index 00000000000..76caa82f6b4 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcol.dtx @@ -0,0 +1,942 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file pdfcol.dtx +% and the derived files +% pdfcol.sty, pdfcol.pdf, pdfcol.ins, pdfcol.drv, +% pdfcol-test1.tex, pdfcol-test2.tex, pdfcol-test3.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/pdfcol.dtx +% CTAN:macros/latex/contrib/oberdiek/pdfcol.pdf +% +% Unpacking: +% (a) If pdfcol.ins is present: +% tex pdfcol.ins +% (b) Without pdfcol.ins: +% tex pdfcol.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{pdfcol.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If pdfcol.drv is present: +% latex pdfcol.drv +% (b) Without pdfcol.drv: +% latex pdfcol.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex pdfcol.dtx +% makeindex -s gind.ist pdfcol.idx +% pdflatex pdfcol.dtx +% makeindex -s gind.ist pdfcol.idx +% pdflatex pdfcol.dtx +% +% Installation: +% TDS:tex/generic/oberdiek/pdfcol.sty +% TDS:doc/latex/oberdiek/pdfcol.pdf +% TDS:doc/latex/oberdiek/pdfcol-test1.tex +% TDS:doc/latex/oberdiek/pdfcol-test2.tex +% TDS:doc/latex/oberdiek/pdfcol-test3.tex +% TDS:source/latex/oberdiek/pdfcol.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: pdfcol 2007/09/09 v1.0 Maintaining additional color stacks for pdfTeX (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file pdfcol.dtx +and the derived files + pdfcol.sty, pdfcol.pdf, pdfcol.ins, pdfcol.drv, + pdfcol-test1.tex, pdfcol-test2.tex, pdfcol-test3.tex. + +\endpreamble + +\generate{% + \file{pdfcol.ins}{\from{pdfcol.dtx}{install}}% + \file{pdfcol.drv}{\from{pdfcol.dtx}{driver}}% + \usedir{tex/generic/oberdiek}% + \file{pdfcol.sty}{\from{pdfcol.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{pdfcol-test1.tex}{\from{pdfcol.dtx}{test1}}% + \file{pdfcol-test2.tex}{\from{pdfcol.dtx}{test2}}% + \file{pdfcol-test3.tex}{\from{pdfcol.dtx}{test3}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* pdfcol.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `pdfcol.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{pdfcol.drv}% + [2007/09/09 v1.0 Maintaining additional color stacks for pdfTeX (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\begin{document} + \DocInput{pdfcol.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{499} +% +% \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 \~} +% +% \GetFileInfo{pdfcol.drv} +% +% \title{The \xpackage{pdfcol} package} +% \date{2007/09/09 v1.0} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% Since version 1.40 \pdfTeX\ supports color stacks. +% The driver file \xfile{pdftex.def} for package \xpackage{color} +% defines and uses a main color stack since version v0.04b. +% Package \xpackage{pdfcol} is intended for package writers. +% It defines macros for setting and maintaining new color stacks. +% \end{abstract} +% +% \tableofcontents +% +% \section{Documentation} +% +% Version 1.40 of \pdfTeX\ adds new primitives \cs{pdfcolorstackinit} +% and \cs{pdfcolorstack}. Now color stacks can be defined and used. +% A main color stack is maintained by the driver file \xfile{pdftex.def} +% similar to dvips or dvipdfm. However the number of color stacks +% is not limited to one in \pdfTeX. Thus further color problems +% can now be solved, such as footnotes across pages or text +% that is set in parallel columns (e.g. packages \xpackage{parallel} +% or \xpackage{parcolumn}). Unlike the main color stack, +% the support by additional color stacks cannot be done in +% a transparent manner. +% +% This package \xpackage{pdfcol} provides an easier interface to +% additional color stacks without the need to use the +% low level primitives. +% +% \subsection{Requirements} +% \label{sec:req} +% +% \begin{itemize} +% \item +% \pdfTeX\ 1.40 or greater. +% \item +% \pdfTeX in PDF mode. (I don't know a DVI driver that +% support several color stacks.) +% \item +% \xfile{pdftex.def} 2007/01/02 v0.04b. +% \end{itemize} +% Package \xpackage{pdfcol} checks the requirements and +% sets switch \cs{ifpdfcolAvailable} accordingly. +% +% \subsection{Interface} +% +% \begin{declcs}{ifpdfcolAvailable} +% \end{declcs} +% If the requirements of section \ref{sec:req} are met the +% switch \cs{ifpdfcolAvailable} behaves as \cs{iftrue}. +% Otherwise the other interface macros in this section will +% be disabled with a message. Also the first use of such a +% macro will print a message. The messages are print to +% the \xext{.log} file only if \pdfTeX\ is not used in PDF mode. +% +% \begin{declcs}{pdfcolErrorNoStacks} +% \end{declcs} +% The first call of \cs{pdfcolErrorNoStacks} prints an error +% message, if color stacks are not available. +% +% \begin{declcs}{pdfcolInitStack} \M{name} +% \end{declcs} +% A new color stack is initialized by \cs{pdfcolInitStack}. +% The \meta{name} is used for indentifying the stack. It usually +% consists of letters and digits. (The name must survive a \cs{csname}.) +% +% The intension of the macro is the definition of an additional +% color stack. Thus the stack is not page bounded like the +% main color stack. Black (\texttt{0 g 0 G}) is used as initial +% color value. And colors are written with modifier \texttt{direct} +% that means without setting the current transfer matrix and changing +% the current point (see documentation of \pdfTeX\ for +% |\pdfliteral direct{...}|). +% +% \begin{declcs}{pdfcolIfStackExists} \M{name} \M{then} \M{else} +% \end{declcs} +% Macro \cs{pdfcolIfStackExists} checks whether color stack \meta{name} +% exists. In case of success argument \meta{then} is executed +% and \meta{else} otherwise. +% +% \begin{declcs}{pdfcolSwitchStack} \M{name} +% \end{declcs} +% Macro \cs{pdfcolSwitchStack} switches the color stack. The color macros +% of package \xpackage{color} (or \xpackage{xcolor}) now uses the +% new color stack with name \meta{name}. +% +% \begin{declcs}{pdfcolSetCurrent} \M{name} +% \end{declcs} +% Macro \cs{pdfcolSetCurrent} sets the color that is read in +% the top-most entry of color stack \meta{name}. If \meta{name} +% is empty, the default color stack is used. +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Reload check and package identification} +% Reload check, especially if the package is not used with \LaTeX. +% \begin{macrocode} +\begingroup + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\let\expandafter\x\csname ver@pdfcol.sty\endcsname + \ifcase 0% + \ifx\x\relax % plain + \else + \ifx\x\empty % LaTeX + \else + 1% + \fi + \fi + \else + \expandafter\ifx\csname PackageInfo\endcsname\relax + \def\x#1#2{% + \immediate\write-1{Package #1 Info: #2.}% + }% + \else + \def\x#1#2{\PackageInfo{#1}{#2, stopped}}% + \fi + \x{pdfcol}{The package is already loaded}% + \endgroup + \expandafter\endinput + \fi +\endgroup +% \end{macrocode} +% Package identification: +% \begin{macrocode} +\begingroup + \catcode40 12 % ( + \catcode41 12 % ) + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode47 12 % / + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1#2#3[#4]{\endgroup + \immediate\write-1{Package: #3 #4}% + \xdef#1{#4}% + }% + \else + \def\x#1#2[#3]{\endgroup + #2[{#3}]% + \ifx#1\relax + \xdef#1{#3}% + \fi + }% + \fi +\expandafter\x\csname ver@pdfcol.sty\endcsname +\ProvidesPackage{pdfcol}% + [2007/09/09 v1.0 Maintaining additional color stacks for pdfTeX (HO)] +% \end{macrocode} +% +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname PDFCOL@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\PDFCOL@AtEnd{% + \PDFCOL@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{96}{12}% ` +% \end{macrocode} +% +% \subsection{Check requirements} +% +% \begin{macro}{ifpdfcolAvailable} +% \begin{macrocode} +\newif\ifpdfcolAvailable +\pdfcolAvailabletrue +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PDFCOL@RequirePackage} +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax + \def\PDFCOL@RequirePackage#1[#2]{\input #1.sty\relax}% +\else + \def\PDFCOL@RequirePackage#1[#2]{% + \RequirePackage{#1}[{#2}]% + }% +\fi +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Check PDF mode} +% +% \begin{macrocode} +\PDFCOL@RequirePackage{infwarerr}[2007/09/09] +\PDFCOL@RequirePackage{ifpdf}[2007/09/09] +\ifpdf + \def\PDFCOL@Message{% + \@PackageWarningNoLine{pdfcol}% + }% +\else + \pdfcolAvailablefalse + \def\PDFCOL@Message{% + \@PackageInfoNoLine{pdfcol}% + }% + \PDFCOL@Message{% + Interface disabled because of missing PDF mode of pdfTeX% + }% +\fi +% \end{macrocode} +% +% \subsubsection{Check version of \pdfTeX} +% +% \begin{macrocode} +\ifpdfcolAvailable + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfcolorstack\endcsname\relax + \pdfcolAvailablefalse + \PDFCOL@Message{% + Interface disabled because of too old pdfTeX.\MessageBreak + Required is version 1.40+ for \string\pdfcolorstack + }% + \fi +\fi +\ifpdfcolAvailable + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfcolorstack\endcsname\relax + \pdfcolAvailablefalse + \PDFCOL@Message{% + Interface disabled because of too old pdfTeX.\MessageBreak + Required is version 1.40+ for \string\pdfcolorstackinit + }% + \fi +\fi +% \end{macrocode} +% +% \subsubsection{Check \xfile{pdftex.def}} +% +% \begin{macrocode} +\ifpdfcolAvailable + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname @pdfcolorstack\endcsname\relax +% \end{macrocode} +% Try to load package color if it is not yet loaded (\LaTeX\ case). +% \begin{macrocode} + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname ver@color.sty\endcsname\relax + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname documentclass\endcsname\relax + \else + \RequirePackage[pdftex]{color}\relax + \fi + \fi + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname @pdfcolorstack\endcsname\relax + \pdfcolAvailablefalse + \PDFCOL@Message{% + Interface disabled because `pdftex.def'\MessageBreak + is not loaded or it is too old.\MessageBreak + Required is version 0.04b or greater% + }% + \fi + \fi +\fi +% \end{macrocode} +% +% \begin{macrocode} +\let\pdfcolAvailabletrue\relax +\let\pdfcolAvailablefalse\relax +% \end{macrocode} +% +% \subsection{Enabled interface macros} +% +% \begin{macrocode} +\ifpdfcolAvailable +% \end{macrocode} +% +% \begin{macro}{\pdfcolErrorNoStacks} +% \begin{macrocode} + \let\pdfcolErrorNoStacks\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcol@Value} +% \begin{macrocode} + \expandafter\ifx\csname pdfcol@Value\endcsname\relax + \def\pdfcol@Value{0 g 0 G}% + \fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcol@LiteralModifier} +% \begin{macrocode} + \expandafter\ifx\csname pdfcol@LiteralModifier\endcsname\relax + \def\pdfcol@LiteralModifier{direct}% + \fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolInitStack} +% \begin{macrocode} + \def\pdfcolInitStack#1{% + \expandafter\ifx\csname pdfcol@Stack@#1\endcsname\relax + \global\expandafter\chardef\csname pdfcol@Stack@#1\endcsname=% + \pdfcolorstackinit\pdfcol@LiteralModifier{\pdfcol@Value}% + \relax + \@PackageInfo{pdfcol}{% + New color stack `#1' = \number\csname pdfcol@Stack@#1\endcsname + }% + \else + \@PackageError{pdfcol}{% + Stack `#1' is already defined% + }\@ehc + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolIfStackExists} +% \begin{macrocode} + \def\pdfcolIfStackExists#1{% + \expandafter\ifx\csname pdfcol@Stack@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@firstoftwo} +% \begin{macrocode} + \expandafter\ifx\csname @firstoftwo\endcsname\relax + \long\def\@firstoftwo#1#2{#1}% + \fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@secondoftwo} +% \begin{macrocode} + \expandafter\ifx\csname @secondoftwo\endcsname\relax + \long\def\@secondoftwo#1#2{#2}% + \fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolSwitchStack} +% \begin{macrocode} + \def\pdfcolSwitchStack#1{% + \pdfcolIfStackExists{#1}{% + \expandafter\let\expandafter\@pdfcolorstack + \csname pdfcol@Stack@#1\endcsname + }{% + \pdfcol@ErrorNoStack{#1}% + }% + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolSetCurrent} +% \begin{macrocode} + \def\pdfcolSetCurrent#1{% + \ifx\\#1\\% + \pdfcolorstack\@pdfcolorstack current\relax + \else + \pdfcolIfStackExists{#1}{% + \pdfcolorstack\csname pdfcol@Stack@#1\endcsname current\relax + }{% + \pdfcol@ErrorNoStack{#1}% + }% + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcol@ErrorNoStack} +% \begin{macrocode} + \def\pdfcol@ErrorNoStack#1{% + \@PackageError{pdfcol}{Stack `#1' does not exists}\@ehc + }% +% \end{macrocode} +% \end{macro} +% +% \subsection{Disabled interface macros} +% +% \begin{macrocode} +\else +% \end{macrocode} +% +% \begin{macro}{\pdfcolErrorNoStacks} +% \begin{macrocode} + \def\pdfcolErrorNoStacks{% + \@PackageError{pdfcol}{% + Color stacks are not available% + }{% + Update pdfTeX (1.40) and `pdftex.def' (0.04b) % + if necessary.\MessageBreak + Ensure that `pdftex.def' is loaded % + (package `color' or `xcolor').\MessageBreak + Further messages can be found in TeX's % + protocol file `\jobname.log'.\MessageBreak + \MessageBreak + \@ehc + }% + \global\let\pdfcolErrorNoStacks\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PDFCOL@Disabled} +% \begin{macrocode} + \def\PDFCOL@Disabled{% + \PDFCOL@Message{% + pdfTeX's color stacks are not available% + }% + \global\let\PDFCOL@Disabled\relax + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolInitStack} +% \begin{macrocode} + \def\pdfcolInitStack#1{% + \PDFCOL@Disabled + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolIfStackExists} +% \begin{macrocode} + \long\def\pdfcolIfStackExists#1#2#3{#3}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolSwitchStack} +% \begin{macrocode} + \def\pdfcolSwitchStack#1{% + \PDFCOL@Disabled + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pdfcolSetCurrent} +% \begin{macrocode} + \def\pdfcolSetCurrent#1{% + \PDFCOL@Disabled + }% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \begin{macrocode} +\PDFCOL@AtEnd +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input pdfcol.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Very simple test} +% +% \begin{macrocode} +%<*test2|test3> +\NeedsTeXFormat{LaTeX2e} +\nofiles +\documentclass{article} +\usepackage{pdfcol}[2007/09/09] +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +\begin{document} + \begin{qstest}{pdfcol}{}% + \makeatletter +%<*test2> + \Expect*{\ifpdfcolAvailable true\else false\fi}{false}% +%</test2> +%<*test3> + \Expect*{\ifpdfcolAvailable true\else false\fi}{true}% + \Expect*{\number\@pdfcolorstack}{0}% +%</test3> + \setbox0=\hbox{% + \pdfcolInitStack{test}% +%<*test3> + \Expect*{\number\pdfcol@Stack@test}{1}% + \Expect*{\number\@pdfcolorstack}{0}% +%</test3> + \pdfcolSwitchStack{test}% +%<*test3> + \Expect*{\number\@pdfcolorstack}{1}% +%</test3> + \pdfcolSetCurrent{test}% + \pdfcolSetCurrent{}% + }% + \Expect*{\the\wd0}{0.0pt}% +%<*test3> + \Expect*{\number\@pdfcolorstack}{0}% + \Expect*{\number\pdfcol@Stack@test}{1}% + \Expect*{\pdfcolIfStackExists{test}{true}{false}}{true}% +%</test3> + \Expect*{\pdfcolIfStackExists{dummy}{true}{false}}{false}% + \end{qstest}% +\end{document} +%</test2|test3> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcol.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcol.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek-tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex pdfcol.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% pdfcol.sty & tex/generic/oberdiek/pdfcol.sty\\ +% pdfcol.pdf & doc/latex/oberdiek/pdfcol.pdf\\ +% pdfcol-test1.tex & doc/latex/oberdiek/pdfcol-test1.tex\\ +% pdfcol-test2.tex & doc/latex/oberdiek/pdfcol-test2.tex\\ +% pdfcol-test3.tex & doc/latex/oberdiek/pdfcol-test3.tex\\ +% pdfcol.dtx & source/latex/oberdiek/pdfcol.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk pdfcol.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{pdfcol.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex pdfcol.dtx +%makeindex -s gind.ist pdfcol.idx +%pdflatex pdfcol.dtx +%makeindex -s gind.ist pdfcol.idx +%pdflatex pdfcol.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{History} +% \begin{Version}{2007/09/09 v1.0} +% \item +% First version. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcolfoot.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcolfoot.dtx index d21afa50a89..2b30d204b11 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdfcolfoot.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcolfoot.dtx @@ -16,7 +16,8 @@ % % This work consists of the main source file pdfcolfoot.dtx % and the derived files -% pdfcolfoot.sty, pdfcolfoot.pdf, pdfcolfoot.ins, pdfcolfoot.drv. +% pdfcolfoot.sty, pdfcolfoot.pdf, pdfcolfoot.ins, pdfcolfoot.drv, +% pdfcolfoot-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/pdfcolfoot.dtx @@ -51,6 +52,7 @@ % Installation: % TDS:tex/latex/oberdiek/pdfcolfoot.sty % TDS:doc/latex/oberdiek/pdfcolfoot.pdf +% TDS:doc/latex/oberdiek/pdfcolfoot-test1.tex % TDS:source/latex/oberdiek/pdfcolfoot.dtx % %<*ignore> @@ -66,7 +68,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: pdfcolfoot 2007/01/08 v1.0 pdfTeX's color stack for footnotes (HO)} +\Msg{* Package: pdfcolfoot 2007/09/09 v1.1 pdfTeX's color stack for footnotes (HO)} \Msg{************************************************************************} \keepsilent @@ -92,7 +94,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file pdfcolfoot.dtx and the derived files - pdfcolfoot.sty, pdfcolfoot.pdf, pdfcolfoot.ins, pdfcolfoot.drv. + pdfcolfoot.sty, pdfcolfoot.pdf, pdfcolfoot.ins, pdfcolfoot.drv, + pdfcolfoot-test1.tex. \endpreamble @@ -101,6 +104,8 @@ and the derived files \file{pdfcolfoot.drv}{\from{pdfcolfoot.dtx}{driver}}% \usedir{tex/latex/oberdiek}% \file{pdfcolfoot.sty}{\from{pdfcolfoot.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{pdfcolfoot-test1.tex}{\from{pdfcolfoot.dtx}{test1}}% } \obeyspaces @@ -126,7 +131,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{pdfcolfoot.drv}% - [2007/01/08 v1.0 pdfTeX's color stack for footnotes (HO)]% + [2007/09/09 v1.1 pdfTeX's color stack for footnotes (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -135,7 +140,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{249} +% \CheckSum{238} % % \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 @@ -156,7 +161,7 @@ and the derived files % \GetFileInfo{pdfcolfoot.drv} % % \title{The \xpackage{pdfcolfoot} package} -% \date{2007/01/08 v1.0} +% \date{2007/09/09 v1.1} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -255,46 +260,17 @@ and the derived files %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pdfcolfoot}% - [2007/01/08 v1.0 pdfTeX's color stack for footnotes (HO)]% + [2007/09/09 v1.1 pdfTeX's color stack for footnotes (HO)]% % \end{macrocode} % -% \subsection{Initial checks} +% \subsection{Load package \xpackage{pdfcol}} % -% \subsubsection{Check for \pdfTeX\ in PDF mode} % \begin{macrocode} -\RequirePackage{ifpdf} -\ifpdf +\RequirePackage{pdfcol}[2007/09/09] +\ifpdfcolAvailable \else - \PackageWarningNoLine{pdfcolfoot}{% - Loading aborted, because pdfTeX is not running in PDF mode% - }% - \expandafter\endinput -\fi -% \end{macrocode} -% -% \subsubsection{Check \pdfTeX\ version} -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname pdfcolorstackinit\endcsname\relax - \PackageWarningNoLine{pdfcolfoot}{% - Your pdfTeX version does not support color stacks% - }% - \expandafter\endinput -\fi -% \end{macrocode} -% -% \subsubsection{Check \xfile{pdftex.def} version} -% Force loading of package color with \xfile{pdftex.def}, if this -% is not already done. -% \begin{macrocode} -\@ifpackageloaded{color}{}{\RequirePackage[pdftex]{color}} -% \end{macrocode} -% Now we can check the minimal version requirement of \xfile{pdftex.def}. -% \begin{macrocode} -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname @pdfcolorstack\endcsname\relax - \PackageWarningNoLine{pdfcolfoot}{% - Your pdftex.def is too old, you need at least 2007/01/02 v0.04b% + \PackageInfo{pdfcolfoot}{% + Loading aborted, because color stacks are not available% }% \expandafter\endinput \fi @@ -302,21 +278,11 @@ and the derived files % % \subsection{Color stack for footnotes} % -% I do not know, why pdftex.def (or other drivers do not define -% \cs{default@color}. Instead they are defining \cs{current@color}. -% Therefore it is assumed that in the preamble this color for black -% is still valid. +% Version 1.0 has used \cs{current@color} as initial color stack +% value, since version 1.1 package \xpackage{pdfcol} with its +% default setting is used. % \begin{macrocode} -\newcommand{\pdfcolfoot@stack}{} -\edef\pdfcolfoot@stack{% - \pdfcolorstackinit direct{\current@color}% -} -\begingroup - \let\on@line\@empty - \PackageInfo{pdfcolfoot}{% - Color stack number: \pdfcolfoot@stack - }% -\endgroup +\pdfcolInitStack{foot} % \end{macrocode} % % \subsection{Patch \cs{@makefntext}} @@ -326,7 +292,7 @@ and the derived files % color calls uses the color stack for footnotes. % \begin{macrocode} \newcommand*{\pdfcolfoot@switch}{% - \let\@pdfcolorstack\pdfcolfoot@stack + \pdfcolSwitchStack{foot}% } % \end{macrocode} % \end{macro} @@ -355,7 +321,7 @@ and the derived files % is available on the current top of the color stack. % \begin{macrocode} \newcommand*{\pdfcolfoot@current}{% - \pdfcolorstack\pdfcolfoot@stack current\relax + \pdfcolSetCurrent{foot}% } % \end{macrocode} % \end{macro} @@ -505,6 +471,34 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% +% \section{Test} +% +% \begin{macrocode} +%<*test1> +\NeedsTeXFormat{LaTeX2e} +\AtEndDocument{% + \typeout{}% + \typeout{**************************************}% + \typeout{*** \space Check the PDF file manually! \space ***}% + \typeout{**************************************}% + \typeout{}% +} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdfcompresslevel\endcsname\relax +\else + \pdfcompresslevel=0 % +\fi +\documentclass[12pt,a5paper]{article} +\usepackage{pdfcolfoot}[2007/09/09] +\dimen\footins=\baselineskip % for testing +\begin{document} + Black\footnote{Black \textcolor{blue}{Blue\\Blue} Black} % + \textcolor{red}{Red\newpage Red} Black% +\end{document} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -566,6 +560,7 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % pdfcolfoot.sty & tex/latex/oberdiek/pdfcolfoot.sty\\ % pdfcolfoot.pdf & doc/latex/oberdiek/pdfcolfoot.pdf\\ +% pdfcolfoot-test1.tex & doc/latex/oberdiek/pdfcolfoot-test1.tex\\ % pdfcolfoot.dtx & source/latex/oberdiek/pdfcolfoot.dtx\\ % \end{tabular}^^A % }^^A @@ -686,11 +681,26 @@ and the derived files %\end{verbatim} % \end{quote} % +% \begin{thebibliography}{9} +% +% \bibitem{pdfcol} +% Heiko Oberdiek: \textit{The \xpackage{pdfcol} package}; +% 2007/09/09;\\ +% \CTAN{macros/latex/contrib/oberdiek/pdfcol.pdf}. +% +% \end{thebibliography} +% % \begin{History} % \begin{Version}{2007/01/08 v1.0} % \item % First version. % \end{Version} +% \begin{Version}{2007/09/09 v1.1} +% \item +% Use of package \xpackage{pdfcol}. +% \item +% Test file added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcolmk.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcolmk.dtx index 25cc7817acf..387a2a58298 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdfcolmk.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcolmk.dtx @@ -742,6 +742,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx new file mode 100644 index 00000000000..55f23261284 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx @@ -0,0 +1,890 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file pdfcolparallel.dtx +% and the derived files +% pdfcolparallel.sty, pdfcolparallel.pdf, pdfcolparallel.ins, pdfcolparallel.drv, +% pdfcolparallel-test1.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/pdfcolparallel.dtx +% CTAN:macros/latex/contrib/oberdiek/pdfcolparallel.pdf +% +% Unpacking: +% (a) If pdfcolparallel.ins is present: +% tex pdfcolparallel.ins +% (b) Without pdfcolparallel.ins: +% tex pdfcolparallel.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{pdfcolparallel.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If pdfcolparallel.drv is present: +% latex pdfcolparallel.drv +% (b) Without pdfcolparallel.drv: +% latex pdfcolparallel.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex pdfcolparallel.dtx +% makeindex -s gind.ist pdfcolparallel.idx +% pdflatex pdfcolparallel.dtx +% makeindex -s gind.ist pdfcolparallel.idx +% pdflatex pdfcolparallel.dtx +% +% Installation: +% TDS:tex/latex/oberdiek/pdfcolparallel.sty +% TDS:doc/latex/oberdiek/pdfcolparallel.pdf +% TDS:doc/latex/oberdiek/pdfcolparallel-test1.tex +% TDS:source/latex/oberdiek/pdfcolparallel.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: pdfcolparallel 2007/09/09 v1.0 Color stacks support for parallel (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file pdfcolparallel.dtx +and the derived files + pdfcolparallel.sty, pdfcolparallel.pdf, pdfcolparallel.ins, pdfcolparallel.drv, + pdfcolparallel-test1.tex. + +\endpreamble + +\generate{% + \file{pdfcolparallel.ins}{\from{pdfcolparallel.dtx}{install}}% + \file{pdfcolparallel.drv}{\from{pdfcolparallel.dtx}{driver}}% + \usedir{tex/latex/oberdiek}% + \file{pdfcolparallel.sty}{\from{pdfcolparallel.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{pdfcolparallel-test1.tex}{\from{pdfcolparallel.dtx}{test1}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* pdfcolparallel.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `pdfcolparallel.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{pdfcolparallel.drv}% + [2007/09/09 v1.0 Color stacks support for parallel (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\begin{document} + \DocInput{pdfcolparallel.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{582} +% +% \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 \~} +% +% \GetFileInfo{pdfcolparallel.drv} +% +% \title{The \xpackage{pdfcolparallel} package} +% \date{2007/09/09 v1.0} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% Since version 1.40 \pdfTeX\ supports several color stacks. +% This package uses them to fix color problems in +% package \xpackage{parallel}. +% \end{abstract} +% +% \tableofcontents +% +% \section{Usage} +% +% \begin{quote} +% |\usepackage{pdfcolparallel}| +% \end{quote} +% The package \xpackage{pdfcolparallel} loads package \xpackage{parallel} +% \cite{parallel}. If color stacks are available then the +% macros of \xpackage{parallel} are patched to add support +% for color stacks. +% +% \subsection{Future} +% +% If there will be a new version of package \xpackage{parallel} +% that adds support for color stacks, then this package may become +% obsolete. +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \subsection{Identification} +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pdfcolparallel}% + [2007/09/09 v1.0 Color stacks support for parallel (HO)]% +% \end{macrocode} +% +% \subsection{Load packages} +% +% \subsubsection{Package \xpackage{parallel}} +% +% Package \xpackage{parallel} is loaded. Before options of package +% \xpackage{pdfcolparallel} are passed to package \xpackage{parallel}. +% \begin{macrocode} +\DeclareOption*{% + \PassoptionsToPackage{\CurrentOption}{parallel}% +} +\ProcessOptions\relax +\RequirePackage{parallel}[2003/04/13] +% \end{macrocode} +% +% \subsubsection{Package \xpackage{pdfcol}} +% +% \begin{macrocode} +\RequirePackage{pdfcol}[2007/09/09] +\ifpdfcolAvailable +\else + \PackageInfo{pdfcolparallel}{% + Loading aborted, because color stacks are not available% + }% + \expandafter\endinput +\fi +% \end{macrocode} +% +% \subsubsection{Package \xpackage{infwarerr}} +% +% \begin{macrocode} +\RequirePackage{infwarerr}[2007/09/09] +% \end{macrocode} +% +% \subsection{Color stack macros} +% +% \begin{macrocode} +\pdfcolInitStack{pcp@Left} +\pdfcolInitStack{pcp@Right} +% \end{macrocode} +% \begin{macro}{\pcp@SwitchStack} +% \begin{macrocode} +\def\pcp@SwitchStack#1{% + \pdfcolSwitchStack{pcp@#1}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\pcp@SetCurrent} +% \begin{macrocode} +\def\pcp@SetCurrent#1{% + \ifx\\#1\\% + \pdfcolSetCurrent{}% + \else + \pdfcolSetCurrent{pcp@#1}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Redefinitions} +% +% \begin{macro}{\pcp@CmdCheckRedef} +% \begin{macrocode} +\def\pcp@CmdCheckRedef#1{% + \begingroup + \def\pcp@cmd{#1}% + \afterassignment\pcp@CmdDo + \long\def\reserved@a +} +\def\pcp@CmdDo{% + \expandafter\ifx\pcp@cmd\reserved@a + \else + \edef\x*{\expandafter\string\pcp@cmd}% + \@PackageWarningNoLine{pdfcolparallel}{% + Command \x* has changed.\MessageBreak + Supported versions of package `parallel':\MessageBreak + \space\space 2003/04/13\MessageBreak + The redefinition of \x* may\MessageBreak + not behave correctly depending on the changes% + }% + \fi + \expandafter\endgroup + \expandafter\def\pcp@cmd +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ParallelLText} +% \begin{macrocode} +\pcp@CmdCheckRedef\ParallelLText{% + \everypar{}% + \@restorepar + \begingroup + \hbadness=3000 % + \let\footnote=\ParallelLFootnote + \ParallelWhichBox=0 % + \global\setbox\ParallelLBox=\vbox\bgroup + \hsize=\ParallelLWidth + \aftergroup\ParallelAfterText + \begingroup + \afterassignment\ParallelCheckOpenBrace + \let\x=% +}{% + \everypar{}% + \@restorepar + \begingroup + \hbadness=3000 % + \let\footnote=\ParallelLFootnote + \ParallelWhichBox=0 % + \global\setbox\ParallelLBox=\vbox\bgroup + \hsize=\ParallelLWidth + \pcp@SwitchStack{Left}% + \aftergroup\ParallelAfterText + \begingroup + \afterassignment\ParallelCheckOpenBrace + \let\x=% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ParallelRText} +% \begin{macrocode} +\pcp@CmdCheckRedef\ParallelRText{% + \everypar{}% + \@restorepar + \begingroup + \hbadness=3000 % + \ifnum\ParallelFNMode=\@ne + \let\footnote=\ParallelRFootnote + \else + \let\footnote=\ParallelLFootnote + \fi + \ParallelWhichBox=\@ne + \global\setbox\ParallelRBox=\vbox\bgroup + \hsize=\ParallelRWidth + \aftergroup\ParallelAfterText + \begingroup + \afterassignment\ParallelCheckOpenBrace + \let\x=% +}{% + \everypar{}% + \@restorepar + \begingroup + \hbadness=3000 % + \ifnum\ParallelFNMode=\@ne + \let\footnote=\ParallelRFootnote + \else + \let\footnote=\ParallelLFootnote + \fi + \ParallelWhichBox=\@ne + \global\setbox\ParallelRBox=\vbox\bgroup + \hsize=\ParallelRWidth + \pcp@SwitchStack{Right}% + \aftergroup\ParallelAfterText + \begingroup + \afterassignment\ParallelCheckOpenBrace + \let\x=% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ParallelParOnePage} +% \begin{macrocode} +\pcp@CmdCheckRedef\ParallelParOnePage{% + \ifnum\ParallelBoolVar=\@ne + \par + \begingroup + \leftmargin=\z@ + \rightmargin=\z@ + \parskip=\z@skip + \parindent=\z@ + \vbadness=10000 % + \vfuzz=3ex % + \splittopskip=\z@skip + \loop + \ifnum\ParallelBoolVar=\@ne + \noindent + \hbox to\textwidth{% + \hskip\ParallelLeftMargin + \hbox to\ParallelTextWidth{% + \ifvoid\ParallelLBox + \hskip\ParallelLWidth + \else + \ParallelWhichBox=\z@ + \vbox{% + \setbox\ParallelBoxVar + =\vsplit\ParallelLBox to\dp\strutbox + \unvbox\ParallelBoxVar + }% + \fi + \strut + \ifnum\ParallelBoolMid=\@ne + \hskip\ParallelMainMidSkip + \vrule + \else + \hss + \fi + \hss + \ifvoid\ParallelRBox + \hskip\ParallelRWidth + \else + \ParallelWhichBox=\@ne + \vbox{% + \setbox\ParallelBoxVar + =\vsplit\ParallelRBox to\dp\strutbox + \unvbox\ParallelBoxVar + }% + \fi + }% + }% + \ifvoid\ParallelLBox + \ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi + \fi% + \fi% + \ifnum\ParallelBoolVar=\@ne + \penalty\interlinepenalty + \repeat + \par + \endgroup + \fi +}{% + \ifnum\ParallelBoolVar=\@ne + \par + \begingroup + \leftmargin=\z@ + \rightmargin=\z@ + \parskip=\z@skip + \parindent=\z@ + \vbadness=10000 % + \vfuzz=3ex % + \splittopskip=\z@skip + \loop + \ifnum\ParallelBoolVar=\@ne + \noindent + \hbox to\textwidth{% + \hskip\ParallelLeftMargin + \hbox to\ParallelTextWidth{% + \ifvoid\ParallelLBox + \hskip\ParallelLWidth + \else + \pcp@SetCurrent{Left}% + \ParallelWhichBox=\z@ + \vbox{% + \setbox\ParallelBoxVar + =\vsplit\ParallelLBox to\dp\strutbox + \unvbox\ParallelBoxVar + }% + \fi + \strut + \ifnum\ParallelBoolMid=\@ne + \hskip\ParallelMainMidSkip + \vrule + \else + \hss + \fi + \hss + \ifvoid\ParallelRBox + \hskip\ParallelRWidth + \else + \pcp@SetCurrent{Right}% + \ParallelWhichBox=\@ne + \vbox{% + \setbox\ParallelBoxVar + =\vsplit\ParallelRBox to\dp\strutbox + \unvbox\ParallelBoxVar + }% + \fi + }% + }% + \ifvoid\ParallelLBox + \ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi + \fi% + \fi% + \ifnum\ParallelBoolVar=\@ne + \penalty\interlinepenalty + \repeat + \par + \endgroup + \pcp@SetCurrent{}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ParallelParTwoPages} +% \begin{macrocode} +\pcp@CmdCheckRedef\ParallelParTwoPages{% + \ifnum\ParallelBoolVar=\@ne + \par + \begingroup + \global\ParallelWhichBox=\@ne + \newpage + \vbadness=10000 % + \vfuzz=3ex % + \splittopskip=\z@skip + \loop% + \ifnum\ParallelBoolVar=\@ne% + \ifnum\ParallelWhichBox=\@ne + \ifvoid\ParallelLBox + \mbox{} % + \newpage + \else + \global\ParallelWhichBox=\z@ + \fi + \else + \ifvoid\ParallelRBox + \mbox{} % + \newpage + \else + \global\ParallelWhichBox=\@ne + \fi + \fi + \ifnum\ParallelWhichBox=\z@ + \ifodd\thepage + \mbox{} % + \newpage + \fi + \hbox to\textwidth{% + \vbox{\vsplit\ParallelLBox to.98\textheight}% + }% + \else + \ifodd\thepage\relax + \else + \mbox{} % + \newpage + \fi + \hbox to\textwidth{% + \vbox{\vsplit\ParallelRBox to.98\textheight}% + }% + \fi + \vspace*{\fill}% + \newpage + \fi + \ifvoid\ParallelLBox + \ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi + \fi + \ifnum\ParallelBoolVar=\@ne + \repeat + \par + \endgroup + \fi +}{% +% \end{macrocode} +% Additional fixes: +% \begin{itemize} +% \item Unnecessary white space removed. +% \item |\ifodd\thepage| changed to |\ifodd\value{page}|. +% \end{itemize} +% \begin{macrocode} + \ifnum\ParallelBoolVar=\@ne + \par + \begingroup + \global\ParallelWhichBox=\@ne + \newpage + \vbadness=10000 % + \vfuzz=3ex % + \splittopskip=\z@skip + \loop% + \ifnum\ParallelBoolVar=\@ne% + \ifnum\ParallelWhichBox=\@ne + \ifvoid\ParallelLBox + \mbox{}% + \newpage + \else + \global\ParallelWhichBox=\z@ + \fi + \else + \ifvoid\ParallelRBox + \mbox{}% + \newpage + \else + \global\ParallelWhichBox=\@ne + \fi + \fi + \ifnum\ParallelWhichBox=\z@ + \ifodd\value{page}% + \mbox{}% + \newpage + \fi + \hbox to\textwidth{% + \pcp@SetCurrent{Left}% + \vbox{\vsplit\ParallelLBox to.98\textheight}% + }% + \else + \ifodd\value{page}% + \else + \mbox{}% + \newpage + \fi + \hbox to\textwidth{% + \pcp@SetCurrent{Right}% + \vbox{\vsplit\ParallelRBox to.98\textheight}% + }% + \fi + \vspace*{\fill}% + \newpage + \fi + \ifvoid\ParallelLBox + \ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi + \fi + \ifnum\ParallelBoolVar=\@ne + \repeat + \par + \endgroup + \pcp@SetCurrent{}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section{Test} +% +% The test file is a modified version of the file that +% Alexander Hirsch has posted in \xnewsgroup{de.comp.text.tex}. +% \begin{macrocode} +%<*test1> +\AtEndDocument{% + \typeout{}% + \typeout{**************************************}% + \typeout{*** \space Check the PDF file manually! \space ***}% + \typeout{**************************************}% + \typeout{}% +} +\documentclass{article} +\usepackage{xcolor} +\usepackage{pdfcolparallel}[2007/09/09] + +\begin{document} + \color{green}% + Green% + \begin{Parallel}{0.47\textwidth}{0.47\textwidth}% + \ParallelLText{% + \textcolor{red}{% + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll.% + }% + }% + \ParallelRText{% + \textcolor{blue}{% + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll.% + }% + }% + \end{Parallel}% + Green% + \begin{Parallel}[p]{\textwidth}{\textwidth}% + \ParallelLText{% + \textcolor{red}{% + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Foo bar bla bla bla.% + }% + }% + \ParallelRText{% + \textcolor{blue}{% + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. % + Foo bar bla bla bla.% + }% + }% + \end{Parallel}% + Green% +\end{document} +%</test1> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcolparallel.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcolparallel.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek-tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex pdfcolparallel.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% pdfcolparallel.sty & tex/latex/oberdiek/pdfcolparallel.sty\\ +% pdfcolparallel.pdf & doc/latex/oberdiek/pdfcolparallel.pdf\\ +% pdfcolparallel-test1.tex & doc/latex/oberdiek/pdfcolparallel-test1.tex\\ +% pdfcolparallel.dtx & source/latex/oberdiek/pdfcolparallel.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk pdfcolparallel.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{pdfcolparallel.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex pdfcolparallel.dtx +%makeindex -s gind.ist pdfcolparallel.idx +%pdflatex pdfcolparallel.dtx +%makeindex -s gind.ist pdfcolparallel.idx +%pdflatex pdfcolparallel.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{thebibliography}{9} +% +% \bibitem{parallel} +% Matthias Eckermann: \textit{The \xpackage{parallel}-package}; +% 2003/04/13;\\ +% \CTAN{macros/latex/contrib/parallel/}. +% +% \bibitem{pdfcol} +% Heiko Oberdiek: \textit{The \xpackage{pdfcol} package}; +% 2007/09/09;\\ +% \CTAN{macros/latex/contrib/oberdiek/pdfcol.pdf}. +% +% \end{thebibliography} +% +% \begin{History} +% \begin{Version}{2007/09/09 v1.0} +% \item +% First version. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcolparcolumns.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcolparcolumns.dtx new file mode 100644 index 00000000000..c52373c9e25 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcolparcolumns.dtx @@ -0,0 +1,686 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file pdfcolparcolumns.dtx +% and the derived files +% pdfcolparcolumns.sty, pdfcolparcolumns.pdf, pdfcolparcolumns.ins, pdfcolparcolumns.drv, +% pdfcolparcolumns-test1.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/pdfcolparcolumns.dtx +% CTAN:macros/latex/contrib/oberdiek/pdfcolparcolumns.pdf +% +% Unpacking: +% (a) If pdfcolparcolumns.ins is present: +% tex pdfcolparcolumns.ins +% (b) Without pdfcolparcolumns.ins: +% tex pdfcolparcolumns.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{pdfcolparcolumns.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If pdfcolparcolumns.drv is present: +% latex pdfcolparcolumns.drv +% (b) Without pdfcolparcolumns.drv: +% latex pdfcolparcolumns.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex pdfcolparcolumns.dtx +% makeindex -s gind.ist pdfcolparcolumns.idx +% pdflatex pdfcolparcolumns.dtx +% makeindex -s gind.ist pdfcolparcolumns.idx +% pdflatex pdfcolparcolumns.dtx +% +% Installation: +% TDS:tex/latex/oberdiek/pdfcolparcolumns.sty +% TDS:doc/latex/oberdiek/pdfcolparcolumns.pdf +% TDS:doc/latex/oberdiek/pdfcolparcolumns-test1.tex +% TDS:source/latex/oberdiek/pdfcolparcolumns.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: pdfcolparcolumns 2007/09/09 v1.1 Color stacks support for parcolumns (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file pdfcolparcolumns.dtx +and the derived files + pdfcolparcolumns.sty, pdfcolparcolumns.pdf, pdfcolparcolumns.ins, pdfcolparcolumns.drv, + pdfcolparcolumns-test1.tex. + +\endpreamble + +\generate{% + \file{pdfcolparcolumns.ins}{\from{pdfcolparcolumns.dtx}{install}}% + \file{pdfcolparcolumns.drv}{\from{pdfcolparcolumns.dtx}{driver}}% + \usedir{tex/latex/oberdiek}% + \file{pdfcolparcolumns.sty}{\from{pdfcolparcolumns.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{pdfcolparcolumns-test1.tex}{\from{pdfcolparcolumns.dtx}{test1}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* pdfcolparcolumns.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `pdfcolparcolumns.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{pdfcolparcolumns.drv}% + [2007/09/09 v1.1 Color stacks support for parcolumns (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\begin{document} + \DocInput{pdfcolparcolumns.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{263} +% +% \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 \~} +% +% \GetFileInfo{pdfcolparcolumns.drv} +% +% \title{The \xpackage{pdfcolparcolumns} package} +% \date{2007/09/09 v1.1} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% Since version 1.40 \pdfTeX\ supports several color stacks. +% This package uses them to fix color problems in +% package \xpackage{parcolumns}. +% \end{abstract} +% +% \tableofcontents +% +% \section{Usage} +% +% \begin{quote} +% |\usepackage{pdfcolparcolumns}| +% \end{quote} +% The package \xpackage{pdfcolparcolumns} loads package \xpackage{parcolums} +% \cite{parcolumns}. If color stacks are available then the +% macros of \xpackage{parcolumns} are patched to add support +% for color stacks. +% +% \subsection{Future} +% +% Currently package \xpackage{parcolumns} does not seem to be +% maintained. Nevertheless if there will be a new version that +% adds support for color stacks, then this package may become +% obsolete. +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \subsection{Identification} +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pdfcolparcolumns}% + [2007/09/09 v1.1 Color stacks support for parcolumns (HO)]% +% \end{macrocode} +% +% \subsection{Load packages} +% +% \subsubsection{Package \xpackage{parcolumns}} +% +% Currently package \xpackage{parcolumns} does not define options. +% Thus it is just a precaution that the options of +% package \xpackage{pdfcolparcolumns} are passed to +% package \xpackage{parcolumns}. +% \begin{macrocode} +\DeclareOption*{% + \PassoptionsToPackage{\CurrentOption}{parcolumns}% +} +\ProcessOptions\relax +\RequirePackage{parcolumns}[2004/11/25] +% \end{macrocode} +% +% \subsubsection{Package \xpackage{pdfcol}} +% +% \begin{macrocode} +\RequirePackage{pdfcol}[2007/09/09] +\ifpdfcolAvailable +\else + \PackageInfo{pdfcolparcolumns}{% + Loading aborted, because color stacks are not available% + }% + \expandafter\endinput +\fi +% \end{macrocode} +% +% \subsubsection{Package \xpackage{infwarerr}} +% +% \begin{macrocode} +\RequirePackage{infwarerr}[2007/09/09] +% \end{macrocode} +% +% \subsection{Color stack macros} +% +% \begin{macro}{\pcpc@MaxStack} +% Macro \cs{pcpc@MaxStack} holds the highest number of +% allocated stacks. +% \begin{macrocode} +\global\chardef\pcpc@MaxStack=\z@ +% \end{macrocode} +% \end{macro} +% \begin{macro}{\pcpc@InitStacks} +% Macro \cs{pcpc@InitStacks} takes the number of columns +% as argument and ensures that there are enough color +% stacks for all columns. +% \begin{macrocode} +\def\pcpc@InitStacks#1{% + \ifnum#1>\pcpc@MaxStack + \begingroup + \count@\pcpc@MaxStack + \loop + \advance\count@\@ne + \pdfcolInitStack{pcpc@\the\count@}% + \ifnum#1>\count@ + \repeat + \global\chardef\pcpc@MaxStack=\count@ + \endgroup + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcpc@SwitchStack} +% \begin{macrocode} +\def\pcpc@SwitchStack#1{% + \pdfcolSwitchStack{pcpc@\number#1}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pcpc@SetCurrent} +% \begin{macrocode} +\def\pcpc@SetCurrent#1{% + \pdfcolSetCurrent{pcpc@\number#1}% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Patches} +% +% Now the color stack macros are patched into the macros +% of package \xpackage{parcolumns}. +% +% \subsubsection{Init stacks} +% +% \cs{pcpc@InitStacks} should go into the definition of +% environment |parcolumns|. \cs{pc@alloccolumns} is executed +% there and nowhere else, thus we hook into it. +% \begin{macrocode} +\g@addto@macro\pc@alloccolumns{% + \pcpc@InitStacks\pc@columncount +} +% \end{macrocode} +% +% \subsubsection{Switch stack} +% +% \cs{pcpc@SwitchStack} should be called by marco \cs{colchunk@}. +% However it is easier to patch \cs{pc@setcolumnwidth} that +% is executed in \cs{colchunk@} only. +% \begin{macrocode} +\g@addto@macro\pc@setcolumnwidth{% + \pcpc@SwitchStack\pc@columnctr +} +% \end{macrocode} +% +% \subsubsection{Set current stack color} +% +% \cs{pcpc@SetCurrent} is set at the begin of each line. +% It must be inserted into \cs{pc@placeboxes}. Unhappily +% there is no easy way. Therefore we check and +% redefine \cs{pc@placeboxes}. +% \begin{macrocode} +\begingroup + \def\x{% + \global\let\@tempa\relax + \count@\z@ + \hb@xt@\linewidth{% + \vfuzz30ex % + \vbadness\@M + \splittopskip\z@skip + \loop + \ifnum\count@<\pc@columncount + \advance\count@\@ne + \expandafter\ifvoid\csname pc@column@\number\count@\endcsname + \hskip\csname pc@column@width@\number\count@\endcsname + \else + \expandafter\setbox\expandafter\@tempboxa\expandafter + \vsplit\csname pc@column@\number\count@\endcsname + to \dp\strutbox + \vbox{% + \unvbox\@tempboxa + }% + \fi + \expandafter\ifvoid\csname pc@column@\number\count@\endcsname + \else + \global\let\@tempa\pc@placeboxes + \fi + \ifnum\count@<\pc@columncount + \strut + \hfill + \ifpc@rulebetween + \vrule + \hfill + \fi + \fi + \repeat + }% + \@tempa + }% + \ifx\x\pc@placeboxes + \else + \@PackageWarningNoLine{pdfcolparcolumns}{% + Command \string\pc@placeboxes\space has changed.\MessageBreak + Supported versions of package `parcolumns':\MessageBreak + \space\space 2004/08/05.\MessageBreak + The redefinition of \string\pc@placeboxes\space may not% + \MessageBreak + behave correctly depending on the changes% + }% + \fi +\endgroup +% \end{macrocode} +% \begin{macro}{\pc@placeboxes} +% \begin{macrocode} +\renewcommand*{\pc@placeboxes}{% + \global\let\@tempa\relax + \count@\z@ + \hb@xt@\linewidth{% + \vfuzz30ex % + \vbadness\@M + \splittopskip\z@skip + \loop + \ifnum\count@<\pc@columncount + \advance\count@\@ne + \expandafter\ifvoid\csname pc@column@\number\count@\endcsname + \hskip\csname pc@column@width@\number\count@\endcsname + \else + \expandafter\setbox\expandafter\@tempboxa\expandafter + \vsplit\csname pc@column@\number\count@\endcsname + to \dp\strutbox + \vbox{% + \pcpc@SetCurrent\count@ + \unvbox\@tempboxa + }% + \fi + \expandafter\ifvoid\csname pc@column@\number\count@\endcsname + \else + \global\let\@tempa\pc@placeboxes + \fi + \ifnum\count@<\pc@columncount + \strut + \hfill + \ifpc@rulebetween + \vrule + \hfill + \fi + \fi + \repeat + }% + \@tempa +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section{Test} +% +% The test file is a modified version of the file that +% Donald Goodman has posted in \xnewsgroup{comp.text.tex}. +% \begin{macrocode} +%<*test1> +\NeedsTeXFormat{LaTeX2e} +\AtEndDocument{% + \typeout{}% + \typeout{**************************************}% + \typeout{*** \space Check the PDF file manually! \space ***}% + \typeout{**************************************}% + \typeout{}% +} +\documentclass{article} +\usepackage{xcolor} +\usepackage{pdfcolparcolumns} + +\newcommand{\instruct}[1]{% + \noindent + \footnotesize + \textcolor{red}{#1}% +} + +\begin{document} + \begin{parcolumns}[colwidths={1=2.3in,2=2.3in},sloppy]{2}% + \colchunk[1]{% + \instruct{Et non dicitur versus} % + Fidelium anim\ae\ % + \instruct{% + sed immediate subiungitur antiphona finalis % + beat\ae\ Mari\ae\ Virginis% + } % + 100.% + }% + \colchunk[2]{% + \instruct{% + And the verse % + \textcolor{black}{May the souls of the faithful} % + is not said, but the final antiphon of the % + Blessed Virgin Mary, % + \textcolor{black}{100,} % + is immediately joined.% + }% + }% + \end{parcolumns}% +\end{document} +%</test1> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcolparcolumns.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/pdfcolparcolumns.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek-tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex pdfcolparcolumns.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% pdfcolparcolumns.sty & tex/latex/oberdiek/pdfcolparcolumns.sty\\ +% pdfcolparcolumns.pdf & doc/latex/oberdiek/pdfcolparcolumns.pdf\\ +% pdfcolparcolumns-test1.tex & doc/latex/oberdiek/pdfcolparcolumns-test1.tex\\ +% pdfcolparcolumns.dtx & source/latex/oberdiek/pdfcolparcolumns.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk pdfcolparcolumns.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{pdfcolparcolumns.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex pdfcolparcolumns.dtx +%makeindex -s gind.ist pdfcolparcolumns.idx +%pdflatex pdfcolparcolumns.dtx +%makeindex -s gind.ist pdfcolparcolumns.idx +%pdflatex pdfcolparcolumns.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{thebibliography}{9} +% +% \bibitem{parcolumns} +% Jonathan Sauer: \textit{The \xpackage{parcolumns} package}; +% 2004/11/25;\\ +% \CTAN{macros/latex/contrib/sauerj/parcolumns.pdf}. +% +% \bibitem{pdfcol} +% Heiko Oberdiek: \textit{The \xpackage{pdfcol} package}; +% 2007/09/09;\\ +% \CTAN{macros/latex/contrib/oberdiek/pdfcol.pdf}. +% +% \end{thebibliography} +% +% \begin{History} +% \begin{Version}{2007/07/26 v1.0} +% \item +% First version, published in the newsgroup \texttt{comp.text.tex} +% with the name \xpackage{parcolumns-colorstack}. +% \end{Version} +% \begin{Version}{2007/09/09 v1.1} +% \item +% CTAN version, package name renamed to \xpackage{pdfcolparcolumns}. +% \item +% Uses package \xpackage{pdfcol}. +% \item +% Documentation added. +% \item +% Test file added. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcrypt.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcrypt.dtx index 68581f4d4e7..4512d07ab15 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdfcrypt.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdfcrypt.dtx @@ -676,7 +676,7 @@ and the derived files }% |gdef|pc@EscapeRemove#1\#2#3|@nil{% #1#2% - |ifx|\#3|\% + |ifx|\#3|\%% |else |@ReturnAfterFi{% |pc@EscapeRemove#3|@nil @@ -837,6 +837,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx index a385bc92828..e5c75987403 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx @@ -18,7 +18,7 @@ % and the derived files % pdfescape.sty, pdfescape.pdf, pdfescape.ins, pdfescape.drv, % pdfescape-test1.tex, pdfescape-test2.tex, -% pdfescape-test3.tex. +% pdfescape-test3.tex, pdfescape-test4.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/pdfescape.dtx @@ -56,6 +56,7 @@ % TDS:doc/latex/oberdiek/pdfescape-test1.tex % TDS:doc/latex/oberdiek/pdfescape-test2.tex % TDS:doc/latex/oberdiek/pdfescape-test3.tex +% TDS:doc/latex/oberdiek/pdfescape-test4.tex % TDS:source/latex/oberdiek/pdfescape.dtx % %<*ignore> @@ -71,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: pdfescape 2007/04/21 v1.4 Provides hex, PDF name and string conversions (HO)} +\Msg{* Package: pdfescape 2007/09/09 v1.6 Provides hex, PDF name and string conversions (HO)} \Msg{************************************************************************} \keepsilent @@ -99,7 +100,7 @@ This work consists of the main source file pdfescape.dtx and the derived files pdfescape.sty, pdfescape.pdf, pdfescape.ins, pdfescape.drv, pdfescape-test1.tex, pdfescape-test2.tex, - pdfescape-test3.tex. + pdfescape-test3.tex, pdfescape-test4.tex. \endpreamble @@ -112,6 +113,7 @@ and the derived files \file{pdfescape-test1.tex}{\from{pdfescape.dtx}{test1}}% \file{pdfescape-test2.tex}{\from{pdfescape.dtx}{test2}}% \file{pdfescape-test3.tex}{\from{pdfescape.dtx}{test3}}% + \file{pdfescape-test4.tex}{\from{pdfescape.dtx}{test4}}% } \obeyspaces @@ -137,7 +139,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{pdfescape.drv}% - [2007/04/21 v1.4 Provides hex, PDF name and string conversions (HO)]% + [2007/09/09 v1.6 Provides hex, PDF name and string conversions (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -146,7 +148,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{1815} +% \CheckSum{1889} % % \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 @@ -167,7 +169,7 @@ and the derived files % \GetFileInfo{pdfescape.drv} % % \title{The \xpackage{pdfescape} package} -% \date{2007/04/21 v1.4} +% \date{2007/09/09 v1.6} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -213,7 +215,7 @@ and the derived files % % \subsection{Additional unescape macros} % -% \begin{declcs}{EdefUnescapeName} \M{cmd} \M{string}\\ +% \begin{declcs}{EdefUnescapeName} \M{cmd} \M{string} % \end{declcs} % Sequences of a hash sign with two hexadecimal digits are % converted to the corresponding character (PDF-1.2). @@ -222,13 +224,21 @@ and the derived files % TeX's conventions. The space has catcode 10 (space) and % the other characters have catcode 12 (other). % -% \begin{declcs}{EdefUnescapeString} \M{cmd} \M{string}\\ +% \begin{declcs}{EdefUnescapeString} \M{cmd} \M{string} % \end{declcs} % Macro \meta{cmd} stores the unescaped string in \meta{string}. % All the rules for literal strings are implemented, see % PDF specification. % The catcodes in the result string follow TeX's conventions. % +% \subsection{Sanitizing macro} +% +% \begin{declcs}{EdefSanitize} \M{cmd} \M{string} +% \end{declcs} +% Argument \meta{string} is expanded, converted to a string +% of tokens with catcode 12 (other) and space tokens, and +% stored in macro \meta{cmd}. +% % \StopEventually{ % } % @@ -238,35 +248,6 @@ and the derived files %<*package> % \end{macrocode} % -% \subsection{Catcodes} -% -% \begin{macrocode} -\expandafter\edef\csname PE@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax -} -\catcode64 11 % @ -\def\PE@EnsureCode#1#2#3{% - \edef\PE@AtEnd{% - \PE@AtEnd - #1#2 \the#1#2\relax - }% - #1#2 #3\relax -} -\PE@EnsureCode\catcode{0}{12}% ^^@ -\PE@EnsureCode\catcode{34}{12}% " -\PE@EnsureCode\catcode{42}{12}% * -\PE@EnsureCode\catcode{45}{12}% - -\PE@EnsureCode\catcode{46}{12}% . -\PE@EnsureCode\catcode{60}{12}% < -\PE@EnsureCode\catcode{61}{12}% = -\PE@EnsureCode\catcode{62}{12}% > -\PE@EnsureCode\catcode{94}{7}% ^ -\PE@EnsureCode\catcode{96}{12}% ` -\PE@EnsureCode\uccode{34}{0}% " -\PE@EnsureCode\uccode{48}{0}% 0 -\PE@EnsureCode\uccode{61}{0}% = -% \end{macrocode} -% % \subsection{Reload check and package identification} % Reload check, especially if the package is not used with \LaTeX. % \begin{macrocode} @@ -325,19 +306,49 @@ and the derived files \fi \expandafter\x\csname ver@pdfescape.sty\endcsname \ProvidesPackage{pdfescape}% - [2007/04/21 v1.4 Provides hex, PDF name and string conversions (HO)] + [2007/09/09 v1.6 Provides hex, PDF name and string conversions (HO)] +% \end{macrocode} +% +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname PE@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2#3{% + \edef\PE@AtEnd{% + \PE@AtEnd + #1#2 \the#1#2\relax + }% + #1#2 #3\relax +} +\TMP@EnsureCode\catcode{0}{12}% ^^@ +\TMP@EnsureCode\catcode{34}{12}% " +\TMP@EnsureCode\catcode{39}{12}% ' +\TMP@EnsureCode\catcode{42}{12}% * +\TMP@EnsureCode\catcode{45}{12}% - +\TMP@EnsureCode\catcode{46}{12}% . +\TMP@EnsureCode\catcode{60}{12}% < +\TMP@EnsureCode\catcode{61}{12}% = +\TMP@EnsureCode\catcode{62}{12}% > +\TMP@EnsureCode\catcode{94}{7}% ^ +\TMP@EnsureCode\catcode{96}{12}% ` +\TMP@EnsureCode\uccode{34}{0}% " +\TMP@EnsureCode\uccode{48}{0}% 0 +\TMP@EnsureCode\uccode{61}{0}% = % \end{macrocode} % % \subsection{Sanitizing} % -% \begin{macro}{\PE@sanitize} -% Macro \cs{PE@sanitize} takes |#2|, entirely converts +% \begin{macro}{\EdefSanitize} +% Macro \cs{EdefSanitize} takes |#2|, entirely converts % it to token with catcode 12 (other) and stores the % result in macro |#1|. % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname detokenize\endcsname\relax - \long\def\PE@sanitize#1#2{% + \long\def\EdefSanitize#1#2{% \begingroup \csname @safe@activestrue\endcsname \edef#1{#2}% @@ -355,7 +366,7 @@ and the derived files \let\PE@onelevel@sanitize\@onelevel@sanitize \fi \else - \long\def\PE@sanitize#1#2{% + \long\def\EdefSanitize#1#2{% \begingroup \csname @safe@activestrue\endcsname \edef#1{#2}% @@ -369,6 +380,13 @@ and the derived files \fi % \end{macrocode} % \end{macro} +% \begin{macro}{\PE@sanitize} +% Macro \cs{PE@sanitize} is only defined for +% compatibility with version 1.4. Its use is deprecated. +% \begin{macrocode} +\let\PE@sanitize\EdefSanitize +% \end{macrocode} +% \end{macro} % % \subsubsection{Space characters} % @@ -421,7 +439,7 @@ and the derived files % \begin{macro}{\EdefUnescapeName} % \begin{macrocode} \def\EdefUnescapeName#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@SanitizeSpaceOther#1% \PE@UnescapeName#1% \PE@onelevel@sanitize#1% @@ -543,7 +561,7 @@ and the derived files % \begin{macro}{\EdefUnescapeString} % \begin{macrocode} \def\EdefUnescapeString#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@SanitizeSpaceOther#1% \PE@NormalizeLineEnd#1% \PE@UnescapeString#1% @@ -731,7 +749,7 @@ and the derived files % \begin{macro}{\EdefEscapeHex} % \begin{macrocode} \long\def\EdefEscapeHex#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@SanitizeSpaceOther#1% \PE@EscapeHex#1% }% @@ -740,7 +758,7 @@ and the derived files % \begin{macro}{\EdefUnescapeHex} % \begin{macrocode} \def\EdefUnescapeHex#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@UnescapeHex#1% }% % \end{macrocode} @@ -748,7 +766,7 @@ and the derived files % \begin{macro}{\EdefEscapeName} % \begin{macrocode} \long\def\EdefEscapeName#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@SanitizeSpaceOther#1% \PE@EscapeName#1% }% @@ -757,7 +775,7 @@ and the derived files % \begin{macro}{\EdefEscapeString} % \begin{macrocode} \long\def\EdefEscapeString#1#2{% - \PE@sanitize#1{#2}% + \EdefSanitize#1{#2}% \PE@SanitizeSpaceOther#1% \PE@EscapeString#1% }% @@ -1158,8 +1176,62 @@ and the derived files % % \section{Test} % +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input pdfescape.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Macro tests} +% % \begin{macrocode} -%<*test1|test2|test3> +%<*test2|test3|test4> \NeedsTeXFormat{LaTeX2e} \makeatletter % \end{macrocode} @@ -1167,28 +1239,28 @@ and the derived files % \subsection{Test with \cs{pdfescape...} commands} % % \begin{macrocode} -%<*test1> +%<*test2> \ProvidesFile{pdfescape-test1.tex}% - [2007/04/21 v1.4 Test with \string\pdfescape... commands]% -%</test1> + [2007/09/09 v1.6 Test with \string\pdfescape... commands]% +%</test2> % \end{macrocode} % % \subsection{Test without \cs{pdfescape...}, with \eTeX} % % \begin{macrocode} -%<*test2> +%<*test3> \ProvidesFile{pdfescape-test2.tex}% - [2007/04/21 v1.4 Test without \string\pdfescape..., with e-TeX]% -%</test2> + [2007/09/09 v1.6 Test without \string\pdfescape..., with e-TeX]% +%</test3> % \end{macrocode} % % \subsection{Test without \cs{pdfescape...} and \eTeX} % % \begin{macrocode} -%<*test3> +%<*test4> \ProvidesFile{pdfescape-test3.tex}% - [2007/04/21 v1.4 Test without \string\pdfescape... and e-TeX]% -%</test3> + [2007/09/09 v1.6 Test without \string\pdfescape... and e-TeX]% +%</test4> % \end{macrocode} % % \subsection{Check/ensure test preconditions} @@ -1196,35 +1268,35 @@ and the derived files % \subsubsection{Check \cs{pdfescape...}} % % \begin{macrocode} -%<*test1> +%<*test2> \@ifundefined{pdfescapehex}{% \PackageError{pdfescape-test1}{% Missing \string\pdfescape... commands% }{Test aborted.}% \stop }{} -%</test1> +%</test2> % \end{macrocode} % \begin{macrocode} -%<*test2|test3> +%<*test3|test4> \let\pdfescapehex\@undefined \let\pdfunescapehex\@undefined \let\pdfescapename\@undefined \let\pdfescapestring\@undefined -%</test2|test3> +%</test3|test4> % \end{macrocode} % % \subsubsection{Check \eTeX} % % \begin{macrocode} -%<*test2> +%<*test3> \@ifundefined{numexpr}{% \PackageError{pdfescape-test2}{% Missing \eTeX }{Test aborted.}% \stop }{} -%</test2> +%</test3> % \end{macrocode} % Package \xpackage{qstest} uses \eTeX, thus \eTeX's features % can only be disabled later during loading of package \xpackage{pdfescape}. @@ -1343,17 +1415,17 @@ and the derived files |endgroup \@onelevel@sanitize\AllBytesString -%<*test3> +%<*test4> \let\org@detokenize\detokenize \let\detokenize\@undefined \let\org@numexpr\numexpr \let\numexpr\@undefined -%</test3> +%</test4> \RequirePackage{pdfescape} -%<*test3> +%<*test4> \let\detokenize\org@detokenize \let\numexpr\org@numexpr -%</test3> +%</test4> \begin{qstest}{all-hex}{\AllBytes, escapehex} \EdefEscapeHex\x{\AllBytes}% @@ -1406,7 +1478,7 @@ and the derived files \@onelevel@sanitize\y \ExpectVar\x\y }% -%<*test1> +%<*test2> \edef\x{\pdfunescapehex{4X}}% \edef\y{\string @}% \ifx\x\y @@ -1419,7 +1491,7 @@ and the derived files \typeout{************************************}% \def\test#1#2{}% \fi -%</test1> +%</test2> \test{X}{}% \test{XY}{}% \test{XYZ}{}% @@ -1593,8 +1665,9 @@ and the derived files % \end{macrocode} % % \begin{macrocode} -%</test1|test2|test3> +%</test2|test3|test4> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -1659,6 +1732,7 @@ and the derived files % pdfescape-test1.tex & doc/latex/oberdiek/pdfescape-test1.tex\\ % pdfescape-test2.tex & doc/latex/oberdiek/pdfescape-test2.tex\\ % pdfescape-test3.tex & doc/latex/oberdiek/pdfescape-test3.tex\\ +% pdfescape-test4.tex & doc/latex/oberdiek/pdfescape-test4.tex\\ % pdfescape.dtx & source/latex/oberdiek/pdfescape.dtx\\ % \end{tabular}^^A % }^^A @@ -1814,6 +1888,14 @@ and the derived files % \item % \cs{EdefUnescapeName} and \cs{EdefUnescapeString} added. % \end{Version} +% \begin{Version}{2007/08/27 v1.5} +% \item +% \cs{EdefSanitize} added (replaces \cs{PE@sanitize}). +% \end{Version} +% \begin{Version}{2007/09/09 v1.6} +% \item +% Fix in catcode setup. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx b/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx index b8e6f39a367..b0d102478bd 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx @@ -533,6 +533,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/picture.dtx b/Master/texmf-dist/source/latex/oberdiek/picture.dtx index 0842b56f771..7e02a938c18 100644 --- a/Master/texmf-dist/source/latex/oberdiek/picture.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/picture.dtx @@ -521,6 +521,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/pmboxdraw.dtx b/Master/texmf-dist/source/latex/oberdiek/pmboxdraw.dtx index a78aaa5c443..dd2d9c394e7 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pmboxdraw.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pmboxdraw.dtx @@ -1677,6 +1677,7 @@ and the derived files % \begin{macrocode} %</utf8> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/refcount.dtx b/Master/texmf-dist/source/latex/oberdiek/refcount.dtx index f6ba87789ee..bd224367a77 100644 --- a/Master/texmf-dist/source/latex/oberdiek/refcount.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/refcount.dtx @@ -424,6 +424,7 @@ and the derived files \def\rc@@extract@title#1\TR@TitleReference#2#3#4\@nil{#3} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/selinput.dtx b/Master/texmf-dist/source/latex/oberdiek/selinput.dtx index 42e49bfafe2..bfb5daca727 100644 --- a/Master/texmf-dist/source/latex/oberdiek/selinput.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/selinput.dtx @@ -73,7 +73,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: selinput 2007/06/20 v1.1 Select input encoding (HO)} +\Msg{* Package: selinput 2007/09/09 v1.2 Select input encoding (HO)} \Msg{************************************************************************} \keepsilent @@ -141,7 +141,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{selinput.drv}% - [2007/06/20 v1.1 Select input encoding (HO)]% + [2007/09/09 v1.2 Select input encoding (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \usepackage[T1]{fontenc} @@ -175,7 +175,7 @@ and the derived files % \GetFileInfo{selinput.drv} % % \title{The \xpackage{selinput} package} -% \date{2007/06/20 v1.1} +% \date{2007/09/09 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -352,7 +352,7 @@ and the derived files %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{selinput} - [2007/06/20 v1.1 Select input encoding (HO)]% + [2007/09/09 v1.2 Select input encoding (HO)]% % \end{macrocode} % % \begin{macrocode} @@ -396,7 +396,7 @@ and the derived files \ifx\SIE@Encoding\@empty \StringEncodingConvertTest\SIE@temp\SIE@StringDest {ascii}{utf16be}{% - \def\SIE@Encoding{ascii} + \def\SIE@Encoding{ascii}% \SIE@Info{selinput}{% Matching encoding not found, but input characters% \MessageBreak @@ -665,7 +665,7 @@ and the derived files \sbox2{#2}% \Expect*{wd:\the\wd0, ht:\the\ht0, dp:\the\dp0}% *{wd:\the\wd2, ht:\the\ht2, dp:\the\dp2}% - [#1=##1] % + [#1=##1] % hash-ok }% } \RequirePackage{keyval} @@ -674,7 +674,7 @@ and the derived files \TestKey{Euro}{\texteuro} \makeatother \usepackage[ - warning, + warning,% %<test2> utf8=utf-8, %<test3> ucs, ]{selinput} @@ -683,20 +683,20 @@ and the derived files %<test3>\usepackage{ucs} \begin{qstest}{preamble}{} \TestEncoding{x-iso-8859-15}{% - adieresis=^^e4, - germandbls=^^df, - Euro=^^a4, + adieresis=^^e4,% + germandbls=^^df,% + Euro=^^a4,% }% \TestEncoding{x-cp1252}{% - adieresis=^^e4, - germandbls=^^df, - Euro=^^80, + adieresis=^^e4,% + germandbls=^^df,% + Euro=^^80,% }% %<test1> \TestEncoding{utf8}{% %<test2> \TestEncoding{utf-8}{% %<test3> \TestEncoding{utf8x}{% - adieresis=^^c3^^a4, - germandbls=^^c3^^9f, + adieresis=^^c3^^a4,% + germandbls=^^c3^^9f,% %<!test2> Euro=^^e2^^82^^ac, }% \end{qstest} @@ -713,17 +713,17 @@ and the derived files %<*test4> \usepackage[warning,ucs]{selinput} \SelectInputMappings{ - adieresis=^^c3^^a4, - germandbls=^^c3^^9f, - Euro=^^e2^^82^^ac, + adieresis=^^c3^^a4,% + germandbls=^^c3^^9f,% + Euro=^^e2^^82^^ac,% } \begin{qstest}{encoding}{} \Expect*{\inputencodingname}{utf8x}% \end{qstest} \begin{document} - adieresis=^^c3^^a4, - germandbls=^^c3^^9f, - Euro=^^e2^^82^^ac + adieresis=^^c3^^a4, % + germandbls=^^c3^^9f, % + Euro=^^e2^^82^^ac% %</test4> % \end{macrocode} % @@ -731,17 +731,17 @@ and the derived files %<*test5> \usepackage[warning,ucs]{selinput} \SelectInputMappings{ - adieresis={\"a}, - germandbls={{\ss}}, - Euro=\texteuro{}, + adieresis={\"a},% + germandbls={{\ss}},% + Euro=\texteuro{},% } \begin{qstest}{encoding}{} \Expect*{\inputencodingname}{ascii}% \end{qstest} \begin{document} - adieresis={\"a}, - germandbls={{\ss}}, - Euro=\texteuro{} + adieresis={\"a}, % + germandbls={{\ss}}, % + Euro=\texteuro{}% %</test5> % \end{macrocode} % @@ -749,6 +749,7 @@ and the derived files \end{document} %</test> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -967,6 +968,10 @@ and the derived files % \item % Requested date for package \xpackage{stringenc} fixed. % \end{Version} +% \begin{Version}{2007/09/09 v1.2} +% \item +% Line end fixed. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/setouterhbox.dtx b/Master/texmf-dist/source/latex/oberdiek/setouterhbox.dtx index bc616933a0f..039f226328e 100644 --- a/Master/texmf-dist/source/latex/oberdiek/setouterhbox.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/setouterhbox.dtx @@ -18,7 +18,8 @@ % This work consists of the main source file setouterhbox.dtx % and the derived files % setouterhbox.sty, setouterhbox.pdf, setouterhbox.ins, setouterhbox.drv, -% setouterhbox-example.tex. +% setouterhbox-example.tex, setouterhbox-test1.tex, +% setouterhbox-test2.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/setouterhbox.dtx @@ -54,6 +55,8 @@ % TDS:tex/generic/oberdiek/setouterhbox.sty % TDS:doc/latex/oberdiek/setouterhbox.pdf % TDS:doc/latex/oberdiek/setouterhbox-example.tex +% TDS:doc/latex/oberdiek/setouterhbox-test1.tex +% TDS:doc/latex/oberdiek/setouterhbox-test2.tex % TDS:source/latex/oberdiek/setouterhbox.dtx % %<*ignore> @@ -69,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: setouterhbox 2007/05/17 v1.6 Set hbox in outer horizontal mode (HO)} +\Msg{* Package: setouterhbox 2007/09/09 v1.7 Set hbox in outer horizontal mode (HO)} \Msg{************************************************************************} \keepsilent @@ -97,7 +100,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file setouterhbox.dtx and the derived files setouterhbox.sty, setouterhbox.pdf, setouterhbox.ins, setouterhbox.drv, - setouterhbox-example.tex. + setouterhbox-example.tex, setouterhbox-test1.tex, + setouterhbox-test2.tex. \endpreamble @@ -108,6 +112,8 @@ and the derived files \file{setouterhbox.sty}{\from{setouterhbox.dtx}{package}}% \usedir{doc/latex/oberdiek}% \file{setouterhbox-example.tex}{\from{setouterhbox.dtx}{example}}% + \file{setouterhbox-test1.tex}{\from{setouterhbox.dtx}{test1}}% + \file{setouterhbox-test2.tex}{\from{setouterhbox.dtx}{test2}}% } \obeyspaces @@ -133,7 +139,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{setouterhbox.drv}% - [2007/05/17 v1.6 Set hbox in outer horizontal mode (HO)]% + [2007/09/09 v1.7 Set hbox in outer horizontal mode (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -142,7 +148,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{334} +% \CheckSum{461} % % \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 @@ -163,7 +169,7 @@ and the derived files % \GetFileInfo{setouterhbox.drv} % % \title{The \xpackage{setouterhbox} package} -% \date{2007/05/17 v1.6} +% \date{2007/09/09 v1.7} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -401,9 +407,36 @@ by/a/very_long_long_long_path.html}% \fi \expandafter\x\csname ver@setouterhbox.sty\endcsname \ProvidesPackage{setouterhbox}% - [2007/05/17 v1.6 Set hbox in outer horizontal mode (HO)] + [2007/09/09 v1.7 Set hbox in outer horizontal mode (HO)] % \end{macrocode} % +% \begin{macrocode} +\expandafter\edef\csname setouterhboxAtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\setouterhboxAtEnd{% + \setouterhboxAtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{96}{12}% ` +% \end{macrocode} +% +% \subsection{Interface macros} +% % \begin{macro}{\setouterhboxBox} % The method requires a global box assignment. To be on the % safe side, a new box register is allocated for this @@ -420,7 +453,7 @@ by/a/very_long_long_long_path.html}% \expandafter\ifx\csname RequirePackage\endcsname\relax \input infwarerr.sty\relax \else - \RequirePackage{infwarerr}% + \RequirePackage{infwarerr}[2007/09/09]% \fi \edef\setouterhboxFailure#1#2{% \expandafter\noexpand\csname @PackageError\endcsname @@ -660,6 +693,7 @@ E \egroup \expandafter\endgroup \ifx\x\fmtname \else + \setouterhboxAtEnd \expandafter\endinput \fi % \end{macrocode} @@ -679,8 +713,100 @@ E \egroup % \end{macrocode} % % \begin{macrocode} +\setouterhboxAtEnd %</package> % \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input setouterhbox.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{Test with package \xpackage{url}} +% +% \begin{macrocode} +%<*test2> +\nofiles +\documentclass[a5paper]{article} +\usepackage{url}[2005/06/27] +\usepackage{setouterhbox} + +\newsavebox{\testbox} + +\setlength{\parindent}{0pt} +\setlength{\parskip}{2em} + +\begin{document} +\raggedright + +\url{http://this.is.a.very.long.host.name/followed/% +by/a/very_long_long_long_path.html}% + +\sbox\testbox{% + \url{http://this.is.a.very.long.host.name/followed/% + by/a/very_long_long_long_path.html}% +}% +\unhbox\testbox + +\begin{setouterhbox}{\testbox}% + \url{http://this.is.a.very.long.host.name/followed/% + by/a/very_long_long_long_path.html}% +\end{setouterhbox} +\unhbox\testbox + +\end{document} +%</test2> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -743,6 +869,8 @@ E \egroup % setouterhbox.sty & tex/generic/oberdiek/setouterhbox.sty\\ % setouterhbox.pdf & doc/latex/oberdiek/setouterhbox.pdf\\ % setouterhbox-example.tex & doc/latex/oberdiek/setouterhbox-example.tex\\ +% setouterhbox-test1.tex & doc/latex/oberdiek/setouterhbox-test1.tex\\ +% setouterhbox-test2.tex & doc/latex/oberdiek/setouterhbox-test2.tex\\ % setouterhbox.dtx & source/latex/oberdiek/setouterhbox.dtx\\ % \end{tabular}^^A % }^^A @@ -923,6 +1051,10 @@ E \egroup % \item % Standard header part for generic files. % \end{Version} +% \begin{Version}{2007/09/09 v1.7} +% \item +% Catcode section added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/settobox.dtx b/Master/texmf-dist/source/latex/oberdiek/settobox.dtx index 5f4bc332c88..31ea14d36a4 100644 --- a/Master/texmf-dist/source/latex/oberdiek/settobox.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/settobox.dtx @@ -515,6 +515,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/soulutf8.dtx b/Master/texmf-dist/source/latex/oberdiek/soulutf8.dtx new file mode 100644 index 00000000000..567ec5de4ad --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/soulutf8.dtx @@ -0,0 +1,1760 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file soulutf8.dtx +% and the derived files +% soulutf8.sty, soulutf8.pdf, soulutf8.ins, soulutf8.drv, +% soulutf8-test1.tex, soulutf8-test2.tex, soulutf8-test3.tex, +% soulutf8-test4.tex, soulutf8-test5.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/soulutf8.dtx +% CTAN:macros/latex/contrib/oberdiek/soulutf8.pdf +% +% Unpacking: +% (a) If soulutf8.ins is present: +% tex soulutf8.ins +% (b) Without soulutf8.ins: +% tex soulutf8.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{soulutf8.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If soulutf8.drv is present: +% latex soulutf8.drv +% (b) Without soulutf8.drv: +% latex soulutf8.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex soulutf8.dtx +% makeindex -s gind.ist soulutf8.idx +% pdflatex soulutf8.dtx +% makeindex -s gind.ist soulutf8.idx +% pdflatex soulutf8.dtx +% +% Installation: +% TDS:tex/generic/oberdiek/soulutf8.sty +% TDS:doc/latex/oberdiek/soulutf8.pdf +% TDS:doc/latex/oberdiek/soulutf8-test1.tex +% TDS:doc/latex/oberdiek/soulutf8-test2.tex +% TDS:doc/latex/oberdiek/soulutf8-test3.tex +% TDS:doc/latex/oberdiek/soulutf8-test4.tex +% TDS:doc/latex/oberdiek/soulutf8-test5.tex +% TDS:source/latex/oberdiek/soulutf8.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: soulutf8 2007/09/09 v1.0 Adding support for UTF-8 to soul (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file soulutf8.dtx +and the derived files + soulutf8.sty, soulutf8.pdf, soulutf8.ins, soulutf8.drv, + soulutf8-test1.tex, soulutf8-test2.tex, soulutf8-test3.tex, + soulutf8-test4.tex, soulutf8-test5.tex. + +\endpreamble + +\generate{% + \file{soulutf8.ins}{\from{soulutf8.dtx}{install}}% + \file{soulutf8.drv}{\from{soulutf8.dtx}{driver}}% + \usedir{tex/generic/oberdiek}% + \file{soulutf8.sty}{\from{soulutf8.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{soulutf8-test1.tex}{\from{soulutf8.dtx}{test1}}% + \file{soulutf8-test2.tex}{\from{soulutf8.dtx}{test2,utf8}}% + \file{soulutf8-test3.tex}{\from{soulutf8.dtx}{test3,utf8x}}% + \file{soulutf8-test4.tex}{\from{soulutf8.dtx}{test4,utf8,noetex}}% + \file{soulutf8-test5.tex}{\from{soulutf8.dtx}{test5,utf8x,noetex}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* soulutf8.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `soulutf8.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{soulutf8.drv}% + [2007/09/09 v1.0 Adding support for UTF-8 to soul (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\begin{document} + \DocInput{soulutf8.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{1821} +% +% \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 \~} +% +% \GetFileInfo{soulutf8.drv} +% +% \title{The \xpackage{soulutf8} package} +% \date{2007/09/09 v1.0} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% This package extends package \xpackage{soul} and adds some support +% for UTF-8. Namely the input encodings \xfile{utf8.def} +% from package \xpackage{inputenc} and +% package \xpackage{ucs}'s \xfile{utf8x.def} are supported. +% \end{abstract} +% +% \tableofcontents +% +% \section{Documentation} +% +% This package \xpackage{soulutf8} does not have own options and does not +% define new user commands. +% Any option is passed to package \xpackage{soul} \cite{soul} +% that is loaded first. +% Then some internal macros of \xpackage{soul} are redefined to add +% support for UTF-8. +% The following input encodings are supported: +% \begin{quote} +% \begin{tabular}{@{}lll@{}} +% \texttt{utf8} & \LaTeX\ base & +% \xfile{TDS:tex/latex/base/utf8.def} \cite{utf8}\\ +% \texttt{utf8x} & Package \xpackage{ucs} & +% \xfile{TDS:tex/latex/ucs/utf8x.def} \cite{ucs}\\ +% \end{tabular} +% \end{quote} +% UTF-8 byte sequences are added as token group to a word, even +% if these UTF-8 characters are some kind of hyphen or space. +% As exception the following three Unicode characters are handled specially: +% \begin{quote} +% \begin{tabular}{lll} +% Slot & Name & Action\\ +% \hline +% \texttt{U+00A0} & NO-BREAK SPACE & like |~|\\ +% \texttt{U+2013} & EN DASH & |--|\\ +% \texttt{U+2014} & EM DASH & |---| +% \end{tabular} +% +% \subsection{Patch} +% +% Also package \xpackage{soulutf8} tries to patch package \xpackage{soul} +% to improve its behaviour: +% \begin{itemize} +% \item +% A problem with additional levels of curly braces is fixed. +% As advantage more implicite kernings are detected. +% However, the result may be incompatible with the +% original behaviour of package \xpackage{soul} because +% of these respected implicite kernings. +% \item +% \eTeX\ , especially \cs{unexpanded} is supported. +% This allows a better protection of token groups +% (|\mbox{|\dots|}|, math, \dots). +% \end{itemize} +% \end{quote} +% +% \subsection{Future} +% +% Currently package \xpackage{soul} does not seem to be +% maintained. Nevertheless if there will be a new version that +% adds support for UTF-8, then this package may become +% obsolete. +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Reload check and package identification} +% Reload check, especially if the package is not used with \LaTeX. +% \begin{macrocode} +\begingroup + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\let\expandafter\x\csname ver@soulutf8.sty\endcsname + \ifcase 0% + \ifx\x\relax % plain + \else + \ifx\x\empty % LaTeX + \else + 1% + \fi + \fi + \else + \expandafter\ifx\csname PackageInfo\endcsname\relax + \def\x#1#2{% + \immediate\write-1{Package #1 Info: #2.}% + }% + \else + \def\x#1#2{\PackageInfo{#1}{#2, stopped}}% + \fi + \x{soulutf8}{The package is already loaded}% + \endgroup + \expandafter\endinput + \fi +\endgroup +% \end{macrocode} +% Package identification: +% \begin{macrocode} +\begingroup + \catcode40 12 % ( + \catcode41 12 % ) + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode47 12 % / + \catcode58 12 % : + \catcode64 11 % @ + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1#2#3[#4]{\endgroup + \immediate\write-1{Package: #3 #4}% + \xdef#1{#4}% + }% + \else + \def\x#1#2[#3]{\endgroup + #2[{#3}]% + \ifx#1\relax + \xdef#1{#3}% + \fi + }% + \fi +\expandafter\x\csname ver@soulutf8.sty\endcsname +\ProvidesPackage{soulutf8}% + [2007/09/09 v1.0 Adding support for UTF-8 to soul (HO)] +% \end{macrocode} +% +% \subsection{Catcodes} +% +% \begin{macrocode} +\expandafter\edef\csname SOuL@AtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\SOuL@AtEnd{% + \SOuL@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{10}{12}% ^^J +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{34}{12}% " +\TMP@EnsureCode{36}{3}% $ +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{12}% : +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{94}{7}% ^ +\TMP@EnsureCode{96}{12}% ` +\TMP@EnsureCode{126}\active % ~ +\TMP@EnsureCode{128}{12}% ^^80 +\TMP@EnsureCode{147}{12}% ^^93 +\TMP@EnsureCode{148}{12}% ^^94 +\TMP@EnsureCode{160}{12}% ^^a0 +\TMP@EnsureCode{194}{12}% ^^c2 +\TMP@EnsureCode{226}{12}% ^^e2 +% \end{macrocode} +% +% \subsection{Loading packages} +% +% Package \xpackage{soul} uses \cs{documentclass} to detect \LaTeX. +% \begin{macrocode} +\ifx\documentclass\@undefined +% \end{macrocode} +% +% \subsubsection{\plainTeX} +% +% First we check, whether package \xpackage{soul} is already loaded. +% \begin{macrocode} + \expandafter\ifx\csname SOUL@\endcsname\relax +% \end{macrocode} +% In case of \plainTeX\ package \xpackage{soul} defines some +% macros in a simple manner that will break the definitions of +% \xfile{miniltx.tex}, for example. Therefore these macros +% are first saved and restored afterwards. +% \begin{macrocode} + \let\SOuL@orgDeclareRobustCommand\DeclareRobustCommand + \let\SOuL@orgnewcommand \newcommand + \let\SOuL@orgDeclareOption \DeclareOption + \let\SOuL@orgPackageError \PackageError + \def\SOuL@restorelatexcmds{% + \let\DeclareRobustCommand\SOuL@orgDeclareRobustCommand + \let\newcommand \SOuL@orgnewcommand + \let\DeclareOption \SOuL@orgDeclareOption + \let\PackageError \SOuL@orgPackageError + }% + \input soul.sty\relax + \SOuL@restorelatexcmds + \fi +% \end{macrocode} +% \begin{macro}{\SOUL@error} +% Package \xpackage{soul}'s use of \cs{PackageError} is replaced +% by \cs{@PackageError} of package \xpackage{infwarerr}. +% \begin{macrocode} + \input infwarerr.sty\relax + \let\SOuL@orgSOUL@error\SOUL@error + \def\SOUL@error{% + \begingroup + \let\PackageError\@PackageError + \SOuL@orgSOUL@error + \endgroup + }% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \input etexcmds.sty\relax +% \end{macrocode} +% \begin{macro}{\@onelevel@sanitize} +% Define \LaTeX's \cs{@onelevel@sanitize} if not already available. +% \begin{macrocode} + \expandafter\ifx\csname @onelevel@sanitize\endcsname\relax + \def\@onelevel@sanitize#1{% + \edef#1{% + \expandafter\strip@prefix\meaning#1% + }% + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\strip@prefix} +% \begin{macrocode} + \def\strip@prefix#1>{}% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \fi +\else +% \end{macrocode} +% +% \subsubsection{\LaTeX} +% \begin{macrocode} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{soul}}% + \ProcessOptions\relax + \RequirePackage{soul}[2003/11/17]% + \RequirePackage{infwarerr}[2007/09/09]% + \RequirePackage{etexcmds}[2007/09/09]% +\fi +% \end{macrocode} +% +% \subsubsection{\eTeX} +% +% In \plainTeX\ command \cs{+} is an \emph{outer} macro. +% Therefore numbers are used to avoid problems. +% \begin{macrocode} +\ifetex@unexpanded + \catcode33=14 % '!': comment + \catcode43=9 % '+': ignore +\else + \catcode33=9 % '!': ignore + \catcode43=14 % '+': comment +\fi +% \end{macrocode} +% +% \subsection{Macro for redefinitions} +% +% \begin{macro}{\SOuL@redefine} +% \begin{macrocode} +\def\SOuL@redefine#1{% + \begingroup + \def\SOuL@cmd{#1}% + \afterassignment\SOuL@cmdcheck + \def\SOuL@temp +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOuL@cmdcheck} +% \begin{macrocode} +\def\SOuL@cmdcheck{% + \expandafter\ifx\SOuL@cmd\SOuL@temp + \else + \edef\SOuL@temp*{\expandafter\string\SOuL@cmd}% + \@PackageWarningNoLine{soulutf8}{% + Command \SOuL@temp* has changed.\MessageBreak + Supported versions of package `soul': 2003/11/17.\MessageBreak + Depending on the unknown changes the redefinition\MessageBreak + of \SOuL@temp* may not behave correctly% + }% + \fi + \expandafter\endgroup + \expandafter\def\SOuL@cmd +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Redefinition of \cs{SOUL@eval}} +% +% \begin{macro}{\SOUL@eval} +% Macro \cs{SOUL@eval} is redefined to add detection of +% the first byte of a UTF-8 sequence. Because \cs{SOUL@eval} +% is overwritten, a warning is issued, if the contents of +% \cs{SOUL@eval} is not as expected. +% \begin{macrocode} +\SOuL@redefine\SOUL@eval{% +% \end{macrocode} +% First the expected definition. +% \begin{macrocode} + \def\SOUL@n*##1{\SOUL@scan}% + \if\noexpand\SOUL@@\SOUL@spc + \else + \SOUL@ignorespacesfalse + \fi + \ifnum\SOUL@minus=\thr@@ + \SOUL@flushminus + \else\ifnum\SOUL@comma=\tw@ + \SOUL@flushcomma + \else\ifnum\SOUL@apo=\tw@ + \SOUL@flushapo + \else\ifnum\SOUL@grave=\tw@ + \SOUL@flushgrave + \fi\fi\fi\fi + \ifx\SOUL@@-\else\SOUL@flushminus\fi + \ifx\SOUL@@,\else\SOUL@flushcomma\fi + \ifx\SOUL@@'\else\SOUL@flushapo\fi + \ifx\SOUL@@`\else\SOUL@flushgrave\fi + \ifx\SOUL@@-% + \advance\SOUL@minus\@ne + \else\ifx\SOUL@@,% + \advance\SOUL@comma\@ne + \else\ifx\SOUL@@'% + \advance\SOUL@apo\@ne + \else\ifx\SOUL@@`% + \advance\SOUL@grave\@ne + \else + \SOUL@flushminus + \SOUL@flushcomma + \SOUL@flushapo + \SOUL@flushgrave + \ifx\SOUL@@\SOUL@stop + \def\SOUL@n*{% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + }% + \else\ifx\SOUL@@\par + \def\SOUL@n*\par{\par\leavevmode\SOUL@scan}% + \else\if\noexpand\SOUL@@\SOUL@spc + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \ifSOUL@ignorespaces + \else + \SOUL@everyspace{}% + \fi + \def\SOUL@n* {\SOUL@scan}% + \else\ifx\SOUL@@\\% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \SOUL@everyspace{\unskip\nobreak\hfil\break}% + \SOUL@ignorespacestrue + \else\ifx\SOUL@@~% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \SOUL@everyspace{\nobreak}% + \else\ifx\SOUL@@\slash + \SOUL@doword + \SOUL@eventuallyexhyphen{/}% + \SOUL@exhyphen{/}% + \else\ifx\SOUL@@\mbox + \def\SOUL@n*{\SOUL@addprotect}% + \else\ifx\SOUL@@\hbox + \def\SOUL@n*{\SOUL@addprotect}% + \else\ifx\SOUL@@\soulomit + \def\SOUL@n*\soulomit##1{% + \SOUL@doword + {\spaceskip\SOUL@spaceskip##1}% + \SOUL@scan + }% + \else\ifx\SOUL@@\break + \SOUL@doword + \break + \else\ifx\SOUL@@\linebreak + \SOUL@doword + \SOUL@everyspace{\linebreak}% + \else\ifcat\bgroup\noexpand\SOUL@@ + \def\SOUL@n*{\SOUL@addgroup{}}% + \else\ifcat$\noexpand\SOUL@@ + \def\SOUL@n*{\SOUL@addmath}% + \else + \def\SOUL@n*{\SOUL@dotoken}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi + \SOUL@n*% +}{% +% \end{macrocode} +% Now the redefined version follows. +% \begin{macrocode} + \def\SOUL@n*##1{\SOUL@scan}% + \if\noexpand\SOUL@@\SOUL@spc + \else + \SOUL@ignorespacesfalse + \fi + \ifnum\SOUL@minus=\thr@@ + \SOUL@flushminus + \else\ifnum\SOUL@comma=\tw@ + \SOUL@flushcomma + \else\ifnum\SOUL@apo=\tw@ + \SOUL@flushapo + \else\ifnum\SOUL@grave=\tw@ + \SOUL@flushgrave + \fi\fi\fi\fi + \ifx\SOUL@@-\else\SOUL@flushminus\fi + \ifx\SOUL@@,\else\SOUL@flushcomma\fi + \ifx\SOUL@@'\else\SOUL@flushapo\fi + \ifx\SOUL@@`\else\SOUL@flushgrave\fi + \ifx\SOUL@@-% + \advance\SOUL@minus\@ne + \else\ifx\SOUL@@,% + \advance\SOUL@comma\@ne + \else\ifx\SOUL@@'% + \advance\SOUL@apo\@ne + \else\ifx\SOUL@@`% + \advance\SOUL@grave\@ne + \else + \SOUL@flushminus + \SOUL@flushcomma + \SOUL@flushapo + \SOUL@flushgrave + \ifx\SOUL@@\SOUL@stop + \def\SOUL@n*{% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + }% + \else\ifx\SOUL@@\par + \def\SOUL@n*\par{\par\leavevmode\SOUL@scan}% + \else\if\noexpand\SOUL@@\SOUL@spc + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \ifSOUL@ignorespaces + \else + \SOUL@everyspace{}% + \fi + \def\SOUL@n* {\SOUL@scan}% + \else\ifx\SOUL@@\\% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \SOUL@everyspace{\unskip\nobreak\hfil\break}% + \SOUL@ignorespacestrue + \else\ifx\SOUL@@~% + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \SOUL@everyspace{\nobreak}% + \else\ifx\SOUL@@\slash + \SOUL@doword + \SOUL@eventuallyexhyphen{/}% + \SOUL@exhyphen{/}% + \else\ifx\SOUL@@\mbox + \def\SOUL@n*{\SOUL@addprotect}% + \else\ifx\SOUL@@\hbox + \def\SOUL@n*{\SOUL@addprotect}% + \else\ifx\SOUL@@\soulomit + \def\SOUL@n*\soulomit##1{% + \SOUL@doword + {\spaceskip\SOUL@spaceskip##1}% + \SOUL@scan + }% + \else\ifx\SOUL@@\break + \SOUL@doword + \break + \else\ifx\SOUL@@\linebreak + \SOUL@doword + \SOUL@everyspace{\linebreak}% + \else\ifcat\bgroup\noexpand\SOUL@@ + \def\SOUL@n*{\SOUL@addgroup{}}% + \else\ifcat$\noexpand\SOUL@@ + \def\SOUL@n*{\SOUL@addmath}% + \else +% \end{macrocode} +% The current token is examined to detect the start of +% a UTF-8 sequence. +% \begin{macrocode} + \SOuL@analyzeutfviii + \ifcase\SOuL@octets + \SOuL@analyzeutfviiix + \fi + \ifcase\SOuL@octets + \def\SOUL@n*{\SOUL@dotoken}% + \or % 1 + \or % 2 + \def\SOUL@n*{\SOuL@addtwooctets}% + \or % 3 + \def\SOUL@n*{\SOuL@addthreeoctets}% + \or % 4 + \def\SOUL@n*{\SOuL@addfouroctets}% + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi + \SOUL@n*% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{UTF-8 analysis} +% +% \subsubsection{Help strings} +% +% \begin{macrocode} +\def\SOuL@defsanitizedstring#1#2{% + \expandafter\def\csname SOuL@string#1\endcsname{#2}% + \expandafter\@onelevel@sanitize\csname SOuL@string#1\endcsname +} +\SOuL@defsanitizedstring{UTFviii}{UTFviii@} +\SOuL@defsanitizedstring{octets}{@octets} +\SOuL@defsanitizedstring{two}{two} +\SOuL@defsanitizedstring{three}{three} +\SOuL@defsanitizedstring{four}{four} +\SOuL@defsanitizedstring{macrocolon}{macro:} +\SOuL@defsanitizedstring{csnameu}{csname u8-} +\SOuL@defsanitizedstring{undeferr}{utf@viii@undeferr} +\def\SOuL@stringendash{^^e2^^80^^93} +\def\SOuL@stringemdash{^^e2^^80^^94} +\def\SOuL@stringnobreakspace{^^c2^^a0} +\edef\SOuL@charhash{\string #} +\edef\SOuL@chartwo{\string 2} +\edef\SOuL@charthree{\string 3} +\def\SOuL@empty{} +% \end{macrocode} +% +% \subsubsection{Support for \xfile{utf8.def}} +% +% \begin{macro}{\SOuL@analyzeutfviii} +% \begin{macrocode} +\begingroup + \edef\x{\endgroup + \def\noexpand\SOuL@analyzeutfviii{% + \noexpand\expandafter\noexpand\SOuL@checkutfviii + \noexpand\meaning\noexpand\SOUL@@ + \SOuL@stringUTFviii\SOuL@stringoctets + \noexpand\@nil + }% + \def\noexpand\SOuL@checkutfviii + ##1\SOuL@stringUTFviii##2\SOuL@stringoctets##3\noexpand\@nil + }% +\x{% + \def\SOuL@temp{#2}% + \chardef\SOuL@octets=% + \ifx\SOuL@temp\SOuL@stringtwo + \tw@ + \else\ifx\SOuL@temp\SOuL@stringthree + \thr@@ + \else\ifx\SOuL@temp\SOuL@stringfour + 4 % + \else + \z@ + \fi\fi\fi +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Support for \xfile{utf8x.def}} +% +% \begin{macro}{\SOuL@analyzeutfviiix} +% \begin{macrocode} +\begingroup + \edef\x{\endgroup + \def\noexpand\SOuL@analyzeutfviiix{% + \noexpand\expandafter\noexpand\SOuL@checkutfviiix + \noexpand\meaning\noexpand\SOUL@@ + \SOuL@stringmacrocolon\SOuL@charhash1{}{}{}{}% + \SOuL@stringcsnameu\SOuL@stringundeferr + \noexpand\@nil + }% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOuL@checkutfviiix} +% \begin{macrocode} + \def\noexpand\SOuL@checkutfviiix + ##1\SOuL@stringmacrocolon\SOuL@charhash1##2##3##4##5##6% + \SOuL@stringcsnameu##7\SOuL@stringundeferr##8\noexpand\@nil + }% +\x{% + \def\SOuL@temp{#7}% + \ifx\SOuL@temp\SOuL@empty + \chardef\SOuL@octets=\z@ + \else + \def\SOuL@temp{#5}% + \ifx\SOuL@temp\SOuL@charthree + \chardef\SOuL@octets=4 % + \else + \def\SOuL@temp{#3}% + \ifx\SOuL@temp\SOuL@chartwo + \chardef\SOuL@octets=\thr@@ + \else + \chardef\SOuL@octets=\tw@ + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Actions for UTF-8 sequences} +% +% \begin{macro}{\SOuL@addtwooctets} +% \begin{macrocode} +\def\SOuL@addtwooctets#1#2{% + \def\SOuL@temp{#1#2}% + \@onelevel@sanitize\SOuL@temp + \ifx\SOuL@temp\SOuL@stringnobreakspace + \SOUL@doword + \SOUL@eventuallyexhyphen\null + \SOUL@everyspace{\nobreak}% + \let\SOuL@next\SOUL@scan + \else + \def\SOuL@next{% +! \SOUL@addtoken{{\noexpand#1\noexpand#2}}% ++ \SOUL@addtoken{{\etex@unexpanded{#1#2}}}% + }% + \fi + \SOuL@next +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOuL@addthreeoctets} +% \begin{macrocode} +\def\SOuL@addthreeoctets#1#2#3{% + \def\SOuL@temp{#1#2#3}% + \@onelevel@sanitize\SOuL@temp + \ifx\SOuL@temp\SOuL@stringendash + \SOUL@doword + \SOUL@eventuallyexhyphen{-}% + \SOUL@exhyphen{--}% + \let\SOuL@next\SOUL@scan + \else + \ifx\SOuL@temp\SOuL@stringemdash + \SOUL@doword + \SOUL@eventuallyexhyphen{-}% + \SOUL@exhyphen{---}% + \let\SOuL@next\SOUL@scan + \else + \def\SOuL@next{% +! \SOUL@addtoken{{\noexpand#1\noexpand#2\noexpand#3}}% ++ \SOUL@addtoken{{\etex@unexpanded{#1#2#3}}}% + }% + \fi + \fi + \SOuL@next +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOuL@addfouroctets} +% \begin{macrocode} +\def\SOuL@addfouroctets#1#2#3#4{% +! \SOUL@addtoken{{\noexpand#1\noexpand#2\noexpand#3\noexpand#4}}% ++ \SOUL@addtoken{{\etex@unexpanded{#1#2#3#4}}}% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Redefinition of \cs{SOUL@splittoken}} +% +% \begin{macro}{\SOUL@splittoken} +% Macro \cs{SOUL@splittoken} separates the first token +% or token group from a word and redefines the word to contain +% the remaining tokens. However if the remaining tokens are +% a token group, then the curly braces will be removed and +% the token group is splitted by the next call of \cs{SOUL@splittoken}. +% The redefinition avoids the removal of curly braces around the +% remaining tokens. +% \begin{macrocode} +\SOuL@redefine\SOUL@splittoken#1#2\SOUL@stop{% + \global\SOUL@token={#1}% + \global\SOUL@word={#2}% +}#1{% + \global\SOUL@token={#1}% + \SOuL@remainingtoken\relax +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOuL@remainingtoken} +% \begin{macrocode} +\def\SOuL@remainingtoken#1\SOUL@stop{% + \global\SOUL@word=\expandafter{\@gobble#1}% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Patches} +% +% The fixed \cs{SOUL@splittoken} allows to remove the double +% sets of curly braces in other macros of package \xpackage{soul}. +% The benefit is that implicite kernings are more often detected +% and fixes a bug in package \xpackage{soul}. The disadvantage is +% incompatibility. The width of the resulting strings may change. +% \begin{macro}{\SOUL@flushcomma} +% \begin{macrocode} +\SOuL@redefine\SOUL@flushcomma{% + \ifcase\SOUL@comma + \or + \edef\x{\SOUL@word={\the\SOUL@word,}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{{,,}}}}\x + \fi + \SOUL@comma\z@ +}{% + \ifcase\SOUL@comma + \or + \edef\x{\SOUL@word={\the\SOUL@word,}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{,,}}}\x + \fi + \SOUL@comma\z@ +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOUL@flushapo} +% \begin{macrocode} +\SOuL@redefine\SOUL@flushapo{% + \ifcase\SOUL@apo + \or + \edef\x{\SOUL@word={\the\SOUL@word'}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{{''}}}}\x + \fi + \SOUL@apo\z@ +}{% + \ifcase\SOUL@apo + \or + \edef\x{\SOUL@word={\the\SOUL@word'}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{''}}}\x + \fi + \SOUL@apo\z@ +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOUL@flushgrave} +% \begin{macrocode} +\SOuL@redefine\SOUL@flushgrave{% + \ifcase\SOUL@grave + \or + \edef\x{\SOUL@word={\the\SOUL@word`}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{{``}}}}\x + \fi + \SOUL@grave\z@ +}{% + \ifcase\SOUL@grave + \or + \edef\x{\SOUL@word={\the\SOUL@word`}}\x + \or + \edef\x{\SOUL@word={\the\SOUL@word{``}}}\x + \fi + \SOUL@grave\z@ +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOUL@addgroup} +% \begin{macrocode} +\SOuL@redefine\SOUL@addgroup#1#2{% + {% + \let\protect\noexpand + \edef\x{% + \global\SOUL@word={% + \the\SOUL@word + {{\noexpand#1#2}}% + }% + }% + \x + }% + \SOUL@scan +}#1#2{% + \begingroup + \let\protect\noexpand + \edef\x{\endgroup + \SOUL@word={% + \the\SOUL@word +! {\noexpand#1{#2}}% ++ {\etex@unexpanded{#1{#2}}}% + }% + }% + \x + \SOUL@scan +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOUL@addmath} +% \begin{macrocode} +\SOuL@redefine\SOUL@addmath$#1${% + {% + \let\protect\noexpand + \edef\x{% + \global\SOUL@word={% + \the\SOUL@word + {{\hbox{$#1$}}}% + }% + }% + \x + }% + \SOUL@scan +}$#1${% + \begingroup + \let\protect\noexpand + \edef\x{\endgroup + \SOUL@word={% + \the\SOUL@word +! {\hbox{$#1$}}% ++ {\etex@unexpanded{\hbox{$#1$}}}% + }% + }% + \x + \SOUL@scan +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SOUL@addprotect} +% \begin{macrocode} +\SOuL@redefine\SOUL@addprotect#1#2{% + {% + \let\protect\noexpand + \edef\x{% + \global\SOUL@word={% + \the\SOUL@word + {{\hbox{#2}}}% + }% + }% + \x + }% + \SOUL@scan +}#1#2{% + \begingroup + \let\protect\noexpand + \edef\x{\endgroup + \SOUL@word={% + \the\SOUL@word +! {\hbox{#2}}% ++ {\etex@unexpanded{\hbox{#2}}}% + }% + }% + \x + \SOUL@scan +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SOUL@addtoken} +% \begin{macrocode} ++ \SOuL@redefine\SOUL@addtoken#1{% ++ \edef\x{% ++ \SOUL@word={% ++ \the\SOUL@word ++ \noexpand#1% ++ }% ++ }% ++ \x ++ \SOUL@scan ++ }#1{% ++ \edef\x{% ++ \SOUL@word={% ++ \the\SOUL@word ++ \etex@unexpanded{#1}% ++ }% ++ }% ++ \x ++ \SOUL@scan ++ }% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\SOuL@AtEnd +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input soulutf8.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \subsection{\LaTeX\space tests} +% +% \begin{macrocode} +%<*test2|test3|test4|test5> +% \end{macrocode} +% \begin{macrocode} +%<noetex>\let\unexpanded\UNDEFINED +\NeedsTeXFormat{LaTeX2e} +\documentclass{article} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{textcomp} +\usepackage[ngerman]{babel} +\expandafter\def\csname ver@hypdestopt.sty\endcsname{} +\usepackage[unicode]{hyperref} +\usepackage{bookmark} +\usepackage{color} +\usepackage{soul}[2003/11/17] +\makeatletter +\newcommand*{\@ifDefined}[1]{% + \@ifundefined{#1}{% + \@latex@error{% + \expandafter\noexpand\csname#1\endcsname undefined% + }\@ehc + }% +} +\newcommand*{\SaveOrg}[1]{% + \@ifdefinable{ORG@SOUL@#1}{% + \@ifDefined{SOUL@#1}{% + \expandafter\let\csname ORG@SOUL@#1\expandafter\endcsname + \csname SOUL@#1\endcsname + }% + }% +} +\newcommand*{\RestoreOrg}[1]{% + \@ifDefined{ORG@SOUL@#1}{% + \@ifDefined{SOUL@#1}{% + \expandafter\let\csname SOUL@#1\expandafter\endcsname + \csname ORG@SOUL@#1\endcsname + }% + }% +} +\makeatother +\SaveOrg{eval} +\SaveOrg{splittoken} +\SaveOrg{flushcomma} +\SaveOrg{flushapo} +\SaveOrg{grave} +\SaveOrg{addgroup} +\SaveOrg{addmath} +\SaveOrg{addprotect} +\SaveOrg{addtoken} +\usepackage{soulutf8}[2007/09/09] +% \end{macrocode} +% Input encoding \xfile{utf8}. +% \begin{macrocode} +%<*utf8> +\usepackage[utf8]{inputenc} +\DeclareUnicodeCharacter{00A0}{\nobreakspace} +%</utf8> +% \end{macrocode} +% Input encoding \xfile{utf8x}. Package \xpackage{ucs} +% has a nasty bug, that it redefines \cs{show}. +% \begin{macrocode} +%<*utf8x> +\let\origshow\show +\usepackage[utf8x]{inputenc} +\AtBeginDocument{% + \let\show\origshow +} +%</utf8x> +% \end{macrocode} +% +% \subsubsection{Driver definitions} +% +% \begin{macrocode} +\makeatletter +% \end{macrocode} +% \begin{macro}{\an} +% The definition for \cs{an} is taken from the documentation of +% package \xpackage{soul}. +% \begin{macrocode} +\DeclareRobustCommand*{\an}{% + \def\SOUL@preamble{$^{^P}$}% + \def\SOUL@everyspace##1{##1\texttt{\char`\ }\linebreak[2]}% + \def\SOUL@postamble{$^{^E}$}% + \def\SOUL@everyhyphen{$^{^-}$\linebreak[1]}% + \def\SOUL@everyexhyphen##1{##1$^{^=}$}% + \def\SOUL@everysyllable{$^{^S}$}% + \def\SOUL@everytoken{\the\SOUL@token$^{^T}$}% + \def\SOUL@everylowerthan{$^{^L}$}% + \SOUL@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sy} +% The definition for \cs{sy} is taken from the documentation of +% package \xpackage{soul}. +% \begin{macrocode} +\DeclareRobustCommand*{\sy}{% + \SOUL@setup + \def\SOUL@preamble{% + \lefthyphenmin=\z@ + \righthyphenmin=\z@ + }% + \def\SOUL@everyspace##1{##1\space}% + \def\SOUL@everysyllable{\the\SOUL@syllable}% + \def\SOUL@everyhyphen{% + \discretionary{% + \SOUL@setkern\SOUL@hyphkern + \SOUL@sethyphenchar + }{}{% + \hbox{\kern1pt$\cdot$}% + }% + }% + \def\SOUL@everyexhyphen##1{% + \SOUL@setkern\SOUL@hyphkern + \hbox{##1}% + \discretionary{}{}{% + \SOUL@setkern\SOUL@charkern + }% + }% + \SOUL@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\soulH} +% \begin{macrocode} +\DeclareRobustCommand*{\soulH}{% + \def\SOUL@preamble{% + \gdef\SOULH{}% + \soulHadd{[}% + }% + \def\SOUL@everyspace##1{% + \soulHadd{Sp}% + }% + \def\SOUL@postamble{% + \soulHadd{]}% + }% + \def\SOUL@everyhyphen{% + \soulHadd{Hy}% + }% + \def\SOUL@everyexhyphen##1{% + \soulHadd{Exhy}% + }% + \def\SOUL@everysyllable{% + \soulHadd{Sy}% + }% + \def\SOUL@everytoken{% + \soulHadd{T}% + }% + \def\SOUL@everylowerthan{% + \soulHadd{<}% + }% + \SOUL@ +} +\newcommand*{\soulHadd}[1]{% + #1% + \expandafter\gdef\expandafter\soulHstring\expandafter{% + \soulHstring + #1% + }% +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Test macros} +% +% \begin{macrocode} +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +% \end{macrocode} +% \begin{macrocode} +\newsavebox\boxA +\newsavebox\boxB +\newsavebox\boxC +% \end{macrocode} +% \begin{macro}{\TestDriver} +% \begin{macrocode} +\newcommand*{\TestDriver}[4]{% + \subsection{Driver #1}% + \@PackageInfo{soulutf8-test}{* Driver #1}% + \expandafter\let\expandafter\testdriver\csname #1\endcsname + \def\teststringA{#3}% + \def\teststringB{#4}% + \begin{qstest}{string-#2-driver-#1}{string,#2,driver,#1}% + \@PackageInfo{soulutf8-test}{* Version: soulutf8}% + \global\let\soulHstring\@empty + \setbox0=\hbox{\expandafter\testdriver\expandafter{\teststringA}}% + \let\HstringA\soulHstring + \SetTestVBox{\boxA}{\teststringA}% + % + \@PackageInfo{soulutf8-test}{* Version: soul + patch}% + \global\let\soulHstring\@empty + \RestoreOrg{eval}% + \setbox2=\hbox{\expandafter\testdriver\expandafter{\teststringB}}% + \let\HstringB\soulHstring + \SetTestVBox{\boxB}{\teststringB}% + % + \@PackageInfo{soulutf8-test}{* Version: original soul}% + \global\let\soulHstring\@empty + \RestoreOrg{splittoken}% + \RestoreOrg{flushcomma}% + \RestoreOrg{flushapo}% + \RestoreOrg{grave}% + \RestoreOrg{addgroup}% + \RestoreOrg{addmath}% + \RestoreOrg{addprotect}% + \RestoreOrg{addtoken}% + \setbox4=\hbox{\expandafter\testdriver\expandafter{\teststringB}}% + \let\HstringC\soulHstring + \SetTestVBox{\boxC}{\teststringB}% + % + \TestInfo{0}{soulutf8}% + \TestInfo{2}{soul + patch}% + \TestInfo{4}{original soul}% + \TestInfoVBox + \showboxdepth=\maxdimen + \showboxbreadth=\maxdimen + \tracingonline=\@ne + \Expect*{\HstringA}*{\HstringB}% + \Expect*{\HstringA}*{\HstringC}% + \Expect*{\the\wd0}*{\the\wd2}% + \ifdim\wd0=\wd2 % + \else + \showbox0 % + \showbox2 % + \fi + \Expect*{\the\ht0}*{\the\ht2}% + \Expect*{\the\dp0}*{\the\dp2}% + \Expect*{\the\wd\boxB}*{\the\wd\boxA}% + \Expect*{\the\wd\boxC}*{\the\wd\boxA}% + \Expect*{\the\ht\boxB}*{\the\ht\boxA}% + \ifdim\ht\boxB=\ht\boxA + \else + \showbox\boxA + \showbox\boxB + \fi + \Expect*{\the\ht\boxC}*{\the\ht\boxA}% + \Expect*{\the\dp\boxB}*{\the\dp\boxA}% + \Expect*{\the\dp\boxC}*{\the\dp\boxA}% + \end{qstest}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SetTestVBox} +% \begin{macrocode} +\newcommand*{\SetTestVBox}[2]{% + \setbox#1=\vbox{% + \hsize=0pt\relax + \hfuzz=100mm\relax + \expandafter\testdriver\expandafter{#2}% + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TestInfo} +% \begin{macrocode} +\newcommand*{\TestInfo}[2]{% + \par + \noindent + \copy#1\relax + \hfill + \begingroup + \small + \ifdim\wd0=\wd2\relax + \ifdim\wd0=\wd4\relax + \else + \ifnum#1=2 % + \raisebox{.5\baselineskip}[0pt][0pt]{% + \llap{$\}$ }% + \rlap{width = \the\wd#1\relax\space$\{$}% + \phantom{width = 999.99999pt}% + \qquad + }% + \else + \ifnum#1=4 % + \rlap{width = \the\wd#1}% + \phantom{width = 999.99999pt}% + \qquad + \fi + \fi + \fi + \else + \begingroup + \bfseries + \rlap{width = \the\wd#1}% + \phantom{width = 999.99999pt}% + \endgroup + \qquad + \fi + \rlap{(#2)}% + \phantom{(original soul)}% + \endgroup + \par +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TestInfoVBox} +% \begin{macrocode} +\newcommand*{\TestInfoVBox}{% + \par + \noindent + \mbox{\vrule\relax\space\copy\boxA}% + \ifdim\ht\boxA=\ht\boxB + \else + \hfill + \begingroup + \small + \rlap{(soulutf8)}% + \phantom{(soulutf8)}% + \endgroup + \par + \noindent + \mbox{\vrule\relax\space\copy\boxB}% + \hfill + \begingroup + \small + \rlap{(soul)}% + \phantom{(soulutf8)}% + \endgroup + \fi + \par +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Test} +% \begin{macrocode} +\makeatletter +\newcommand*{\Test}[3]{% + \clearpage + \begingroup + \def\linebreak{\textbackslash linebreak }% + \def\\{\textbackslash\textbackslash}% + \def\soulomit##1{% + \textbackslash soulomit\textbraceleft##1\textbraceright + }% + \def\mbox##1{% + \textbackslash mbox\textbraceleft##1\textbraceright + }% + \def\abc{\textbackslash abc }% + \def\texttt##1{% + \textbackslash texttt\textbraceleft##1\textbraceright + }% + \def\c##1{% + \textbackslash c\textbraceleft##1\textbraceright + }% +%<*utf8x> + \count@=128 % + \loop + \ifnum\count@<256 % + \lccode`\~=\count@ + \lowercase{% + \def~{\noexpand~}% + }% + \advance\count@\@ne + \repeat +%</utf8x> + \csname protected@edef\endcsname\x{\endgroup + \noexpand\section{String #1: #2}% + }% + \x + \TestDriver{so}{#1}{#2}{#3}% + \TestDriver{caps}{#1}{#2}{#3}% + \TestDriver{ul}{#1}{#2}{#3}% + \TestDriver{st}{#1}{#2}{#3}% + \TestDriver{hl}{#1}{#2}{#3}% + \TestDriver{an}{#1}{#2}{#3}% + \TestDriver{sy}{#1}{#2}{#3}% + \TestDriver{soulH}{#1}{#2}{#3}% +} +\makeatother +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Testing} +% +% \begin{macrocode} +\begin{document} + \Test A{}{}% + \Test B{Hello World}{Hello World}% + \Test C{% + Umlauts: ^^c3^^84^^c3^^96^^c3^^9c^^c3^^a4^^c3^^b6^^c3^^bc^^c3^^9f% + }{% + Umlauts: \"A\"O\"U\"a\"o\"u\ss + }% + \Test D{Euro: ^^e2^^82^^ac}{Euro: \texteuro}% + \Test E{Stra^^c3^^9fe}{Stra\ss e}% + \Test F{R^^c3^^b6mer}{R\"omer}% + \Test G{A^^e2^^80^^93B^^e2^^80^^94C}{A--B---C}% + \Test H{X^^c2^^a0Y}{X~Y}% + \Test I{A^^c5^^a4}{A\v T}% + \Test J{A,B,,C,,,D,,,,E}{A,B,,C,,,D,,,,E}% + \Test K{A'B''C'''D''''E}{A'B''C'''D''''E}% + \Test L{A`B``C```D````E}{A`B``C```D````E}% + \Test M{A$x$B}{A$x$B}% + \Test N{A\mbox{abc}B}{A\mbox{abc}B}% + \Test O{,,TA''}{,,TA''}% + \Test P{{!`}Hola{?`}}{{!`}Hola{?`}}% + \Test Q{re-sent\slash x}{re-sent\slash x}% + \Test R{new\\line}{new\\line}% + \Test S{foo\linebreak bar}{foo\linebreak bar}% + \Test T{Virchow{sche}}{Virchow{sche}}% + \Test U{A\soulomit{foo}B}{A\soulomit{foo}B}% + \Test V{A\texttt{xyz}B}{A\texttt{xyz}B}% + \Test W{ffi}{ffi}% + \Test X{f{}f{}i}{f{}f{}i}% + \Test Y{f\mbox{}f\mbox{}i}{f\mbox{}f\mbox{}i}% + \Test Z{\c{\"a}}{{\c{\"a}}}% +%<*test2|test3> + \let\abcx\UNDEFINED + \def\abc{% + \begingroup + \def\abcx{x}% + \abcx + \endgroup + }% + \Test{AA}{[{x\abc x}]}{[{xxx}]}% +%</test2|test3> +% \end{macrocode} +% +% \begin{macrocode} +\end{document} +% \end{macrocode} +% \begin{macrocode} +%</test2|test3|test4|test5> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/soulutf8.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/soulutf8.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek-tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex soulutf8.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% soulutf8.sty & tex/generic/oberdiek/soulutf8.sty\\ +% soulutf8.pdf & doc/latex/oberdiek/soulutf8.pdf\\ +% soulutf8-test1.tex & doc/latex/oberdiek/soulutf8-test1.tex\\ +% soulutf8-test2.tex & doc/latex/oberdiek/soulutf8-test2.tex\\ +% soulutf8-test3.tex & doc/latex/oberdiek/soulutf8-test3.tex\\ +% soulutf8-test4.tex & doc/latex/oberdiek/soulutf8-test4.tex\\ +% soulutf8-test5.tex & doc/latex/oberdiek/soulutf8-test5.tex\\ +% soulutf8.dtx & source/latex/oberdiek/soulutf8.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk soulutf8.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{soulutf8.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex soulutf8.dtx +%makeindex -s gind.ist soulutf8.idx +%pdflatex soulutf8.dtx +%makeindex -s gind.ist soulutf8.idx +%pdflatex soulutf8.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{thebibliography}{9} +% +% \bibitem{soul} +% Melchior Franz: \textit{The \xpackage{soul} package}; +% 2003/11/17;\\ +% \CTAN{macros/latex/contrib/soul/}. +% +% \bibitem{ucs} +% Dominique P. G. Unruh: \textit{\xpackage{ucs.sty} -- Unicode Support}; +% 2004/10/17;\\ +% \CTAN{macros/latex/contrib/unicode/}. +% +% \bibitem{utf8} +% Frank Mittelbach, Chris Rowley: +% \textit{Providing some UTF-8 support via \xpackage{inputenc}}; +% 2006/03/30;\\ +% \CTAN{macros/latex/base/utf8inc.dtx}. +% +% \end{thebibliography} +% +% \begin{History} +% \begin{Version}{2007/09/09 v1.0} +% \item +% First version. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/oberdiek/stackrel.dtx b/Master/texmf-dist/source/latex/oberdiek/stackrel.dtx index 867ac53a57a..e260b98cebe 100644 --- a/Master/texmf-dist/source/latex/oberdiek/stackrel.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/stackrel.dtx @@ -272,6 +272,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/stringenc.dtx b/Master/texmf-dist/source/latex/oberdiek/stringenc.dtx index 530078f87c9..d39c7fafd83 100644 --- a/Master/texmf-dist/source/latex/oberdiek/stringenc.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/stringenc.dtx @@ -119,7 +119,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: stringenc 2007/06/16 v1.1 Converts strings between encodings (HO)} +\Msg{* Package: stringenc 2007/09/09 v1.2 Converts strings between encodings (HO)} \Msg{************************************************************************} \keepsilent @@ -244,7 +244,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{stringenc.drv}% - [2007/06/16 v1.1 Converts strings between encodings (HO)]% + [2007/09/09 v1.2 Converts strings between encodings (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \usepackage{longtable} @@ -254,7 +254,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{5880} +% \CheckSum{5882} % % \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 @@ -275,7 +275,7 @@ and the derived files % \GetFileInfo{stringenc.drv} % % \title{The \xpackage{stringenc} package} -% \date{2007/06/16 v1.1} +% \date{2007/09/09 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -461,7 +461,7 @@ and the derived files \fi \expandafter\x\csname ver@stringenc.sty\endcsname \ProvidesPackage{stringenc}% - [2007/06/16 v1.1 Converts strings between encodings (HO)] + [2007/09/09 v1.2 Converts strings between encodings (HO)] % \end{macrocode} % % \subsection{Catcodes} @@ -471,35 +471,36 @@ and the derived files \catcode64 \the\catcode64\relax } \catcode64 11 % @ -\def\SE@EnsureCode#1#2#3{% +\def\TMP@EnsureCode#1#2#3{% \edef\SE@AtEnd{% \SE@AtEnd #1#2 \the#1#2\relax }% #1#2 #3\relax } -\SE@EnsureCode\catcode{34}{12}% " -\SE@EnsureCode\catcode{36}{3}% $ -\SE@EnsureCode\catcode{38}{4}% & -\SE@EnsureCode\catcode{39}{12}% ' -\SE@EnsureCode\catcode{40}{12}% ( -\SE@EnsureCode\catcode{41}{12}% ) -\SE@EnsureCode\catcode{42}{12}% * -\SE@EnsureCode\catcode{43}{12}% + -\SE@EnsureCode\catcode{44}{12}% , -\SE@EnsureCode\catcode{45}{12}% - -\SE@EnsureCode\catcode{46}{12}% . -\SE@EnsureCode\catcode{58}{12}% : -\SE@EnsureCode\catcode{60}{12}% < -\SE@EnsureCode\catcode{61}{12}% = -\SE@EnsureCode\catcode{62}{12}% > -\SE@EnsureCode\catcode{91}{12}% [ -\SE@EnsureCode\catcode{93}{12}% ] -\SE@EnsureCode\catcode{94}{7}% ^ -\SE@EnsureCode\catcode{96}{12}% ` -\SE@EnsureCode\uccode{34}{0}% " -\SE@EnsureCode\uccode{48}{0}% 0 -\SE@EnsureCode\uccode{61}{0}% = +\TMP@EnsureCode\catcode{34}{12}% " +\TMP@EnsureCode\catcode{36}{3}% $ +\TMP@EnsureCode\catcode{38}{4}% & +\TMP@EnsureCode\catcode{39}{12}% ' +\TMP@EnsureCode\catcode{40}{12}% ( +\TMP@EnsureCode\catcode{41}{12}% ) +\TMP@EnsureCode\catcode{42}{12}% * +\TMP@EnsureCode\catcode{43}{12}% + +\TMP@EnsureCode\catcode{44}{12}% , +\TMP@EnsureCode\catcode{45}{12}% - +\TMP@EnsureCode\catcode{46}{12}% . +\TMP@EnsureCode\catcode{47}{12}% / +\TMP@EnsureCode\catcode{58}{12}% : +\TMP@EnsureCode\catcode{60}{12}% < +\TMP@EnsureCode\catcode{61}{12}% = +\TMP@EnsureCode\catcode{62}{12}% > +\TMP@EnsureCode\catcode{91}{12}% [ +\TMP@EnsureCode\catcode{93}{12}% ] +\TMP@EnsureCode\catcode{94}{7}% ^ +\TMP@EnsureCode\catcode{96}{12}% ` +\TMP@EnsureCode\uccode{34}{0}% " +\TMP@EnsureCode\uccode{48}{0}% 0 +\TMP@EnsureCode\uccode{61}{0}% = % \end{macrocode} % % \subsection{Tools} @@ -510,8 +511,8 @@ and the derived files \input infwarerr.sty\relax \input pdfescape.sty\relax \else - \RequirePackage{infwarerr}% - \RequirePackage{pdfescape}% + \RequirePackage{infwarerr}[2007/09/09]% + \RequirePackage{pdfescape}[2007/09/09]% \fi % \end{macrocode} % @@ -615,7 +616,7 @@ and the derived files % \begin{macrocode} \def\SE@ConvertTo#1#2#3{% \let\SE@result\SE@Empty - \PE@sanitize\SE@encoding{#3}% + \EdefSanitize\SE@encoding{#3}% \expandafter\ifx\csname\SE@PrefixTo\SE@encoding\endcsname\relax \StringEncodingLoad\SE@encoding \fi @@ -724,7 +725,7 @@ and the derived files % \begin{macrocode} \def\SE@ConvertFrom#1#2#3{% \let\SE@result\SE@Empty - \PE@sanitize\SE@encoding{#3}% + \EdefSanitize\SE@encoding{#3}% \expandafter\ifx\csname\SE@PrefixFrom\SE@encoding\endcsname\relax \StringEncodingLoad\SE@encoding \fi @@ -1062,15 +1063,15 @@ $ \fi % \begin{macro}{\StringEncodingConvert} % \begin{macrocode} \def\StringEncodingConvert#1#2#3#4{% - \PE@sanitize\SE@from{#3}% - \PE@sanitize\SE@to{#4}% + \EdefSanitize\SE@from{#3}% + \EdefSanitize\SE@to{#4}% \expandafter\ifx\csname SE@alias@\SE@from\endcsname\relax \else - \PE@sanitize\SE@from{\csname SE@alias@\SE@from\endcsname}% + \EdefSanitize\SE@from{\csname SE@alias@\SE@from\endcsname}% \fi \expandafter\ifx\csname SE@alias@\SE@to\endcsname\relax \else - \PE@sanitize\SE@to{\csname SE@alias@\SE@to\endcsname}% + \EdefSanitize\SE@to{\csname SE@alias@\SE@to\endcsname}% \fi \ifx\SE@to\SE@utfxvi \let\SE@to\SE@utfxvibe @@ -1145,32 +1146,32 @@ $ \fi % \end{macro} % \begin{macro}{\SE@utfxvi} % \begin{macrocode} -\PE@sanitize\SE@utfxvi{utf16} +\EdefSanitize\SE@utfxvi{utf16} % \end{macrocode} % \end{macro} % \begin{macro}{\SE@utfxvibe} % \begin{macrocode} -\PE@sanitize\SE@utfxvibe{utf16be} +\EdefSanitize\SE@utfxvibe{utf16be} % \end{macrocode} % \end{macro} % \begin{macro}{\SE@utfxvile} % \begin{macrocode} -\PE@sanitize\SE@utfxvile{utf16le} +\EdefSanitize\SE@utfxvile{utf16le} % \end{macrocode} % \end{macro} % \begin{macro}{\SE@utfxxxii} % \begin{macrocode} -\PE@sanitize\SE@utfxxxii{utf32} +\EdefSanitize\SE@utfxxxii{utf32} % \end{macrocode} % \end{macro} % \begin{macro}{\SE@utfxxxiibe} % \begin{macrocode} -\PE@sanitize\SE@utfxxxiibe{utf32be} +\EdefSanitize\SE@utfxxxiibe{utf32be} % \end{macrocode} % \end{macro} % \begin{macro}{\SE@utfxxxiile} % \begin{macrocode} -\PE@sanitize\SE@utfxxxiile{utf32le} +\EdefSanitize\SE@utfxxxiile{utf32le} % \end{macrocode} % \end{macro} % @@ -1396,8 +1397,8 @@ $ \fi % % \begin{macrocode} %<*utf32> -%<utf32be>\ProvidesFile{se-utf32be.def}[2007/06/16 v1.1 stringenc: UTF-32BE] -%<utf32le>\ProvidesFile{se-utf32le.def}[2007/06/16 v1.1 stringenc: UTF-32LE] +%<utf32be>\ProvidesFile{se-utf32be.def}[2007/09/09 v1.2 stringenc: UTF-32BE] +%<utf32le>\ProvidesFile{se-utf32le.def}[2007/09/09 v1.2 stringenc: UTF-32LE] % \end{macrocode} % % \begin{macrocode} @@ -1555,7 +1556,7 @@ $ \fi % % \begin{macrocode} %<*utf8> -\ProvidesFile{se-utf8.def}[2007/06/16 v1.1 stringenc: UTF-8] +\ProvidesFile{se-utf8.def}[2007/09/09 v1.2 stringenc: UTF-8] % \end{macrocode} % % \noindent @@ -1895,7 +1896,7 @@ $ \fi % % \begin{macrocode} %<*utf16le> -\ProvidesFile{se-utf16le.def}[2007/06/16 v1.1 stringenc: UTF-16LE] +\ProvidesFile{se-utf16le.def}[2007/09/09 v1.2 stringenc: UTF-16LE] % \end{macrocode} % % \begin{macrocode} @@ -1935,7 +1936,7 @@ $ \fi % % \begin{macrocode} %<*pdfdoc> -\ProvidesFile{se-pdfdoc.def}[2007/06/16 v1.1 stringenc: PDFDocEncoding] +\ProvidesFile{se-pdfdoc.def}[2007/09/09 v1.2 stringenc: PDFDocEncoding] % \end{macrocode} % % Pass ranges 32..126 and 160..255 through and use @@ -2066,7 +2067,7 @@ $ \fi % % \begin{macrocode} %<*iso-8859-1> -\ProvidesFile{se-iso-8859-1.def}[2007/06/16 v1.1 stringenc: ISO-8859-1] +\ProvidesFile{se-iso-8859-1.def}[2007/09/09 v1.2 stringenc: ISO-8859-1] % \end{macrocode} % % Excluded area: 0x80..0x9F @@ -2136,7 +2137,7 @@ $ \fi % % \begin{macrocode} %<*cp1252> -\ProvidesFile{se-cp1252.def}[2007/06/16 v1.1 stringenc: cp1252] +\ProvidesFile{se-cp1252.def}[2007/09/09 v1.2 stringenc: cp1252] % \end{macrocode} % % \begin{macrocode} @@ -2237,7 +2238,7 @@ $ \fi % % \begin{macrocode} %<*ascii> -\ProvidesFile{se-ascii.def}[2007/06/16 v1.1 stringenc: US-ASCII] +\ProvidesFile{se-ascii.def}[2007/09/09 v1.2 stringenc: US-ASCII] % \end{macrocode} % % \begin{macrocode} @@ -2286,123 +2287,123 @@ $ \fi % % \begin{macrocode} %<*iso-8859-2> -\ProvidesFile{se-iso-8859-2.def}[2007/06/16 v1.1 stringenc: ISO-8859-2] +\ProvidesFile{se-iso-8859-2.def}[2007/09/09 v1.2 stringenc: ISO-8859-2] \def\SE@this{iso-8859-2} %</iso-8859-2> %<*iso-8859-3> -\ProvidesFile{se-iso-8859-3.def}[2007/06/16 v1.1 stringenc: ISO-8859-3] +\ProvidesFile{se-iso-8859-3.def}[2007/09/09 v1.2 stringenc: ISO-8859-3] \def\SE@this{iso-8859-3} %</iso-8859-3> %<*iso-8859-4> -\ProvidesFile{se-iso-8859-4.def}[2007/06/16 v1.1 stringenc: ISO-8859-4] +\ProvidesFile{se-iso-8859-4.def}[2007/09/09 v1.2 stringenc: ISO-8859-4] \def\SE@this{iso-8859-4} %</iso-8859-4> %<*iso-8859-5> -\ProvidesFile{se-iso-8859-5.def}[2007/06/16 v1.1 stringenc: ISO-8859-5] +\ProvidesFile{se-iso-8859-5.def}[2007/09/09 v1.2 stringenc: ISO-8859-5] \def\SE@this{iso-8859-5} %</iso-8859-5> %<*iso-8859-6> -\ProvidesFile{se-iso-8859-6.def}[2007/06/16 v1.1 stringenc: ISO-8859-6] +\ProvidesFile{se-iso-8859-6.def}[2007/09/09 v1.2 stringenc: ISO-8859-6] \def\SE@this{iso-8859-6} %</iso-8859-6> %<*iso-8859-7> -\ProvidesFile{se-iso-8859-7.def}[2007/06/16 v1.1 stringenc: ISO-8859-7] +\ProvidesFile{se-iso-8859-7.def}[2007/09/09 v1.2 stringenc: ISO-8859-7] \def\SE@this{iso-8859-7} %</iso-8859-7> %<*iso-8859-8> -\ProvidesFile{se-iso-8859-8.def}[2007/06/16 v1.1 stringenc: ISO-8859-8] +\ProvidesFile{se-iso-8859-8.def}[2007/09/09 v1.2 stringenc: ISO-8859-8] \def\SE@this{iso-8859-8} %</iso-8859-8> %<*iso-8859-9> -\ProvidesFile{se-iso-8859-9.def}[2007/06/16 v1.1 stringenc: ISO-8859-9] +\ProvidesFile{se-iso-8859-9.def}[2007/09/09 v1.2 stringenc: ISO-8859-9] \def\SE@this{iso-8859-9} %</iso-8859-9> %<*iso-8859-10> -\ProvidesFile{se-iso-8859-10.def}[2007/06/16 v1.1 stringenc: ISO-8859-10] +\ProvidesFile{se-iso-8859-10.def}[2007/09/09 v1.2 stringenc: ISO-8859-10] \def\SE@this{iso-8859-10} %</iso-8859-10> %<*iso-8859-11> -\ProvidesFile{se-iso-8859-11.def}[2007/06/16 v1.1 stringenc: ISO-8859-11] +\ProvidesFile{se-iso-8859-11.def}[2007/09/09 v1.2 stringenc: ISO-8859-11] \def\SE@this{iso-8859-11} %</iso-8859-11> %<*iso-8859-13> -\ProvidesFile{se-iso-8859-13.def}[2007/06/16 v1.1 stringenc: ISO-8859-13] +\ProvidesFile{se-iso-8859-13.def}[2007/09/09 v1.2 stringenc: ISO-8859-13] \def\SE@this{iso-8859-13} %</iso-8859-13> %<*iso-8859-14> -\ProvidesFile{se-iso-8859-14.def}[2007/06/16 v1.1 stringenc: ISO-8859-14] +\ProvidesFile{se-iso-8859-14.def}[2007/09/09 v1.2 stringenc: ISO-8859-14] \def\SE@this{iso-8859-14} %</iso-8859-14> %<*iso-8859-15> -\ProvidesFile{se-iso-8859-15.def}[2007/06/16 v1.1 stringenc: ISO-8859-15] +\ProvidesFile{se-iso-8859-15.def}[2007/09/09 v1.2 stringenc: ISO-8859-15] \def\SE@this{iso-8859-15} %</iso-8859-15> %<*iso-8859-16> -\ProvidesFile{se-iso-8859-16.def}[2007/06/16 v1.1 stringenc: ISO-8859-16] +\ProvidesFile{se-iso-8859-16.def}[2007/09/09 v1.2 stringenc: ISO-8859-16] \def\SE@this{iso-8859-16} %</iso-8859-16> %<*koi8-r> -\ProvidesFile{se-koi8-r.def}[2007/06/16 v1.1 stringenc: KOI8-R] +\ProvidesFile{se-koi8-r.def}[2007/09/09 v1.2 stringenc: KOI8-R] \def\SE@this{koi8-r} %</koi8-r> %<*nextstep> -\ProvidesFile{se-nextstep.def}[2007/06/16 v1.1 stringenc: NextStep] +\ProvidesFile{se-nextstep.def}[2007/09/09 v1.2 stringenc: NextStep] \def\SE@this{nextstep} %</nextstep> %<*mac-centeuro> -\ProvidesFile{se-mac-centeuro.def}[2007/06/16 v1.1 stringenc: Mac OS Central European] +\ProvidesFile{se-mac-centeuro.def}[2007/09/09 v1.2 stringenc: Mac OS Central European] \def\SE@this{mac-centeuro} %</mac-centeuro> %<*mac-cyrillic> -\ProvidesFile{se-mac-cyrillic.def}[2007/06/16 v1.1 stringenc: Mac OS Cyrillic] +\ProvidesFile{se-mac-cyrillic.def}[2007/09/09 v1.2 stringenc: Mac OS Cyrillic] \def\SE@this{mac-cyrillic} %</mac-cyrillic> %<*mac-roman> -\ProvidesFile{se-mac-roman.def}[2007/06/16 v1.1 stringenc: Mac OS Roman] +\ProvidesFile{se-mac-roman.def}[2007/09/09 v1.2 stringenc: Mac OS Roman] \def\SE@this{mac-roman} %</mac-roman> %<*dec-mcs> -\ProvidesFile{se-dec-mcs.def}[2007/06/16 v1.1 stringenc: DEC-MCS] +\ProvidesFile{se-dec-mcs.def}[2007/09/09 v1.2 stringenc: DEC-MCS] \def\SE@this{dec-mcs} %</dec-mcs> %<*cp437> -\ProvidesFile{se-cp437.def}[2007/06/16 v1.1 stringenc: cp437] +\ProvidesFile{se-cp437.def}[2007/09/09 v1.2 stringenc: cp437] \def\SE@this{cp437} %</cp437> %<*cp850> -\ProvidesFile{se-cp850.def}[2007/06/16 v1.1 stringenc: cp850] +\ProvidesFile{se-cp850.def}[2007/09/09 v1.2 stringenc: cp850] \def\SE@this{cp850} %</cp850> %<*cp852> -\ProvidesFile{se-cp852.def}[2007/06/16 v1.1 stringenc: cp852] +\ProvidesFile{se-cp852.def}[2007/09/09 v1.2 stringenc: cp852] \def\SE@this{cp852} %</cp852> %<*cp855> -\ProvidesFile{se-cp855.def}[2007/06/16 v1.1 stringenc: cp855] +\ProvidesFile{se-cp855.def}[2007/09/09 v1.2 stringenc: cp855] \def\SE@this{cp855} %</cp855> %<*cp858> -\ProvidesFile{se-cp858.def}[2007/06/16 v1.1 stringenc: cp858] +\ProvidesFile{se-cp858.def}[2007/09/09 v1.2 stringenc: cp858] \def\SE@this{cp858} %</cp858> %<*cp865> -\ProvidesFile{se-cp865.def}[2007/06/16 v1.1 stringenc: cp865] +\ProvidesFile{se-cp865.def}[2007/09/09 v1.2 stringenc: cp865] \def\SE@this{cp865} %</cp865> %<*cp866> -\ProvidesFile{se-cp866.def}[2007/06/16 v1.1 stringenc: cp866] +\ProvidesFile{se-cp866.def}[2007/09/09 v1.2 stringenc: cp866] \def\SE@this{cp866} %</cp866> %<*cp1250> -\ProvidesFile{se-cp1250.def}[2007/06/16 v1.1 stringenc: cp1250] +\ProvidesFile{se-cp1250.def}[2007/09/09 v1.2 stringenc: cp1250] \def\SE@this{cp1250} %</cp1250> %<*cp1251> -\ProvidesFile{se-cp1251.def}[2007/06/16 v1.1 stringenc: cp1251] +\ProvidesFile{se-cp1251.def}[2007/09/09 v1.2 stringenc: cp1251] \def\SE@this{cp1251} %</cp1251> %<*cp1257> -\ProvidesFile{se-cp1257.def}[2007/06/16 v1.1 stringenc: cp1257] +\ProvidesFile{se-cp1257.def}[2007/09/09 v1.2 stringenc: cp1257] \def\SE@this{cp1257} %</cp1257> % \end{macrocode} @@ -5890,7 +5891,7 @@ $ \fi \catcode`\%=14 % \catcode`\ =10 % \catcode13=5 % - \usepackage{stringenc}[2007/06/16]% + \usepackage{stringenc}[2007/09/09]% \RestoreCatcodes } \Test @@ -5940,7 +5941,7 @@ $ \fi \let\SavedNumexpr\numexpr \let\numexpr\relax \fi -\usepackage{stringenc}[2007/06/16] +\usepackage{stringenc}[2007/09/09] \ifx\plainmode Y \let\numexpr\SavedNumexpr \fi @@ -6302,6 +6303,7 @@ $ \fi % \begin{macrocode} %</test2> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -6534,6 +6536,11 @@ $ \fi % \item % Fixes for cp850, cp852, nextstep. % \end{Version} +% \begin{Version}{2007/08/27 v1.2} +% \item +% Uses \cs{EdefSanitize} instead of \cs{PE@sanitize} +% from package \xpackage{pdfescape} (2007/08/27 v1.5). +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/tabularht.dtx b/Master/texmf-dist/source/latex/oberdiek/tabularht.dtx index 34c0ea48377..cd59cea4ddb 100644 --- a/Master/texmf-dist/source/latex/oberdiek/tabularht.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/tabularht.dtx @@ -962,6 +962,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/tabularkv.dtx b/Master/texmf-dist/source/latex/oberdiek/tabularkv.dtx index b378e31d53c..1a5549aa69d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/tabularkv.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/tabularkv.dtx @@ -278,6 +278,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/telprint.dtx b/Master/texmf-dist/source/latex/oberdiek/telprint.dtx index c336c8e5e25..12c7b3a636a 100644 --- a/Master/texmf-dist/source/latex/oberdiek/telprint.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/telprint.dtx @@ -17,7 +17,8 @@ % % This work consists of the main source file telprint.dtx % and the derived files -% telprint.sty, telprint.pdf, telprint.ins, telprint.drv. +% telprint.sty, telprint.pdf, telprint.ins, telprint.drv, +% telprint-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/telprint.dtx @@ -51,8 +52,9 @@ % % Installation: % TDS:tex/generic/oberdiek/telprint.sty -% TDS:doc/generic/oberdiek/telprint.pdf -% TDS:source/generic/oberdiek/telprint.dtx +% TDS:doc/latex/oberdiek/telprint.pdf +% TDS:doc/latex/oberdiek/telprint-test1.tex +% TDS:source/latex/oberdiek/telprint.dtx % %<*ignore> \begingroup @@ -67,7 +69,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: telprint 2007/04/11 v1.8 Formatting of German phone numbers (HO)} +\Msg{* Package: telprint 2007/09/09 v1.9 Formatting of German phone numbers (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +96,8 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file telprint.dtx and the derived files - telprint.sty, telprint.pdf, telprint.ins, telprint.drv. + telprint.sty, telprint.pdf, telprint.ins, telprint.drv, + telprint-test1.tex. \endpreamble @@ -103,6 +106,8 @@ and the derived files \file{telprint.drv}{\from{telprint.dtx}{driver}}% \usedir{tex/generic/oberdiek}% \file{telprint.sty}{\from{telprint.dtx}{package}}% + \usedir{doc/latex/oberdiek}% + \file{telprint-test1.tex}{\from{telprint.dtx}{test1}}% } \obeyspaces @@ -128,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{telprint.drv}% - [2007/04/11 v1.8 Formatting of German phone numbers (HO)]% + [2007/09/09 v1.9 Formatting of German phone numbers (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \usepackage[ngerman,english]{babel} @@ -138,7 +143,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{328} +% \CheckSum{422} % % \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 @@ -159,7 +164,7 @@ and the derived files % \GetFileInfo{telprint.drv} % % \title{The \xpackage{telprint} package} -% \date{2007/04/11 v1.8} +% \date{2007/09/09 v1.9} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -225,6 +230,7 @@ and the derived files % \subsection{Documentation in German} % % \begin{otherlanguage*}{ngerman} +% \hyphenation{To-ken-ma-kros} % \begin{itemize} % \item \DescribeMacro\telprint |telprint#1|\\ % Der eigentliche Anwenderbefehl zur formatierten Ausgabe von @@ -363,20 +369,44 @@ and the derived files \fi \expandafter\x\csname ver@telprint.sty\endcsname \ProvidesPackage{telprint}% - [2007/04/11 v1.8 Formatting of German phone numbers (HO)] + [2007/09/09 v1.9 Formatting of German phone numbers (HO)] % \end{macrocode} % +% \subsection{Catcodes} +% % \begin{macrocode} -\ifx\telprint\UnDeFiNeD -% \fi in derselben Zeile wie \endinput oder \expandafter verwenden! -\else\endinput\fi +\expandafter\edef\csname TELAtEnd\endcsname{% + \catcode64 \the\catcode64\relax +} +\catcode64 11 % @ +\def\TMP@EnsureCode#1#2{% + \edef\TELAtEnd{% + \TELAtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{36}{3}% $ +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{126}{13}% ~ (active) % \end{macrocode} +% +% \subsection{Package macros} % \begin{macrocode} \ifx\DeclareRobustCommand\UnDeFiNeD \def\DeclareRobustCommand*#1[1]{\def#1##1}% \def\TELreset{\let\DeclareRobustCommand=\UnDeFiNeD}% - \immediate\write-1{% - Package `telprint' warning: % + \input infwarerr.sty\relax + \@PackageInfo{telprint}{% Macros are not robust!% }% \else @@ -522,6 +552,66 @@ and the derived files % \begin{macrocode} \TELreset\let\TELreset=\UnDeFiNeD % \end{macrocode} +% +% \begin{macrocode} +\TELAtEnd +%</package> +% \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\@=11 % +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@\@ne +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@\@ne + \repeat +} +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \input telprint.sty\relax + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -582,8 +672,9 @@ and the derived files % \def\t{^^A % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % telprint.sty & tex/generic/oberdiek/telprint.sty\\ -% telprint.pdf & doc/generic/oberdiek/telprint.pdf\\ -% telprint.dtx & source/generic/oberdiek/telprint.dtx\\ +% telprint.pdf & doc/latex/oberdiek/telprint.pdf\\ +% telprint-test1.tex & doc/latex/oberdiek/telprint-test1.tex\\ +% telprint.dtx & source/latex/oberdiek/telprint.dtx\\ % \end{tabular}^^A % }^^A % \sbox0{\t}^^A @@ -752,6 +843,12 @@ and the derived files % \item % Line ends sanitized. % \end{Version} +% \begin{Version}{2007/09/09 v1.9} +% \item +% Catcode section added. +% \item +% Missing docstrip tag added. +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/source/latex/oberdiek/transparent.dtx b/Master/texmf-dist/source/latex/oberdiek/transparent.dtx index 7719d4f532b..296430a90d4 100644 --- a/Master/texmf-dist/source/latex/oberdiek/transparent.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/transparent.dtx @@ -368,6 +368,7 @@ Hello World % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/twoopt.dtx b/Master/texmf-dist/source/latex/oberdiek/twoopt.dtx index 8706b91b74b..09ce98d6730 100644 --- a/Master/texmf-dist/source/latex/oberdiek/twoopt.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/twoopt.dtx @@ -357,6 +357,7 @@ and the derived files % \begin{macrocode} %</package> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} diff --git a/Master/texmf-dist/source/latex/oberdiek/zref.dtx b/Master/texmf-dist/source/latex/oberdiek/zref.dtx index 7e16f7d5cd5..538670f6955 100644 --- a/Master/texmf-dist/source/latex/oberdiek/zref.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/zref.dtx @@ -3226,6 +3226,7 @@ the height difference of the two baselines is % \begin{macrocode} %</dotfill> % \end{macrocode} +% % \section{Installation} % % \subsection{Download} |