summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/pdfescape.dtx224
1 files changed, 153 insertions, 71 deletions
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