diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-12 23:15:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-12 23:15:36 +0000 |
commit | 1a87640a25a3cf2bf77b1cb9c69e3c90f2b3811b (patch) | |
tree | 5a6eb1ac516775c93f354fba92bddca5de94c078 /Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx | |
parent | b4c2a162bb8aa0937f3c029e5e103055f55ae3ae (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/ifpdf.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx | 129 |
1 files changed, 109 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx b/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx index bdafa51a806..92fc17bfa3d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/ifpdf.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2001, 2005, 2006 by +% Copyright (C) 2001, 2005-2009 by % Heiko Oberdiek <oberdiek@uni-freiburg.de> % % This work may be distributed and/or modified under the @@ -68,7 +68,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: ifpdf 2007/12/12 v1.6 Provides the ifpdf switch (HO)} +\Msg{* Package: ifpdf 2009/04/10 v2.0 Provides the ifpdf switch (HO)} \Msg{************************************************************************} \keepsilent @@ -79,7 +79,7 @@ This is a generated file. -Copyright (C) 2001, 2005, 2006 by +Copyright (C) 2001, 2005-2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de> This work may be distributed and/or modified under the @@ -137,7 +137,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ifpdf.drv}% - [2007/12/12 v1.6 Provides the ifpdf switch (HO)]% + [2009/04/10 v2.0 Provides the ifpdf switch (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \begin{document} @@ -146,7 +146,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{368} +% \CheckSum{472} % % \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 +167,7 @@ and the derived files % \GetFileInfo{ifpdf.drv} % % \title{The \xpackage{ifpdf} package} -% \date{2007/12/12 v1.6} +% \date{2009/04/10 v2.0} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -247,23 +247,23 @@ and the derived files % The package provides the switch \cs{ifpdf}: % \begin{quote} % |\ifpdf|\\ -% \hspace{1.5em}\dots\ do things, if \pdfTeX\ is running in pdf mode \dots\\ +% \hspace*{1.5em}\dots\ do things, if \pdfTeX\ is running in pdf mode \dots\\ % |\else|\\ -% \hspace{1.5em}\dots\ other \TeX\ or \pdfTeX\ in dvi mode \dots\\ +% \hspace*{1.5em}\dots\ other \TeX\ or \pdfTeX\ in dvi mode \dots\\ % |\fi| % \end{quote} % Users of the package \xpackage{ifthen} can use the switch as boolean: % \begin{quote} -% |\boolean{ifpdf}| +% |\boolean{pdf}| % \end{quote} % The package can also be used to set global % documentclass options: % \begin{quote} % |\RequirePackage{ifpdf}|\\ % |\ifpdf|\\ -% \hspace{1.5em}|\documentclass[pdftex,|\dots|]{|\dots|}|\\ +% \hspace*{1.5em}|\documentclass[pdftex,|\dots|]{|\dots|}|\\ % |\else|\\ -% \hspace{1.5em}|\documentclass[|\dots|]{|\dots|}|\\ +% \hspace*{1.5em}|\documentclass[|\dots|]{|\dots|}|\\ % |\fi| % \end{quote} % @@ -274,6 +274,10 @@ and the derived files % \item It asks the setting of \cs{pdfoutput} for detecting % \pdfTeX\ in PDF mode. % \item It never changes \cs{pdfoutput}. +% \item If \cs{pdfoutput} is undefined or has the meaning \cs{relax}, +% but the engine provides the primitive \cs{pdfoutput}, +% then \cs{pdfoutput} is enabled or restored if possible +% (only \LuaTeX, version 0.36.0 or higher). % \item It can be used with many formats including % \plainTeX\ and \LaTeX. % \end{itemize} @@ -298,14 +302,6 @@ and the derived files % The function \textsf{undefined} checks both cases, undefined command % and \cs{relax}. % -% \subsection{Future} -% -% Currently the package can be fooled, by redefining/undefining -% \cs{pdfoutput}. Therefore the package will use the \cs{primitive} -% feature that is discussed currently on the \pdfTeX\ developer -% list (2006), if it hits a stable release. Of course the package -% will then remain usable with older \pdfTeX\ versions as usual. -% % \hypersetup{bookmarksopenlevel=1} % % \StopEventually{ @@ -374,6 +370,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 @@ -381,7 +380,7 @@ and the derived files \fi \expandafter\x\csname ver@ifpdf.sty\endcsname \ProvidesPackage{ifpdf}% - [2007/12/12 v1.6 Provides the ifpdf switch (HO)] + [2009/04/10 v2.0 Provides the ifpdf switch (HO)] % \end{macrocode} % % \subsection{Catcodes} @@ -411,6 +410,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}% . @@ -419,6 +421,7 @@ and the derived files \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}} @@ -453,6 +456,51 @@ and the derived files \endgroup % \end{macrocode} % +% \subsection{\cs{pdfoutput} and \LuaTeX} +% +% It might happen, that \LuaTeX\ is running, but \cs{pdfoutput} +% does not exist. In version 0.40 only \cs{directlua} +% is available at startup time. The enabling Lua function was +% already added in version 0.36. Thus we can ignore older versions, +% here \cs{pdfoutput} is available at startup time. +% +% \begin{macrocode} +\begingroup + \expandafter\ifx\csname pdfoutput\endcsname\relax + \else + \def\skip#1\relax\endgroup{\csname fi\endcsname\endgroup}% + \skip + \fi + \expandafter\ifx\csname directlua\endcsname\relax + \def\skip#1\endgroup{\csname fi\endcsname\endgroup}% + \skip + \fi + \expandafter\ifx\csname RequirePackage\endcsname\relax + \input ifluatex.sty\relax + \else + \RequirePackage{ifluatex}[2009/04/10]% + \fi + \ifluatex + \ifnum\luatexversion<36 % +% \end{macrocode} +% Unhappily \LuaTeX's \cs{primitive} (derived from +% pdfTeX's \cs{pdfprimitive}) cannot be used: +% \begin{quote} +% |\protected\gdef\pdfoutput{\primitive\pdfoutput}| +% \end{quote} +% Setting a value works, but getting fails, +% because \TeX\ does no longer see it as number. It +% is unexpandable and breaks numerical contexts. +% \begin{macrocode} + \else + \directlua{tex.enableprimitives('ifpdf', {'pdfoutput'})}% + \global\let\pdfoutput\ifpdfpdfoutput + \fi + \fi + \relax +\endgroup +% \end{macrocode} +% % \subsection{\cs{ifpdf}} % % \begin{macro}{\ifpdf} @@ -481,6 +529,35 @@ and the derived files % \end{macrocode} % \end{macro} % +% \subsection{Test for fool attempts} +% +% \begin{macrocode} +\begingroup + \expandafter\ifx\csname pdfoutput\endcsname\relax + \else + \escapechar=-1 % + \edef\m{\meaning\pdfoutput}% + \edef\p{% + \string p\string d\string f% + \string o\string u\string t\string p\string u\string t% + }% + \ifx\m\p + \else + \expandafter\ifx\csname PackageWarningNoLine\endcsname\relax + \def\PackageWarningNoLine#1#2{% + \immediate\write16{% + Package `#1' Warning: #2.% + }% + }% + \fi + \PackageWarningNoLine{ifpdf}{% + Someone has redefined \string\\pdfoutput% + }% + \fi + \fi +\endgroup +% \end{macrocode} +% % \subsection{Protocol entry} % % Log comment: @@ -819,6 +896,18 @@ and the derived files % \item % Minor update. % \end{Version} +% \begin{Version}{2008/12/12 v1.7} +% \item +% Fix in documentation for \cs{boolean} (found by S. Venkataraman). +% \item +% Code is not changed. +% \end{Version} +% \begin{Version}{2009/04/10 v2.0} +% \item +% Support for \LuaTeX\ 0.40 added. +% \item +% Checks, whether \cs{pdfoutput} was changed. +% \end{Version} % \end{History} % % \PrintIndex |