diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx | 158 |
1 files changed, 95 insertions, 63 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx b/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx index 42f1cf85edb..7e39ae9a0f0 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx @@ -70,7 +70,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: ifluatex 2009/04/10 v1.1 Provides the ifluatex switch (HO)} +\Msg{* Package: ifluatex 2009/04/17 v1.2 Provides the ifluatex switch (HO)} \Msg{************************************************************************} \keepsilent @@ -141,7 +141,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ifluatex.drv}% - [2009/04/10 v1.1 Provides the ifluatex switch (HO)]% + [2009/04/17 v1.2 Provides the ifluatex switch (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \begin{document} @@ -150,7 +150,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{462} +% \CheckSum{495} % % \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 @@ -171,7 +171,7 @@ and the derived files % \GetFileInfo{ifluatex.drv} % % \title{The \xpackage{ifluatex} package} -% \date{2009/04/10 v1.1} +% \date{2009/04/17 v1.2} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -204,11 +204,11 @@ and the derived files % |\fi| % \end{quote} % -% Since version 0.40 \LuaTeX\ only provides \cs{directlua} at startup +% Since version 0.39 \LuaTeX\ only provides \cs{directlua} at startup % time. Also the syntax of \cs{directlua} changed in version 0.36. % Thus the user might want to check the LuaTeX version. -% Therefore this package also makes \cs{luatexversion} available, -% if it is not yet done. +% Therefore this package also makes \cs{luatexversion} and +% \cs{luatexrevision} available, if it is not yet done. % % If you want to detect the mode (DVI or PDF), then use package % \xpackage{ifpdf}. \LuaTeX\ has inherited \cs{pdfoutput} from \pdfTeX. @@ -289,7 +289,7 @@ and the derived files \fi \expandafter\x\csname ver@ifluatex.sty\endcsname \ProvidesPackage{ifluatex}% - [2009/04/10 v1.1 Provides the ifluatex switch (HO)] + [2009/04/17 v1.2 Provides the ifluatex switch (HO)] % \end{macrocode} % % \subsection{Catcodes} @@ -327,11 +327,35 @@ and the derived files \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{Macro for error messages} +% +% \begin{macro}{\ifluatex@Error} +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname PackageError\endcsname\relax + \def\ifluatex@Error#1#2{% + \begingroup + \newlinechar=10 % + \def\MessageBreak{^^J}% + \edef\x{\errhelp{#2}}% + \x + \errmessage{Package ifluatex Error: #1}% + \endgroup + }% +\else + \def\ifluatex@Error{% + \PackageError{ifluatex}% + }% +\fi +% \end{macrocode} +% \end{macro} +% % \subsection{Check for previously defined \cs{ifluatex}} % % \begin{macrocode} @@ -339,22 +363,8 @@ and the derived files \expandafter\ifx\csname ifluatex\endcsname\relax \else \edef\i/{\expandafter\string\csname ifluatex\endcsname}% - \expandafter\ifx\csname PackageError\endcsname\relax - \def\x#1#2{% - \edef\z{#2}% - \expandafter\errhelp\expandafter{\z}% - \errmessage{Package ifluatex Error: #1}% - }% - \def\y{^^J}% - \newlinechar=10 % - \else - \def\x#1#2{% - \PackageError{ifluatex}{#1}{#2}% - }% - \def\y{\MessageBreak}% - \fi - \x{Name clash, \i/ is already defined}{% - Incompatible versions of \i/ can cause problems,\y + \ifluatex@Error{Name clash, \i/ is already defined}{% + Incompatible versions of \i/ can cause problems,\MessageBreak therefore package loading is aborted.% }% \endgroup @@ -367,29 +377,12 @@ and the derived files % \subsection{\cs{ifluatex}} % % \begin{macro}{\ifluatex} -% Create and set the switch. \cs{newif} initializes the -% switch with \cs{iffalse}. % \begin{macrocode} -\begingroup - \expandafter\ifx\csname newif\endcsname\relax - \def\x#1#2{#1}% - \else - \def\x#1#2{#2}% - \fi -\expandafter\endgroup\x -{% - \let\ifluatex\iffalse - \def\luatextrue{% - \let\ifluatex\iftrue - }% - \def\luatexfalse{% - \let\luatexfalse - }% -}{% - \csname newif\endcsname\ifluatex -} +\let\ifluatex\iffalse % \end{macrocode} -% Test \cs{pdfoutput}. Is it defined and different from +% \end{macro} +% +% Test \cs{luatexversion}. Is it defined and different from % \cs{relax}? Someone could have used \LaTeX\ internal % \cs{@ifundefined}, or something else involving. % Notice, \cs{csname} is executed inside a group for the test @@ -398,14 +391,14 @@ and the derived files \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname luatexversion\endcsname\relax \else - \luatextrue + \expandafter\let\csname ifluatex\expandafter\endcsname + \csname iftrue\endcsname \fi % \end{macrocode} -% \end{macro} % -% \subsection{Lua\TeX\ v0.40} +% \subsection{Lua\TeX\ v0.39} % -% Starting with version 0.40 \LuaTeX\ wants to provide \cs{directlua} +% Starting with version 0.39 \LuaTeX\ wants to provide \cs{directlua} % as only primitive at startup time beyond vanilla \TeX's primitives. % Then \cs{directlua} exists, but \cs{luatexversion} cannot be found. % Unhappily also the syntax of \cs{directlua} changed in v0.36, @@ -419,29 +412,23 @@ and the derived files \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname directlua\endcsname\relax \else - \luatextrue + \expandafter\let\csname ifluatex\expandafter\endcsname + \csname iftrue\endcsname \begingroup \newlinechar=10 % \endlinechar=\newlinechar % - \ifcase0% + \ifnum0% \directlua{% if tex.enableprimitives then tex.enableprimitives('ifluatex', {'luatexversion'}) - else tex.print('1') end }% - \ifx\ifluatexluatexversion\@undefined 1\fi % - \relax % - \global\let\luatexversion\ifluatexluatexversion + \ifx\ifluatexluatexversion\@undefined\else 1\fi % + =11 % + \global\let\luatexversion\ifluatexluatexversion % \else % - \expandafter\ifx\csname PackageError\endcsname\relax % - \def\PackageError#1#2#3{% - \errhelp{#3}% - \errmessage{Package `#1' Error: #2}% - }% - \fi % - \PackageError{ifluatex}{% + \ifluatex@Error{% Missing \string\luatexversion% }{% Update LuaTeX.% @@ -451,6 +438,43 @@ and the derived files \fi \fi % \end{macrocode} +% \begin{macrocode} +\ifluatex + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname luatexrevision\endcsname\relax + \ifnum\luatexversion<36 % + \else + \begingroup + \ifx\luatexrevision\relax + \let\luatexrevision\@undefined + \fi + \newlinechar=10 % + \endlinechar=\newlinechar % + \ifcase0% + \directlua{% + if tex.enableprimitives then + tex.enableprimitives('ifluatex', {'luatexrevision'}) + else + tex.print('1') + end + }% + \ifx\ifluatexluatexrevision\@undefined 1\fi % + \relax % + \global\let\luatexrevision\ifluatexluatexrevision + \fi + \endgroup + \fi + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname luatexrevision\endcsname\relax + \ifluatex@Error{% + Missing \string\luatexrevision% + }{% + Update LuaTeX.% + }% + \fi + \fi +\fi +% \end{macrocode} % % \subsection{Protocol entry} % @@ -774,10 +798,18 @@ and the derived files % \end{Version} % \begin{Version}{2009/04/10 v1.1} % \item -% Test adopted for \LuaTeX\ 0.40. +% Test adopted for \LuaTeX\ 0.39. % \item % Makes \cs{luatexversion} available. % \end{Version} +% \begin{Version}{2009/04/17 v1.2} +% \item +% Fixes (Manuel P\'egouri\'e-Gonnard). +% \item +% \cs{luatextrue} and \cs{luatexfalse} are no longer defined. +% \item +% Makes \cs{luatexrevision} available, too. +% \end{Version} % \end{History} % % \PrintIndex |