summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-04-12 23:15:36 +0000
committerKarl Berry <karl@freefriends.org>2009-04-12 23:15:36 +0000
commit1a87640a25a3cf2bf77b1cb9c69e3c90f2b3811b (patch)
tree5a6eb1ac516775c93f354fba92bddca5de94c078 /Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx
parentb4c2a162bb8aa0937f3c029e5e103055f55ae3ae (diff)
oberdiek update (12apr09)
git-svn-id: svn://tug.org/texlive/trunk@12705 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx133
1 files changed, 122 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx b/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx
index 8610fd0ae4b..42f1cf85edb 100644
--- a/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/ifluatex.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+% Copyright (C) 2007, 2009 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 ifluatex.dtx
% and the derived files
% ifluatex.sty, ifluatex.pdf, ifluatex.ins, ifluatex.drv,
-% ifluatex-test1.tex.
+% ifluatex-test1.tex, ifluatex-test2.tex, ifluatex-test3.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/ifluatex.dtx
@@ -53,6 +53,8 @@
% TDS:tex/generic/oberdiek/ifluatex.sty
% TDS:doc/latex/oberdiek/ifluatex.pdf
% TDS:doc/latex/oberdiek/test/ifluatex-test1.tex
+% TDS:doc/latex/oberdiek/test/ifluatex-test2.tex
+% TDS:doc/latex/oberdiek/test/ifluatex-test3.tex
% TDS:source/latex/oberdiek/ifluatex.dtx
%
%<*ignore>
@@ -68,7 +70,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: ifluatex 2007/12/12 v1.0 Provides the ifluatex switch (HO)}
+\Msg{* Package: ifluatex 2009/04/10 v1.1 Provides the ifluatex switch (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -79,7 +81,7 @@
This is a generated file.
-Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+Copyright (C) 2007, 2009 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
@@ -96,7 +98,7 @@ This Current Maintainer of this work is Heiko Oberdiek.
This work consists of the main source file ifluatex.dtx
and the derived files
ifluatex.sty, ifluatex.pdf, ifluatex.ins, ifluatex.drv,
- ifluatex-test1.tex.
+ ifluatex-test1.tex, ifluatex-test2.tex, ifluatex-test3.tex.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -108,6 +110,8 @@ and the derived files
\file{ifluatex.sty}{\from{ifluatex.dtx}{package}}%
\usedir{doc/latex/oberdiek/test}%
\file{ifluatex-test1.tex}{\from{ifluatex.dtx}{test1}}%
+ \file{ifluatex-test2.tex}{\from{ifluatex.dtx}{test-reload1}}%
+ \file{ifluatex-test3.tex}{\from{ifluatex.dtx}{test-reload2}}%
}
\obeyspaces
@@ -137,7 +141,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{ifluatex.drv}%
- [2007/12/12 v1.0 Provides the ifluatex switch (HO)]%
+ [2009/04/10 v1.1 Provides the ifluatex switch (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -146,7 +150,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{363}
+% \CheckSum{462}
%
% \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,14 +171,15 @@ and the derived files
% \GetFileInfo{ifluatex.drv}
%
% \title{The \xpackage{ifluatex} package}
-% \date{2007/12/12 v1.0}
+% \date{2009/04/10 v1.1}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
%
% \begin{abstract}
% This package looks for \LuaTeX\ regardless of its mode
-% and provides the switch \cs{ifluatex}.
+% and provides the switch \cs{ifluatex}. Also it makes
+% \cs{luatexversion} available if it is not present.
% It works with \plainTeX\ or \LaTeX.
% \end{abstract}
%
@@ -199,6 +204,12 @@ and the derived files
% |\fi|
% \end{quote}
%
+% Since version 0.40 \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.
+%
% If you want to detect the mode (DVI or PDF), then use package
% \xpackage{ifpdf}. \LuaTeX\ has inherited \cs{pdfoutput} from \pdfTeX.
%
@@ -268,6 +279,9 @@ and the derived files
\else
\def\x#1#2[#3]{\endgroup
#2[{#3}]%
+ \ifx#1\@undefined
+ \xdef#1{#3}%
+ \fi
\ifx#1\relax
\xdef#1{#3}%
\fi
@@ -275,7 +289,7 @@ and the derived files
\fi
\expandafter\x\csname ver@ifluatex.sty\endcsname
\ProvidesPackage{ifluatex}%
- [2007/12/12 v1.0 Provides the ifluatex switch (HO)]
+ [2009/04/10 v1.1 Provides the ifluatex switch (HO)]
% \end{macrocode}
%
% \subsection{Catcodes}
@@ -305,6 +319,9 @@ and the derived files
\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}% .
@@ -312,6 +329,7 @@ and the derived files
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{94}{7}% ^
+\TMP@EnsureCode{96}{12}% `
% \end{macrocode}
%
% \subsection{Check for previously defined \cs{ifluatex}}
@@ -352,7 +370,24 @@ and the derived files
% Create and set the switch. \cs{newif} initializes the
% switch with \cs{iffalse}.
% \begin{macrocode}
-\newif\ifluatex
+\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
+}
% \end{macrocode}
% Test \cs{pdfoutput}. Is it defined and different from
% \cs{relax}? Someone could have used \LaTeX\ internal
@@ -368,6 +403,55 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \subsection{Lua\TeX\ v0.40}
+%
+% Starting with version 0.40 \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,
+% thus the user would want to check \cs{luatexversion}.
+% Therefore we make \cs{luatexversion} available using
+% \LuaTeX's Lua function |tex.enableprimitives|.
+%
+% \begin{macrocode}
+\ifluatex
+\else
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname directlua\endcsname\relax
+ \else
+ \luatextrue
+ \begingroup
+ \newlinechar=10 %
+ \endlinechar=\newlinechar %
+ \ifcase0%
+ \directlua{%
+ if tex.enableprimitives then
+ tex.enableprimitives('ifluatex', {'luatexversion'})
+ else
+ tex.print('1')
+ end
+ }%
+ \ifx\ifluatexluatexversion\@undefined 1\fi %
+ \relax %
+ \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}{%
+ Missing \string\luatexversion%
+ }{%
+ Update LuaTeX.%
+ }%
+ \fi %
+ \endgroup %
+ \fi
+\fi
+% \end{macrocode}
+%
% \subsection{Protocol entry}
%
% Log comment:
@@ -480,6 +564,25 @@ and the derived files
%</test1>
% \end{macrocode}
%
+% \section{Reload check for plain}
+%
+% \begin{macrocode}
+%<*test-reload1>
+\input ifluatex.sty\relax
+\input ifluatex.sty\relax
+\csname @@end\endcsname\end
+%</test-reload1>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test-reload2>
+\input miniltx.tex\relax
+\input ifluatex.sty\relax
+\input ifluatex.sty\relax
+\csname @@end\endcsname\end
+%</test-reload2>
+% \end{macrocode}
+%
% \section{Installation}
%
% \subsection{Download}
@@ -542,6 +645,8 @@ and the derived files
% ifluatex.sty & tex/generic/oberdiek/ifluatex.sty\\
% ifluatex.pdf & doc/latex/oberdiek/ifluatex.pdf\\
% test/ifluatex-test1.tex & doc/latex/oberdiek/test/ifluatex-test1.tex\\
+% test/ifluatex-test2.tex & doc/latex/oberdiek/test/ifluatex-test2.tex\\
+% test/ifluatex-test3.tex & doc/latex/oberdiek/test/ifluatex-test3.tex\\
% ifluatex.dtx & source/latex/oberdiek/ifluatex.dtx\\
% \end{tabular}^^A
% }^^A
@@ -667,6 +772,12 @@ and the derived files
% \item
% First public version.
% \end{Version}
+% \begin{Version}{2009/04/10 v1.1}
+% \item
+% Test adopted for \LuaTeX\ 0.40.
+% \item
+% Makes \cs{luatexversion} available.
+% \end{Version}
% \end{History}
%
% \PrintIndex