summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-04-12 22:56:39 +0000
committerKarl Berry <karl@freefriends.org>2011-04-12 22:56:39 +0000
commit3c9b5c2960ae2455180bdb3a4e67bf10175b39af (patch)
tree53ac9731c23e82f60349ec920ed8d816738913dc /Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx
parentf437333cf5d63d69f5ab9fd1eb553af4175037d0 (diff)
oberdiek (12apr11)
git-svn-id: svn://tug.org/texlive/trunk@22061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx1098
1 files changed, 1014 insertions, 84 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx b/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx
index e5cfd20f7fb..6883c07be4a 100644
--- a/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/ltxcmds.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2009, 2010 by
+% Copyright (C) 2009-2011 by
% Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%
% This work may be distributed and/or modified under the
@@ -23,7 +23,9 @@
% This work consists of the main source file ltxcmds.dtx
% and the derived files
% ltxcmds.sty, ltxcmds.pdf, ltxcmds.ins, ltxcmds.drv,
-% ltxcmds-test1.tex, ltxcmds-test-gobble.tex.
+% ltxcmds-test1.tex, ltxcmds-test-gobble.tex,
+% ltxcmds-test-ifempty.tex, ltxcmds-test-zapspace.tex,
+% ltxcmds-test-ifboxempty.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/ltxcmds.dtx
@@ -60,6 +62,9 @@
% TDS:doc/latex/oberdiek/ltxcmds.pdf
% TDS:doc/latex/oberdiek/test/ltxcmds-test1.tex
% TDS:doc/latex/oberdiek/test/ltxcmds-test-gobble.tex
+% TDS:doc/latex/oberdiek/test/ltxcmds-test-ifempty.tex
+% TDS:doc/latex/oberdiek/test/ltxcmds-test-zapspace.tex
+% TDS:doc/latex/oberdiek/test/ltxcmds-test-ifboxempty.tex
% TDS:source/latex/oberdiek/ltxcmds.dtx
%
%<*ignore>
@@ -77,7 +82,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: ltxcmds 2010/04/26 v1.7 LaTeX kernel commands for general use (HO)}
+\Msg{* Package: ltxcmds 2011/03/16 v1.18 LaTeX kernel commands for general use (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -88,7 +93,7 @@
This is a generated file.
-Copyright (C) 2009, 2010 by
+Copyright (C) 2009-2011 by
Heiko Oberdiek <heiko.oberdiek at googlemail.com>
This work may be distributed and/or modified under the
@@ -111,7 +116,9 @@ because some files are installed in TDS:tex/generic//.
This work consists of the main source file ltxcmds.dtx
and the derived files
ltxcmds.sty, ltxcmds.pdf, ltxcmds.ins, ltxcmds.drv,
- ltxcmds-test1.tex, ltxcmds-test-gobble.tex.
+ ltxcmds-test1.tex, ltxcmds-test-gobble.tex,
+ ltxcmds-test-ifempty.tex, ltxcmds-test-zapspace.tex,
+ ltxcmds-test-ifboxempty.tex.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -124,6 +131,9 @@ and the derived files
\usedir{doc/latex/oberdiek/test}%
\file{ltxcmds-test1.tex}{\from{ltxcmds.dtx}{test1}}%
\file{ltxcmds-test-gobble.tex}{\from{ltxcmds.dtx}{test-gobble}}%
+ \file{ltxcmds-test-ifempty.tex}{\from{ltxcmds.dtx}{test-ifempty}}%
+ \file{ltxcmds-test-zapspace.tex}{\from{ltxcmds.dtx}{test-zapspace}}%
+ \file{ltxcmds-test-ifboxempty.tex}{\from{ltxcmds.dtx}{test-ifboxempty}}%
}
\catcode32=13\relax% active space
@@ -154,17 +164,19 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{ltxcmds.drv}%
- [2010/04/26 v1.7 LaTeX kernel commands for general use (HO)]%
+ [2011/03/16 v1.18 LaTeX kernel commands for general use (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\usepackage{zref-savepos}
+\usepackage{paralist}
+\hfuzz=1pt
\begin{document}
\DocInput{ltxcmds.dtx}%
\end{document}
%</driver>
% \fi
%
-% \CheckSum{1158}
+% \CheckSum{2029}
%
% \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
@@ -185,7 +197,7 @@ and the derived files
% \GetFileInfo{ltxcmds.drv}
%
% \title{The \xpackage{ltxcmds} package}
-% \date{2010/04/26 v1.7}
+% \date{2011/03/16 v1.18}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -235,10 +247,12 @@ and the derived files
% \begin{declcs}{ltx@zero} \TO 0\\
% \cs{ltx@one} \TO 1\\
% \cs{ltx@two} \TO 2\\
-% \cs{ltx@cclv} \TO 255
+% \cs{ltx@cclv} \TO 255\\
+% \cs{ltx@minusone} \TO -1
% \end{declcs}
-% These commands are numbers 0, 1, 2 and 255. They are not digits
-% and a space is not gobbled afterwards.
+% These commands are numbers 0, 1, 2, 255 and -1. They are not digits
+% and a space is not gobbled afterwards. Macro \cs{ltx@minusone}
+% is available since version 2010/12/12 v1.15.
%
% \subsection{Argument killers}
%
@@ -257,10 +271,22 @@ and the derived files
%
% \subsection{Argument grabbers}
%
-% \begin{declcs}{ltx@firstofone} \M{1} \TO \meta{1}\\
+% \begin{declcs}{ltx@firstofone} \M{1} \TO \meta{1}\\[1ex]
% \cs{ltx@firstoftwo} \M{1} \M{2} \TO \meta{1}\\
-% \cs{ltx@secondoftwo} \M{1} \M{2} \TO \meta{2}
+% \cs{ltx@secondoftwo} \M{1} \M{2} \TO \meta{2}\\[1ex]
+% \cs{ltx@firstofthree} \M{1} \M{2} \M{3} \TO \meta{1}\\
+% \cs{ltx@secondofthree} \M{1} \M{2} \M{3} \TO \meta{2}\\
+% \cs{ltx@thirdofthree} \M{1} \M{2} \M{3} \TO \meta{3}\\
+% \cs{ltx@firstoffour} \M{1} \M{2} \M{3} \M{4} \TO \meta{1}\\
+% \cs{ltx@secondoffour} \M{1} \M{2} \M{3} \M{4} \TO \meta{2}\\
+% \cs{ltx@thirdoffour} \M{1} \M{2} \M{3} \M{4} \TO \meta{3}\\
+% \cs{ltx@fourthoffour} \M{1} \M{2} \M{3} \M{4} \TO \meta{4}
% \end{declcs}
+% Macros \cs{ltx@firstofthree}, \cs{ltx@secondofthree}
+% and \cs{ltx@thirdofthree} were added in version
+% 2010/11/12 v1.11.
+% Macros \cs{ltx@firstoffour}, \dots, \cs{ltx@forthoffour}
+% were added in version 2011/02/04 v1.16.
%
% \subsection{List helpers}
%
@@ -315,7 +341,9 @@ and the derived files
% \cs{ltx@percentchar} \TO \texttt{\%}\\
% \cs{ltx@backslashchar} \TO
% \makeatletter\texttt{\@backslashchar}\\
-% \cs{ltx@hashchar} \TO \texttt{\#}
+% \cs{ltx@hashchar} \TO \texttt{\#}\qquad(since v1.7)\\
+% \cs{ltx@leftbracechar} \TO \texttt{\textbraceleft}\qquad(since v1.8)\\
+% \cs{ltx@rightbracechar} \TO \texttt{\textbraceright}\qquad(since v1.8)
% \end{declcs}
%
% \subsection{Boolean switch}
@@ -326,6 +354,13 @@ and the derived files
% Unlike \plainTeX's \cs{newif}, \cs{ltx@newif} is not \cs{outer}.
% The command \meta{cmd} must start with the two characters |if|.
%
+% \begin{declcs}{ltx@newglobalif} \M{cmd}
+% \end{declcs}
+% \cs{ltx@newglobalif} defines a new boolean switch \meta{cmd}
+% like \cs{ltx@newif}. However the switch setting commands,
+% \meta{cmd} without the prefix |if| and followed by |true| or |false|
+% are acting globally.
+%
% \subsection{Command definitions}
%
% \begin{declcs}{ltx@ifundefined} \M{cmd} \M{yes} \M{no}
@@ -364,6 +399,14 @@ and the derived files
% macro \cs{ltx@StripPrefix} expands the next token
% once before stripping the prefix.
%
+% \begin{declcs}{ltx@onelevel@sanitize} \M{macro}
+% \end{declcs}
+% Macro \cs{ltx@onelevel@sanitize} provides \hologo{LaTeX}'s
+% \cs{@onelevel@sanitize}. The macro is expanded once and
+% the contents is converted to characters with catcode 12 (other)
+% and space tokens with catcode 10 (space). Then then sanitized
+% contents is stored into the macro again. Since version 1.12.
+%
% \subsection{File management}
%
% All macros in this section are expandable like
@@ -375,20 +418,21 @@ and the derived files
% \begin{declcs}{ltx@clsextension}\\
% \cs{ltx@pkgextension}
% \end{declcs}
-% If \cs{@clsextension}\slash\cs{@pkgextension} exists then
-% \cs{ltx@clsextension}\slash\cs{ltx@pkgextension}
-% returns this macro, otherwise the result is |cls|\slash|sty|.
+% Macros \cs{ltx@clsextension} and \cs{ltx@styextension}
+% stores the strings |cls| and |sty|. In opposite to \hologo{LaTeX}'s
+% \cs{@clsextension} and \cs{@styextension} they can also be
+% used after |\begin{document}|.
%
% \subsubsection{Load check}
%
% \begin{declcs}{ltx@ifclassloaded} \M{class} \M{yes} \M{no}\\
% \cs{ltx@ifpackageloaded} \M{package} \M{yes} \M{no}
% \end{declcs}
-% If the \meta{class}\slash\meta{package} are loaded the
-% macros \cs{ltx@ifclassloaded}\slash\cs{ltx@ifpackageloaded}
-% call the \meta{yes} argument. Otherwise \meta{no} is executed.
+% Macros \cs{ltx@ifclassloaded}\slash\cs{ltx@ifpackageloaded}
+% execute \meta{yes}, if the \meta{class} or \meta{package} is loaded,
+% otherwise \meta{no} is called.
% Both \meta{class} and \meta{package} are specified without
-% extension.
+% extension. The macros can also be used after |\begin{document}|.
%
% \begin{declcs}{ltx@iffileloaded} \M{file} \M{yes} \M{no}
% \end{declcs}
@@ -434,7 +478,8 @@ and the derived files
% \end{declcs}
% The \meta{addition} is appended to the parameterless macro \meta{cmd}.
% If \meta{cmd} is undefined or has the meaning \cs{relax}, then
-% it will be initialized as empty macro before.
+% it will be initialized as empty macro before. Due to a bug \meta{addition}
+% must not contain \cs{par} before version 2010/10/25 v1.9.
%
% \subsection{Macro \cs{ltx@ifnextchar}}
%
@@ -448,15 +493,83 @@ and the derived files
% \begin{declcs}{ltx@leavevmode}
% \end{declcs}
% Macro \cs{ltx@leavevmode} calls \hologo{pdfTeX}'s \cs{quitvmode}.
-% Otherwise it uses \cs{leavevmode} and defines it if necessary.
+% Otherwise \cs{leavevmode} is used and defined if it is necessary.
%
% \begin{declcs}{ltx@mbox}
% \end{declcs}
% Macro \cs{ltx@mbox} reimplements \cs{mbox} with two changes.
-% It uses \cs{ltx@leavevmode} instead of \cs{leavevmode} and
+% Instead of \cs{leavevmode} it uses \cs{ltx@leavevmode} and
% stops right after \cs{hbox}. Especially it does not grab
% the argument and allows the extended syntax of \cs{hbox}.
%
+% \subsection{Expandable test for emptiness}
+%
+% \begin{declcs}{ltx@ifempty} \M{stuff} \M{yes} \M{no}
+% \end{declcs}
+% Macro \cs{ltx@ifempty} checks in exact two expansion steps
+% whether \meta{stuff}
+% is empty or contains token. Depending on the result
+% \meta{yes} or \meta{no} is executed. The token in \meta{stuff}
+% may contain \cs{par} and unmatched conditionals (\cs{if}, \cs{else},
+% \cs{fi}, \dots). Since version 2010/11/12 v1.11.
+%
+% \begin{declcs}{ltx@ifblank} \M{stuff} \M{yes} \M{no}
+% \end{declcs}
+% Macro \cs{ltx@ifblank} tests in exact two expansion steps
+% if \meta{stuff} is empty or contain only blank spaces.
+% In this case argument \meta{yes} is called. If \meta{stuff}
+% contains other tokens than spaces then \meta{no} is executed.
+% Since version 2010/12/04 v1.13.
+%
+% \subsection{Stripping spaces}
+%
+% \begin{declcs}{ltx@zapspace} \M{stuff}
+% \end{declcs}
+% Macro \cs{ltx@zapspace} strips spaces from \meta{stuff}
+% that are not hidden inside curly braces. Like \hologo{LaTeX}'s
+% \cs{zap@space} it is expandable. Differences:
+% \begin{itemize}
+% \item
+% Syntax: \cs{zap@space} also expects a space token
+% and \cs{@empty} after \meta{stuff}.
+% \item
+% Macro \cs{ltx@zapspace} is expandable in exact two
+% expansion steps.
+% \item
+% Macro \cs{ltx@zapspace} always retains curly braces.
+% \item
+% Macro \cs{zap@space} has a bug. It stops stripping spaces
+% after a token group in curly braces if the first two tokens
+% inside the group are equal.
+% \item
+% Macro \cs{ltx@zapspace} also works with \cs{par}
+% and conditionals (\cs{if}, \cs{else}, \cs{fi}, \dots).
+% \end{itemize}
+% Macro \cs{ltx@zapspace} is available since version
+% 2010/12/07 v1.14.
+%
+% \subsection{Check for emptiness of boxes}
+%
+% \begin{declcs}{ltx@IfBoxEmpty} \M{box register number}
+% \M{yes} \M{no}
+% \end{declcs}
+% Macro \cs{ltx@IfBoxEmpty} calls \meta{yes} if
+% the box exists (\cs{ifvoid} returns false) and the box
+% does not contain any content. Otherwise if the box
+% is void or contains something, then \meta{no} is executed.
+% Thus being empty means that the box exists and is either
+% an \cs{hbox} or a \cs{vbox} and may even have dimensions other than
+% 0.0\,pt, but the box does not contain anything.
+% Macro \cs{ltx@IfBoxEmpty} is available since 2010/02/04 v1.16.
+%
+% \begin{declcs}{ltx@IfBoxVoidOrEmpty} \M{box register number}
+% \M{yes} \M{no}
+% \end{declcs}
+% Macro \cs{ltx@IfBoxVoidOrEmpty} calls \meta{yes} if
+% the box is either void or does not contain any content.
+% Otherwise \meta{no} is executed.
+% Macro \cs{ltx@IfBoxVoidOrEmpty} is available since 2010/02/04 v1.16.
+%
% \StopEventually{
% }
%
@@ -469,14 +582,18 @@ and the derived files
% \end{macrocode}
% Reload check, especially if the package is not used with \LaTeX.
% \begin{macrocode}
-\begingroup
- \catcode44 12 % ,
- \catcode45 12 % -
- \catcode46 12 % .
- \catcode58 12 % :
- \catcode64 11 % @
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode35=6 % #
+ \catcode39=12 % '
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode58=12 % :
+ \catcode64=11 % @
+ \catcode123=1 % {
+ \catcode125=2 % }
\expandafter\let\expandafter\x\csname ver@ltxcmds.sty\endcsname
\ifx\x\relax % plain-TeX, first loading
\else
@@ -484,7 +601,6 @@ and the derived files
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\else
- \catcode35 6 % #
\expandafter\ifx\csname PackageInfo\endcsname\relax
\def\x#1#2{%
\immediate\write-1{Package #1 Info: #2.}%
@@ -496,24 +612,27 @@ and the derived files
\aftergroup\endinput
\fi
\fi
-\endgroup
+\endgroup%
% \end{macrocode}
% Package identification:
% \begin{macrocode}
-\begingroup
- \catcode35 6 % #
- \catcode40 12 % (
- \catcode41 12 % )
- \catcode44 12 % ,
- \catcode45 12 % -
- \catcode46 12 % .
- \catcode47 12 % /
- \catcode58 12 % :
- \catcode64 11 % @
- \catcode91 12 % [
- \catcode93 12 % ]
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode35=6 % #
+ \catcode39=12 % '
+ \catcode40=12 % (
+ \catcode41=12 % )
+ \catcode44=12 % ,
+ \catcode45=12 % -
+ \catcode46=12 % .
+ \catcode47=12 % /
+ \catcode58=12 % :
+ \catcode64=11 % @
+ \catcode91=12 % [
+ \catcode93=12 % ]
+ \catcode123=1 % {
+ \catcode125=2 % }
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\def\x#1#2#3[#4]{\endgroup
\immediate\write-1{Package: #3 #4}%
@@ -532,46 +651,57 @@ and the derived files
\fi
\expandafter\x\csname ver@ltxcmds.sty\endcsname
\ProvidesPackage{ltxcmds}%
- [2010/04/26 v1.7 LaTeX kernel commands for general use (HO)]
+ [2011/03/16 v1.18 LaTeX kernel commands for general use (HO)]%
% \end{macrocode}
%
% \begin{macrocode}
-\begingroup
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
\def\x{\endgroup
\expandafter\edef\csname LTXcmds@AtEnd\endcsname{%
- \catcode35 \the\catcode35\relax
- \catcode64 \the\catcode64\relax
- \catcode123 \the\catcode123\relax
- \catcode125 \the\catcode125\relax
+ \endlinechar=\the\endlinechar\relax
+ \catcode13=\the\catcode13\relax
+ \catcode32=\the\catcode32\relax
+ \catcode35=\the\catcode35\relax
+ \catcode61=\the\catcode61\relax
+ \catcode64=\the\catcode64\relax
+ \catcode123=\the\catcode123\relax
+ \catcode125=\the\catcode125\relax
}%
}%
-\x
-\catcode35 6 % #
-\catcode64 11 % @
-\catcode123 1 % {
-\catcode125 2 % }
+\x\catcode61\catcode48\catcode32=10\relax%
+\catcode13=5 % ^^M
+\endlinechar=13 %
+\catcode35=6 % #
+\catcode64=11 % @
+\catcode123=1 % {
+\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
\edef\LTXcmds@AtEnd{%
\LTXcmds@AtEnd
- \catcode#1 \the\catcode#1\relax
+ \catcode#1=\the\catcode#1\relax
}%
- \catcode#1 #2\relax
+ \catcode#1=#2\relax
}
+\TMP@EnsureCode{36}{3}% $
+\TMP@EnsureCode{38}{4}% &
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{60}{12}% <
-\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{96}{12}% `
\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{94}{12}% ^ (superscript) (!)
\TMP@EnsureCode{124}{12}% |
+\edef\LTXcmds@AtEnd{\LTXcmds@AtEnd\noexpand\endinput}
% \end{macrocode}
%
% \subsection{Numbers}
@@ -602,6 +732,14 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ltx@minusone}
+% \begin{macrocode}
+\def\ltx@minusone{%
+ -\ltx@one
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Argument killers}
%
% \begin{macro}{\ltx@gobble}
@@ -631,8 +769,7 @@ and the derived files
\romannumeral
\csname ltx@zero%
\expandafter\LTXcmds@GobbleNum
- \romannumeral\expandafter\ltx@firstofone
- \expandafter{\LTXcmds@num#1}000{m\endcsname}%
+ \romannumeral\LTXcmds@num{#1}000{m\endcsname}%
}
% \end{macrocode}
% \end{macro}
@@ -669,6 +806,43 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ltx@firstofthree}
+% \begin{macrocode}
+\long\def\ltx@firstofthree#1#2#3{#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@secondofthree}
+% \begin{macrocode}
+\long\def\ltx@secondofthree#1#2#3{#2}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@thirdofthree}
+% \begin{macrocode}
+\long\def\ltx@thirdofthree#1#2#3{#3}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ltx@firstoffour}
+% \begin{macrocode}
+\long\def\ltx@firstoffour#1#2#3#4{#1}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@secondoffour}
+% \begin{macrocode}
+\long\def\ltx@secondoffour#1#2#3#4{#2}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@thirdoffour}
+% \begin{macrocode}
+\long\def\ltx@thirdoffour#1#2#3#4{#3}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@fourthoffour}
+% \begin{macrocode}
+\long\def\ltx@fourthoffour#1#2#3#4{#4}%
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{List helpers}
%
% \begin{macro}{\ltx@car}
@@ -732,8 +906,7 @@ and the derived files
\romannumeral
\csname LTXcmds@CarNumFinish%
\expandafter\LTXcmds@CarNum
- \romannumeral\expandafter\ltx@firstofone
- \expandafter{\LTXcmds@num#1}000{x\endcsname}%
+ \romannumeral\LTXcmds@num{#1}000{x\endcsname}%
}
% \end{macrocode}
% \end{macro}
@@ -837,6 +1010,24 @@ and the derived files
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\ltx@leftbracechar}
+% \begin{macrocode}
+\begingroup
+ \lccode`0=`\{\relax
+\lowercase{\endgroup
+ \def\ltx@leftbracechar{0}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@rightbracechar}
+% \begin{macrocode}
+\begingroup
+ \lccode`0=`\}\relax
+\lowercase{\endgroup
+ \def\ltx@rightbracechar{0}%
+}
+% \end{macrocode}
+% \end{macro}
%
% \subsection{Boolean switch}
%
@@ -871,6 +1062,38 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ltx@newglobalif}
+% \begin{macrocode}
+\def\ltx@newglobalif#1{%
+ \begingroup
+ \escapechar=-1 %
+ \expandafter\endgroup
+ \expandafter\LTXcmds@newglobalif\string#1\@nil
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\LTXcmds@newglobalif}
+% \begin{macrocode}
+\begingroup
+ \escapechar=-1 %
+\expandafter\endgroup
+\expandafter
+\def\expandafter\LTXcmds@newglobalif\string\if#1\@nil{%
+ \expandafter\edef\csname#1true\endcsname{%
+ \global\let
+ \expandafter\noexpand\csname if#1\endcsname
+ \noexpand\iftrue
+ }%
+ \expandafter\edef\csname#1false\endcsname{%
+ \global\let
+ \expandafter\noexpand\csname if#1\endcsname
+ \noexpand\iffalse
+ }%
+ \csname#1false\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Command definitions}
%
% \begin{macro}{\ltx@LocalExpandAfter}
@@ -958,6 +1181,17 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ltx@onelevel@sanitize}
+% \begin{macrocode}
+\def\ltx@onelevel@sanitize#1{%
+ \edef#1{%
+ \expandafter
+ \ltx@RemovePrefix\meaning#1%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{File management}
%
% \subsubsection{File extensions}
@@ -1042,7 +1276,7 @@ and the derived files
% \begin{macro}{\ltx@ifclasslater}
% \begin{macrocode}
\def\ltx@ifclasslater#1{%
- \ltx@ifclasslater{#1.\ltx@clsextension}%
+ \ltx@iffilelater{#1.\ltx@clsextension}%
}
% \end{macrocode}
% \end{macro}
@@ -1090,15 +1324,17 @@ and the derived files
0%
\fi
}%
-}
% \end{macrocode}
% \end{macro}
+% \begin{macrocode}
+}
+% \end{macrocode}
%
% \subsection{Macro additions}
%
% \begin{macro}{\ltx@GlobalAppendToMacro}
% \begin{macrocode}
-\def\ltx@GlobalAppendToMacro#1#2{%
+\long\def\ltx@GlobalAppendToMacro#1#2{%
\ifx\ltx@undefined#1%
\let#1\ltx@empty
\else
@@ -1115,7 +1351,7 @@ and the derived files
% \end{macro}
% \begin{macro}{\ltx@LocalAppendToMacro}
% \begin{macrocode}
-\def\ltx@LocalAppendToMacro#1#2{%
+\long\def\ltx@LocalAppendToMacro#1#2{%
\global\let\LTXcmds@gtemp#1%
\ifx\ltx@undefined\LTXcmds@gtemp
\global\let\LTXcmds@gtemp\ltx@empty
@@ -1237,15 +1473,242 @@ and the derived files
% \begin{macro}{\LTXcmds@num}
% \begin{macrocode}
\ltx@IfUndefined{numexpr}{%
- \let\LTXcmds@num\number
+ \def\LTXcmds@num#1{%
+ \expandafter\ltx@firstofone\expandafter{%
+ \number#1%
+ }%
+ }%
}{%
- \let\LTXcmds@num\numexpr
+ \def\LTXcmds@num#1{%
+ \expandafter\ltx@firstofone\expandafter{%
+ \the\numexpr#1%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Expandable test for emptiness}
+%
+% \begin{macrocode}
+\ltx@IfUndefined{detokenize}{%
+% \end{macrocode}
+%
+% \subsubsection{Vanilla \hologo{TeX}}
+%
+% \begin{macro}{\ltx@ifempty}
+% The macro is based on \cs{@ifempty} of Robert R. Schneck
+% \cite{ifempty:schneck}
+% and \cs{@ifnull} of Ulrich Diez \cite{ifnull:diez}.
+% There are three cases to consider:
+% \begin{compactenum}
+% \item |#1| is empty,
+% \item |#1| is not empty and the first token
+% is not a begingroup character,
+% \item |#1| starts with a begingroup character (catcode 1).
+% \end{compactenum}
+% \begin{macrocode}
+ \def\LTXcmds@temp#1{%
+ \long\def\ltx@ifempty##1{%
+ \romannumeral0%
+ \iffalse{\fi
+ \expandafter\ltx@gobble\expandafter{%
+ \expandafter{\string##1}%
+ \expandafter\ltx@gobble\string
+ }%
+ \expandafter\ltx@firstofthree\expandafter
+ {\iffalse}\fi
+ \expandafter#1\ltx@secondoftwo
+ }%
+ \expandafter#1\ltx@firstoftwo
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ltx@ifblank}
+% \begin{macrocode}
+ \long\def\ltx@ifblank##1{%
+ \romannumeral0%
+ \iffalse{\fi
+ \expandafter\expandafter\expandafter\ltx@gobble
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\string\ltx@gobble##1.%
+ }%
+ \expandafter\ltx@gobble\string
+ }%
+ \expandafter\ltx@firstofthree\expandafter
+ {\iffalse}\fi
+ \expandafter#1\ltx@secondoftwo
+ }%
+ \expandafter#1\ltx@firstoftwo
+ }%
+ }%
+ \LTXcmds@temp{ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+}{%
+% \end{macrocode}
+%
+% \subsubsection{With \cs{detokenize}}
+%
+% Ahmed Musa provided \cs{ifstrempty} using \cs{detokenize}
+% and \cs{pdfstrcmp} \cite{ifstrempty:musa}. Ulrich Diez, GL,
+% Heiko Oberdiek
+% improved it further by removing \cs{pdfstrcmp} and
+% taking three arguments
+% \cite{ifstrempty:diez1,ifstrempty:diez2,ifstrempty:diez3,^^A
+% ifstrempty:gl,ifstrempty:ho}.
+%
+% \begin{macro}{\ltx@ifempty}
+% \begin{macrocode}
+ \long\def\ltx@ifempty#1{%
+ \romannumeral%
+ \csname
+ LTXcmds@ifempty%
+ \ifcat$\detokenize{#1}$%
+ @%
+ \fi
+ \endcsname
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\LTXcmds@ifempty@}
+% \begin{macrocode}
+ \long\def\LTXcmds@ifempty@#1#2{0 #1}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\LTXcmds@ifempty}
+% \begin{macrocode}
+ \long\def\LTXcmds@ifempty#1#2{0 #2}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{\cs{ltx@ifblank}}
+%
+% \begin{macro}{\ltx@ifblank}
+% \begin{macrocode}
+ \long\def\ltx@ifblank#1{%
+ \romannumeral%
+ \csname
+ LTXcmds@ifempty%
+ \ifcat$\detokenize\expandafter{\ltx@gobble#1.}$%
+ @%
+ \fi
+ \endcsname
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+%
+% \subsection{\cs{ltx@zapspace}}
+%
+% \begin{macro}{\ltx@zapspace}
+% \begin{macrocode}
+\long\def\ltx@zapspace#1{%
+ \romannumeral
+ \LTXcmds@zapspace\ltx@zero#1 \@nil
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\LTXcmds@zapspace}
+% \begin{macrocode}
+\long\def\LTXcmds@zapspace#1 #2\@nil{%
+ \ltx@ifempty{#2}{%
+ #1%
+ }{%
+ \LTXcmds@zapspace#1#2\@nil
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{ltx@IfBoxEmpty}}
+%
+% In case of \hologo{eTeX} the test for an empty box
+% is done via \cs{lastnodetype} as suggested
+% by David Kastrup \cite{ifboxempty:dak}.
+% \begin{macrocode}
+\ltx@IfUndefined{lastnodetype}{%
+ \catcode`\$=9 %
+ \catcode`\&=14 %
+}{%
+ \catcode`\$=14 %
+ \catcode`\&=9 %
+}
+% \end{macrocode}
+% \begin{macro}{\ltx@IfBoxEmpty}
+% \begin{macrocode}
+\def\ltx@IfBoxEmpty#1{%
+ \ifvoid#1\relax
+ \expandafter\ltx@secondoftwo
+ \else
+% \end{macrocode}
+% Implementation using \hologo{eTeX}'s \cs{lastnodetype}.
+% \begin{macrocode}
+& \begingroup
+& \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{%
+& \ifhmode\unhcopy\else\unvcopy\fi#1\relax
+& \expandafter
+& }%
+& \expandafter\endgroup
+& \ifnum\lastnodetype<\ltx@zero
+& \expandafter\expandafter\expandafter\ltx@firstoftwo
+& \else
+& \expandafter\expandafter\expandafter\ltx@secondoftwo
+& \fi
+% \end{macrocode}
+% Implementation without \hologo{eTeX} using a signature
+% at the beginning of the test box.
+% \begin{macrocode}
+$ \begingroup
+$ \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{%
+$ \penalty\ltx@one
+$ \ifhmode\unhcopy\else\unvcopy\fi#1\relax
+$ \expandafter
+$ }%
+$ \ifnum\lastpenalty=\ltx@one
+% \end{macrocode}
+% Box 0 has been changed and is restored by
+% closing the group.
+% \begin{macrocode}
+$ \endgroup
+$ \begingroup
+$ \setbox\ltx@zero=\ifhbox#1\hbox\else\vbox\fi{%
+$ \penalty\ltx@two
+$ \ifhmode\unhcopy\else\unvcopy\fi#1\relax
+$ \expandafter
+$ }%
+$ \ifnum\lastpenalty=\ltx@two
+$ \def\next{\endgroup\expandafter\ltx@firstoftwo}%
+$ \else
+$ \def\next{\endgroup\expandafter\ltx@secondoftwo}%
+$ \fi
+$ \else
+$ \def\next{\endgroup\expandafter\ltx@secondoftwo}%
+$ \fi
+$ \next
+ \fi
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ltx@IfBoxVoidOrEmpty}
% \begin{macrocode}
-\LTXcmds@AtEnd
+\def\ltx@IfBoxVoidOrEmpty#1{%
+ \ifvoid#1\relax
+ \expandafter\ltx@thirdoffour
+ \fi
+ \ltx@IfBoxEmpty{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\LTXcmds@AtEnd%
%</package>
% \end{macrocode}
%
@@ -1309,6 +1772,22 @@ and the derived files
\advance\count@ 1 %
\repeat
}
+\def\RangeCatcodeCheck#1#2#3{%
+ \count@=#1\relax
+ \loop
+ \ifnum#3=\catcode\count@
+ \else
+ \errmessage{%
+ Character \the\count@\space
+ with wrong catcode \the\catcode\count@\space
+ instead of \number#3%
+ }%
+ \fi
+ \ifnum\count@<#2\relax
+ \advance\count@ 1 %
+ \repeat
+}
+\def\space{ }
\expandafter\ifx\csname LoadCommand\endcsname\relax
\def\LoadCommand{\input ltxcmds.sty\relax}%
\fi
@@ -1319,15 +1798,20 @@ and the derived files
\RangeCatcodeInvalid{123}{255}%
\catcode`\@=12 %
\catcode`\\=0 %
- \catcode`\{=1 %
- \catcode`\}=2 %
- \catcode`\#=6 %
- \catcode`\[=12 %
- \catcode`\]=12 %
\catcode`\%=14 %
- \catcode`\ =10 %
- \catcode13=5 %
\LoadCommand
+ \RangeCatcodeCheck{0}{36}{15}%
+ \RangeCatcodeCheck{37}{37}{14}%
+ \RangeCatcodeCheck{38}{47}{15}%
+ \RangeCatcodeCheck{48}{57}{12}%
+ \RangeCatcodeCheck{58}{63}{15}%
+ \RangeCatcodeCheck{64}{64}{12}%
+ \RangeCatcodeCheck{65}{90}{11}%
+ \RangeCatcodeCheck{91}{91}{15}%
+ \RangeCatcodeCheck{92}{92}{0}%
+ \RangeCatcodeCheck{93}{96}{15}%
+ \RangeCatcodeCheck{97}{122}{11}%
+ \RangeCatcodeCheck{123}{255}{15}%
\RestoreCatcodes
}
\Test
@@ -1338,7 +1822,7 @@ and the derived files
%</test1>
% \end{macrocode}
%
-% \section{Test \cs{ltx@GobbleNum}}
+% \subsection{Test \cs{ltx@GobbleNum}}
%
% \begin{macrocode}
%<*test-gobble>
@@ -1348,7 +1832,7 @@ and the derived files
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input ltxcmds.sty\relax
\else
- \RequirePackage{ltxcmds}[2010/04/26]%
+ \RequirePackage{ltxcmds}[2011/03/16]%
\fi
\catcode`\@=11 %
\def\msg#{\immediate\write16}%
@@ -1402,6 +1886,16 @@ X=X\\
\Test{-1}abc=abc\\
\Test2\par\par\relax=\relax\\
+\begingroup
+ \count1=2 %
+ \Test{\count1}abc=c\\%
+\endgroup
+
+\ltx@IfUndefined{numexpr}{%
+}{%
+ \Test{1+1}abc=c\\%
+}
+
\msg{[Test \string\ltx@CdrNum]}%
\long\def\Test#1=#2\\{%
\edef\StrA{\ltx@CdrNum#1\@nil}%
@@ -1512,6 +2006,298 @@ X=%
%</test-gobble>
% \end{macrocode}
%
+% \subsection{Test \cs{ltx@ifempty}}
+%
+% \begin{macrocode}
+%<*test-ifempty>
+\catcode`\{=1 %
+\catcode`\}=2 %
+\catcode`\#=6 %
+\catcode`\@=11 %
+\errorcontextlines=1000 %
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input ltxcmds.sty\relax
+\else
+ \RequirePackage{ltxcmds}[2011/03/16]%
+\fi
+\def\msg#{\immediate\write16}
+\def\TestY{\Y}
+\def\TestN{\N}
+\msg{* \string\ltx@ifempty}
+\long\def\test#1{%
+ \begingroup
+ % Calculate expected test result via macro definition
+ \def\Stuff{#1}%
+ \ifx\Stuff\ltx@empty
+ \def\StuffEmpty{\Y}%
+ \else
+ \def\StuffEmpty{\N}%
+ \fi
+ % Test \ltx@ifempty
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\TestEmpty
+ \expandafter\expandafter\expandafter{%
+ \ltx@ifempty{#1}{\Y}{\N}%
+ }%
+ \ifx\StuffEmpty\TestEmpty
+ \msg{* Test OK}%
+ \else
+ \ltx@IfUndefined{detokenize}{}{%
+ \msg{Stuff: [\detokenize{\Stuff}]}%
+ }%
+ \errmessage{Test failed!}%
+ \fi
+ \endgroup
+}
+\test{}
+\test{a}
+\test{abc}
+\test{\par}
+\test{ }
+\test{\if}
+\test{{\if}}
+\test{\else}
+\test{{\else}}
+\test{\fi}
+\test{{}\fi}
+\test{\or\ifcase}
+\test{{}}
+\test{{a}}
+\test{{}abc}
+\test{{\par}}
+\test{{}\par}
+% \end{macrocode}
+% \begin{macrocode}
+\def\SpaceTwo#1{%
+ \def\SpaceTwo{#1#1}%
+}\SpaceTwo{ }
+\msg{* \string\ltx@ifblank}
+\long\def\test#1{%
+ \begingroup
+ % Calculate expected test result via macro definition
+ \def\Stuff{#1}%
+ \ifx\Stuff\ltx@empty
+ \def\StuffEmpty{\Y}%
+ \else
+ \ifx\Stuff\ltx@space
+ \def\StuffEmpty{\Y}%
+ \else
+ \ifx\Stuff\SpaceTwo
+ \def\StuffEmpty{\Y}%
+ \else
+ \def\StuffEmpty{\N}%
+ \fi
+ \fi
+ \fi
+ % Test \ltx@ifblank
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\TestEmpty
+ \expandafter\expandafter\expandafter{%
+ \ltx@ifblank{#1}{\Y}{\N}%
+ }%
+ \ifx\StuffEmpty\TestEmpty
+ \msg{* Test OK}%
+ \else
+ \ltx@IfUndefined{detokenize}{}{%
+ \msg{Stuff: [\detokenize{\Stuff}]}%
+ }%
+ \errmessage{Test failed!}%
+ \fi
+ \endgroup
+}
+\test{}
+\test{a}
+\test{\if}
+\test{\else}
+\test{\fi}
+\test{ \fi}
+\test{\par}
+\test{ \par}
+\test{{}}
+\test{ {}}
+\def\x#1{%
+ \test{#1#1}%
+ \test{#1#1{}}%
+ \test{#1#1\par}%
+ \test{#1#1\else}%
+}\x{ }
+\csname @@end\endcsname\end
+%</test-ifempty>
+% \end{macrocode}
+%
+% \subsection{Test \cs{ltx@zap@space}}
+%
+% \begin{macrocode}
+%<*test-zapspace>
+\catcode`\{=1 %
+\catcode`\}=2 %
+\catcode`\#=6 %
+\catcode`\@=11 %
+\errorcontextlines=1000 %
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input ltxcmds.sty\relax
+\else
+ \RequirePackage{ltxcmds}[2011/03/16]%
+\fi
+\def\msg#{\immediate\write16}
+\def\space{ }
+\def\empty{}
+\msg{* \string\ltx@zapspace}
+\long\def\test#1#2{%
+ \begingroup
+ \def\TestInput{#1}%
+ \def\TestExpected{#2}%
+ % Test \ltx@zapspace
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\TestResult
+ \expandafter\expandafter\expandafter{%
+ \ltx@zapspace{#1}%
+ }%
+ \ifx\TestResult\TestExpected
+ \msg{* Test OK}%
+ \else
+ \ltx@onelevel@sanitize\TestInput
+ \ltx@onelevel@sanitize\TestExpected
+ \ltx@onelevel@sanitize\TestResult
+ \msg{* Input: \space\space\space[\TestInput]}%
+ \msg{ \space Result: \space\space[\TestResult]}%
+ \msg{ \space Expected: [\TestExpected]}%
+ \errmessage{Test failed!}%
+ \fi
+ \endgroup
+}
+\long\def\etest#1#2{%
+ \begingroup
+ \edef\x{\endgroup
+ \noexpand\test{#1}{#2}%
+ }%
+ \x
+}
+\catcode`\~=13 %
+\let~\noexpand
+% \end{macrocode}
+% \begin{macrocode}
+\test{}{}
+\test{{}}{{}}
+\test{ {}}{{}}
+\test{{ }}{{ }}
+\test{{} }{{}}
+\test{ {} }{{}}
+\test{ { } }{{ }}
+\test{a {b} c}{a{b}c}
+\test{a bb ccc}{abbccc}
+\test{{a} {bb} {ccc}}{{a}{bb}{ccc}}
+\test{\par}{\par}
+\test{\if}{\if}
+\test{\space}{\space}
+\etest{\par\space\par}{\par\par}
+\etest{~\empty\space~\empty}{~\empty~\empty}
+\etest{~\fi\space~\else\space}{~\fi~\else}
+% \end{macrocode}
+% \begin{macrocode}
+\csname @@end\endcsname\end
+%</test-zapspace>
+% \end{macrocode}
+%
+% \subsection{Test \cs{ltx@IfBoxEmpty}}
+%
+% \begin{macrocode}
+%<*test-ifboxempty>
+\catcode`\{=1 %
+\catcode`\}=2 %
+\catcode`\#=6 %
+\catcode`\@=11 %
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input ltxcmds.sty\relax
+\else
+ \RequirePackage{ltxcmds}[2011/03/16]%
+\fi
+\def\msg#{\immediate\write16}
+ % make box 0 void
+\begingroup
+ \setbox0=\box0 %
+\endgroup
+\ifvoid0 %
+\else
+ \errmessage{Voiding box 0 failed}%
+\fi
+\setbox2=\box0 %
+\def\test#1#2{%
+ \@test{#1}{#2}%
+ \@@test{#1}{#2}%
+ \chardef\x=#1%
+ \@test\x{#2}%
+ \@@test\x{#2}%
+}
+\def\@test#1#2{%
+ \begingroup
+ \setbox9=\hbox{%
+ \def\TestExpected{#2}%
+ \ltx@IfBoxEmpty{#1}{%
+ \def\TestResult{Y}%
+ }{%
+ \def\TestResult{N}%
+ }%
+ \ifx\TestExpected\TestResult
+ \msg{* Test passed.}%
+ \else
+ \errmessage{Test failed!}%
+ \fi
+ }%
+ \ifdim\wd9=0pt %
+ \else
+ \errmessage{Unwanted space?}%
+ \fi
+ \endgroup
+}
+\def\@@test#1#2{%
+ \begingroup
+ \setbox9=\hbox{%
+ \def\TestExpected{#2}%
+ \ifvoid#1\def\TestExpected{Y}\fi
+ \ltx@IfBoxVoidOrEmpty{#1}{%
+ \def\TestResult{Y}%
+ }{%
+ \def\TestResult{N}%
+ }%
+ \ifx\TestExpected\TestResult
+ \msg{* Test passed.}%
+ \else
+ \errmessage{Test failed!}%
+ \fi
+ }%
+ \ifdim\wd9=0pt %
+ \else
+ \errmessage{Unwanted space?}%
+ \fi
+ \endgroup
+}
+\test0N
+\test2N
+\setbox0=\hbox{}
+\test0Y
+\setbox2=\hbox{}
+\test2Y
+\setbox0=\vbox{}
+\test0Y
+\setbox2=\vbox{}
+\test0Y
+\setbox0=\hbox{ }%
+\test0N
+\setbox2=\hbox{ }%
+\test2N
+\setbox0=\hbox{\penalty1}%
+\test0N
+\setbox2=\hbox{\penalty1}%
+\test2N
+\csname @@end\endcsname\end
+%</test-ifboxempty>
+% \end{macrocode}
+
+%
% \section{Installation}
%
% \subsection{Download}
@@ -1575,6 +2361,9 @@ X=%
% ltxcmds.pdf & doc/latex/oberdiek/ltxcmds.pdf\\
% test/ltxcmds-test1.tex & doc/latex/oberdiek/test/ltxcmds-test1.tex\\
% test/ltxcmds-test-gobble.tex & doc/latex/oberdiek/test/ltxcmds-test-gobble.tex\\
+% test/ltxcmds-test-ifempty.tex & doc/latex/oberdiek/test/ltxcmds-test-ifempty.tex\\
+% test/ltxcmds-test-zapspace.tex & doc/latex/oberdiek/test/ltxcmds-test-zapspace.tex\\
+% test/ltxcmds-test-ifboxempty.tex & doc/latex/oberdiek/test/ltxcmds-test-ifboxempty.tex\\
% ltxcmds.dtx & source/latex/oberdiek/ltxcmds.dtx\\
% \end{tabular}^^A
% }^^A
@@ -1695,6 +2484,92 @@ X=%
%\end{verbatim}
% \end{quote}
%
+% \begin{thebibliography}{9}
+% \raggedright
+%
+% \bibitem{ifempty:schneck}
+% Robert R. Schneck:
+% \textit{Re: \cs{ifempty} solution %
+% (was Macro puzzle: maximally general \cs{ifempty})};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:3eef1ada_6@corp.newsgroups.com},
+% 2003-06-17.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/be03a159ec374895}}
+%
+% \bibitem{ifnull:diez}
+% Ulrich Diez:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:ibk3t8$ee7$1@news.albasani.net},
+% 2010-11-12.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/803bd57221a04996}}
+%
+% \bibitem{ifstrempty:musa}
+% Ahmed Musa:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:f5496afe-40ed-42bd-b629-a2419ecf7c0d@o14g2000prn.googlegroups.com},
+% 2010-12-03.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/fbf7d61a0c3a807d}}
+%
+% \bibitem{ifstrempty:diez1}
+% Ulrich Diez:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:idbo94$uka$1@four.albasani.net},
+% 2010-12-03.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/0c230ee479487962}}
+%
+% \bibitem{ifstrempty:diez2}
+% Ulrich Diez:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:idbpu4$cg1$1@news.albasani.net},
+% 2010-12-03.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/bbef4263390d647b}}
+%
+% \bibitem{ifstrempty:diez3}
+% Ulrich Diez:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:idd4ga$r83$1@four.albasani.net},
+% 2010-12-04.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/00dfd1ec103cd272}}
+%
+% \bibitem{ifstrempty:gl}
+% GL:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:4cfa2e27$0$7389$426a74cc@news.free.fr},
+% 2010-12-04.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/d3a75995c1cf267e}}
+%
+% \bibitem{ifstrempty:ho}
+% Heiko Oberdiek:
+% \textit{Re: TeX refuses to strip outer braces in argument};
+% newsgroup \xnewsgroup{comp.text.tex},
+% \url{news:iddhq1$3kj$1@news.eternal-september.org},
+% 2010-12-04.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/5f7a23e3ab70e347}}
+%
+% \bibitem{ifboxempty:dak}
+% David Kastrup:
+% \textit{How to detect if \cs{vbox} is empty};
+% newsgroup \xnewsgroup{comp.text.tex},
+% 2011-02-04.\\
+% {\small
+% \url{http://groups.google.com/group/comp.text.tex/msg/8d3cb89496a4d86d}}
+%
+% \end{thebibliography}
+%
% \begin{History}
% \begin{Version}{2009/08/05 v1.0}
% \item
@@ -1751,6 +2626,61 @@ X=%
% \item
% \cs{ltx@hashchar} added.
% \end{Version}
+% \begin{Version}{2010/09/11 v1.8}
+% \item
+% \cs{ltx@leftbracechar}, \cs{ltx@rightbracechar} added.
+% \end{Version}
+% \begin{Version}{2010/10/25 v1.9}
+% \item
+% \cs{ltx@LocalAppendToMacro} and \cs{ltx@GlobalAppendToMacro} are
+% now \cs{long}.
+% \end{Version}
+% \begin{Version}{2010/10/31 v1.10}
+% \item
+% \cs{ltx@newglobalif} added.
+% \end{Version}
+% \begin{Version}{2010/11/12 v1.11}
+% \item
+% \cs{ltx@ifempty} added.
+% \item
+% \cs{ltx@firstofthree}, \cs{ltx@secondofthree}, \cs{ltx@thirdofthree}
+% added.
+% \end{Version}
+% \begin{Version}{2010/12/02 v1.12}
+% \item
+% \cs{ltx@onelevel@sanitize} added.
+% \item
+% \cs{LTXcmds@num} fixed for the case with \cs{numexpr}
+% (bug found by GL).
+% \end{Version}
+% \begin{Version}{2010/12/04 v1.13}
+% \item
+% \cs{ltx@ifblank} added.
+% \item
+% Optimization for \cs{ltx@ifempty}.
+% \end{Version}
+% \begin{Version}{2010/12/07 v1.14}
+% \item
+% \cs{ltx@zapspace} added.
+% \end{Version}
+% \begin{Version}{2010/12/12 v1.15}
+% \item
+% \cs{ltx@minusone} added.
+% \end{Version}
+% \begin{Version}{2011/02/04 v1.16}
+% \item
+% \cs{ltx@IfBoxEmpty} and \cs{ltx@IfBoxVoidOrEmpty} added.
+% \item
+% \cs{ltx@firstoffour}, \dots, \cs{ltx@fourthoffour} added.
+% \end{Version}
+% \begin{Version}{2011/02/05 v1.17}
+% \item
+% \cs{ltx@IfBoxEmpty}: an empty box may have non-zero dimensions.
+% \end{Version}
+% \begin{Version}{2011/03/16 v1.18}
+% \item
+% \cs{ltx@ifclasslater} fixed.
+% \end{Version}
% \end{History}
%
% \PrintIndex