texlive[52609] Master: iftex, now with many if*.sty (1nov19)

commits+karl at tug.org commits+karl at tug.org
Fri Nov 1 22:55:08 CET 2019


Revision: 52609
          http://tug.org/svn/texlive?view=revision&revision=52609
Author:   karl
Date:     2019-11-01 22:55:07 +0100 (Fri, 01 Nov 2019)
Log Message:
-----------
iftex, now with many if*.sty (1nov19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/iftex/iftex.pdf
    trunk/Master/texmf-dist/doc/generic/iftex/iftex.tex
    trunk/Master/texmf-dist/tex/generic/iftex/iftex.sty
    trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/generic/iftex/README.md
    trunk/Master/texmf-dist/doc/generic/iftex/ann.txt
    trunk/Master/texmf-dist/tex/generic/iftex/ifetex.sty
    trunk/Master/texmf-dist/tex/generic/iftex/ifluatex.sty
    trunk/Master/texmf-dist/tex/generic/iftex/ifpdf.sty
    trunk/Master/texmf-dist/tex/generic/iftex/ifvtex.sty
    trunk/Master/texmf-dist/tex/generic/iftex/ifxetex.sty

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/generic/iftex/README

Deleted: trunk/Master/texmf-dist/doc/generic/iftex/README
===================================================================
--- trunk/Master/texmf-dist/doc/generic/iftex/README	2019-11-01 21:53:03 UTC (rev 52608)
+++ trunk/Master/texmf-dist/doc/generic/iftex/README	2019-11-01 21:55:07 UTC (rev 52609)
@@ -1,29 +0,0 @@
-_________________
-The iftex package
-v0.2
-
-This very simple package, for both Plain TeX and LaTeX,
-defines the \ifPDFTeX, \ifXeTeX, and \ifLuaTeX boolean
-for testing whether PDFTeX, or XeTeX, or LuaTeX is being
-used for typesetting.
-
-Also provides the \RequirePDFTeX, \RequireXeTeX, and \RequireLuaTeX
-command which throws an error if PDFTeX, XeTeX and LuaTeX (respectively)
-is not the engine in use.
-
-If you want to report any bugs or typos and corrections in the documentation,
-or ask for any new features, or suggest any improvements, or ask any questions
-about the package, then please do not send any direct emails to us; we will not 
-answer any direct emails. Instead please use the issue tracker:
-  <https://github.com/persian-tex/iftex/issues>
-In doing so, please always explain your issue well enough, always include
-a minimal working examples showing the issue, and always choose the appropriate
-label for your query (i.e. if you are reporting any bugs, choose `bug' label). 
-
-Current version release date: 2013/04/04
-______________
-Persian TeX Group
-persian-tex at tug.org
-
-Copyright 2010–2013
-Distributed under the LaTeX Project Public License

Added: trunk/Master/texmf-dist/doc/generic/iftex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/iftex/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/iftex/README.md	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,65 @@
+# iftex
+
+## TeX Engine Detection
+
+This iftex package provides a suite of commands for detecting
+different TeX variants.
+
+For each supported engine, tests are provided of the form
+
+ \ifpdftex which is true if PDFTeX is in use and \RequirePDFTeX
+ which stops the run with an error message if PDFTeX is not being used.
+
+The package (which works with plain TeX as well as LaTeX) has tests
+for:
+
+eTeX, PDFTeX, XeTeX, LuaTeX, LuaHBTeX, pTeX, upTeX, pTeX-ng, VTeX, Aleph.
+
+
+In addition, an \iftutex test is true for XeTeX and LuaTeX, and
+an \ifpdf test is provided to test the PDF or DVI output mode.
+
+## Compatibility Packages
+
+In addition to the main iftex.sty package, small wrapper packages are
+provided
+
+ifetex.sty  ifluatex.sty  ifvtex.sty  ifxetex.sty ifpdf.sty
+
+These include iftex and in some cases emulate some additional
+commands to allow these packages to replace the original packages in TeX
+distributions. It is recommended that new documents do not use these
+packages, but instead load iftex.sty directly.
+
+This package may be used on any format (it may be loaded into initex)
+it does not assume LaTeX.
+
+
+----
+
+This is a merger and simplification of several packages
+Based on a suggestion of Norbert Preining
+
+https://github.com/bidi-tex/iftex/issues/1
+
+
+ * ifetex: Martin Scharrer
+ * ifxetex: Will Robertson
+ * iftex:  Persian TeX Group / Vafa Khalighi
+ * ifluatex, ifvtex: Heiko Oberdiek
+ * ifptex: Takayuki Yato
+ * ifpdf: Heiko Oberdiek and LaTeX3 Project
+
+
+The existing  if(u)ptex packages do far more extensive testing to
+distinguish different variants which are not copied here.
+
+A document specifically for Japanese texts may need the finer grained
+tests of the ifptex package which has tests for particular versions
+of the pTeX (Japanese TeX) variant in use, and for the mode that is
+active.
+
+This generic package only has coarser tests for the tex variant in
+use, so is sufficient for example to distinguish upTeX from pTeX, and
+to distinguish both of those from LuaTeX.
+


Property changes on: trunk/Master/texmf-dist/doc/generic/iftex/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/generic/iftex/ann.txt
===================================================================
--- trunk/Master/texmf-dist/doc/generic/iftex/ann.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/iftex/ann.txt	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,52 @@
+** UPLOAD: iftex
+https://ctan.org/pkg/iftex
+
+New README will be uploaded, please change catalogue to say
+maintained by LaTeX Team
+Licence LPPL 1.3
+Bug Tracker: https://github.com/latex3/iftex/issues/
+Repository: https://github.com/latex3/iftex/
+
+** UPLOAD: oberdiek
+https://ctan.org/pkg/oberdiek
+This release will not distribute ifpdf.sty ifluatex.sty ifvtex.sty
+
+
+** DELETE  ifxetex
+https://ctan.org/pkg/ifxetex
+Please change the catalogue to point to the iftex distribution (which will contain ifxetex.sty)
+and change maintainer and github links as for iftex above.
+
+Will Robertson is on LaTeX Team so aware of this.
+
+** DELETE ifetex
+https://ctan.org/pkg/ifetex
+Please change the catalogue to point to the iftex distribution (which will contain ifetex.sty)
+and change maintainer and github links as for iftex above.
+
+Martin Scharrer <martin.scharrer at web.de> has agreed to his version of ifetex being deleted
+
+> Hi David,
+> 
+> I always hated the fact that there where so many if..tex packages and I
+> am glad that you people rationalise them now.
+> 
+> Feel free to withdraw my package ifetex from CTAN.
+> 
+> Best Regards,
+> 
+> Martin
+
+** CATALOGUE Change ifpdf, ifluatex, ifvtex
+https://ctan.org/pkg/ifpdf
+https://ctan.org/pkg/ifluatex
+https://ctan.org/pkg/ifvtex
+Please change the catalog entries for these three so they point to iftex as above,
+not to the oberdiek bundle.
+
+
+** NO CHANGE
+Just to confirm ifptex and ifxptex packages are _not_ affected by this re-arrangement.
+
+
+


Property changes on: trunk/Master/texmf-dist/doc/generic/iftex/ann.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/generic/iftex/iftex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/iftex/iftex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/iftex/iftex.tex	2019-11-01 21:53:03 UTC (rev 52608)
+++ trunk/Master/texmf-dist/doc/generic/iftex/iftex.tex	2019-11-01 21:55:07 UTC (rev 52609)
@@ -1,80 +1,184 @@
-\documentclass{artikel3}
-\usepackage{calc}
-\usepackage{pifont}
-\usepackage{bbding}
-\usepackage[colorlinks=true,linkcolor=mybrown,urlcolor=mygreen]{hyperref}
-\usepackage{bidicode}
-\newcounter{local}
-\renewcommand\theenumi{\protect\setcounter{local}%
-  {201+\the\value{enumi}}\protect\ding{\value{local}}}
-\renewcommand\labelenumi{\theenumi}
-\renewcommand\labelitemi{\HandRight}
-\renewcommand\labelitemii{\HandRightUp}
-\renewcommand\labelitemiii{\HandCuffRight}
-\renewcommand\labelitemiv{\HandPencilLeft}
-\definecolor{mybrown}{rgb}{.6,0,0}
-\definecolor{mygreen}{rgb}{0,.43,0}
-\definecolor{Orange}{rgb}{1,.4,.2}
-\newcommand\PDFTeX{PDF\TeX}
-\newcommand\XeTeX{Xe\TeX}
-\newcommand\LuaTeX{Lua\TeX}
-\title{The \textsf{iftex} Package\\ \href{https://github.com/persian-tex/iftex}{\texttt{https://github.com/persian-tex/iftex}}}
-\author{Persian TeX Group\\ \href{mailto:persian-tex at tug.org}{\texttt{persian-tex at tug.org}}}
-\date{Version 0.2}
+\documentclass{article}
+\usepackage[T1]{fontenc}
+\usepackage{hyperref}
+\hypersetup{colorlinks}
+\usepackage{iftex}
+
+\title{The iftex package}
+\author{The \LaTeX\ Project Team\thanks{%
+\url{https://github.com/latex3/iftex}}}
+
+\date{\csname ver at iftex.sty\endcsname}
+
+\newcommand\cs[1]{{\ttfamily\textbackslash #1}}
+\renewcommand*\descriptionlabel[1]{\makebox[\dimexpr\textwidth][l]{%
+                                \normalfont\bfseries #1}}
+
 \begin{document}
+
 \maketitle
 \tableofcontents
+
+
 \section{Introduction}
-This package provides a way to check if a document is being processed with \PDFTeX, or \XeTeX, or \LuaTeX.
-\section{Loading The Package}
-The package can be loaded in the usual way both in Plain \TeX\ and \LaTeX.
-\subsection{Loading The Package in Plain \TeX}
-\begin{BDef}
-\Lcs{input}\quad \Larg{iftex.sty}
-\end{BDef}
-\subsection{Loading The Package in \LaTeX}
-\begin{BDef}
-\Lcs{usepackage}\Largb{iftex}
-\end{BDef}
-\section{Defined Conditionals}
-\subsection{For \PDFTeX}
-\begin{BDef}
-\Lcs{ifPDFTeX}\\
-\qquad\Larga{material for \PDFTeX}\\
-\Lcs{else}\\
-\qquad\Larga{material not for \PDFTeX}\\
-\Lcs{fi}
-\end{BDef}
-\subsection{For \XeTeX}
-\begin{BDef}
-\Lcs{ifXeTeX}\\
-\qquad\Larga{material for \XeTeX}\\
-\Lcs{else}\\
-\qquad\Larga{material not for \XeTeX}\\
-\Lcs{fi}
-\end{BDef}
-\subsection{For \LuaTeX}
-\begin{BDef}
-\Lcs{ifLuaTeX}\\
-\qquad\Larga{material for \LuaTeX}\\
-\Lcs{else}\\
-\qquad\Larga{material not for \LuaTeX}\\
-\Lcs{fi}
-\end{BDef}
-\section{Defined Commands}
-\subsection{For \PDFTeX}
-\begin{BDef}
-\Lcs{RequirePDFTeX}
-\end{BDef}
-This command tests for \PDFTeX\ use and throws an error if a different engine is being used.
-\subsection{For \XeTeX}
-\begin{BDef}
-\Lcs{RequireXeTeX}
-\end{BDef}
-This command tests for \XeTeX\ use and throws an error if a different engine is being used.
-\subsection{For \LuaTeX}
-\begin{BDef}
-\Lcs{RequireLuaTeX}
-\end{BDef}
-This command tests for \LuaTeX\ use and throws an error if a different engine is being used.
-\end{document}
\ No newline at end of file
+This original \textsf{iftex} was written as part of the \textsf{bidi}
+collection (by the Persian TeX Group / Vafa Khalighi) 
+and provided checks for whether a document was being
+processed with PDF\TeX, or Xe\TeX, or Lua\TeX. This version recodes
+the package and incorporates similar tests from the \textsf{ifetex}
+package by Martin Scharrer, the \textsf{ifxetex} package by Will
+Robertson, the \textsf{ifluatex} and \textsf{ifvtex}
+packages from Heiko Oberdiek and parts of \textsf{ifptex} by Takayuki
+Yato.
+
+For each \TeX\ variant engine supported two commands are provided:
+\begin{itemize}
+\item 
+ a conditional, \verb|\iffootex| that is true if the \textsf(footex)
+engine (or a compatible extension) is being used.
+
+For compatibility with earlier packages which did not all use the same
+naming convention all these conditionals are provided in two forms, a
+lowercase name \verb|\iffootex| and a mixed case name \verb|\ifooTeX|.
+
+\item a command \verb|RequireFooTeX| which checks that \textsf{footex}
+  is being used, and stops the run with an error message if a
+  different engine is detected.
+\end{itemize}
+
+\section{Loading the package}
+The package can be loaded in the usual way in both Plain \TeX\ and \LaTeX.
+\subsection{Loading the package in plain \TeX}
+\begin{verbatim}
+\input iftex.sty
+\end{verbatim}
+
+\subsection{Loading the package in \LaTeX}
+\begin{verbatim}
+\usepackage{iftex}
+\end{verbatim}
+
+\subsection{Loading the package in ini\TeX}
+The package assumes no existing macros and may be loaded
+during format setup in a format without the plain \TeX\ or \LaTeX\
+format being loaded. From an initial ini\TeX\ setup the package may
+be loaded as for plain \TeX.
+
+\section{Engine test conditionals}
+All the conditionals defined here are used in the same way:
+\begin{verbatim}
+\ifluatex
+  luatex specific code
+\else
+  code for other engines
+\fi
+\end{verbatim}
+
+
+
+\begin{description}
+\item[\cs{ifetex},      \cs{ifeTeX}]
+True if an e\TeX\ enabled format is in use. (This is necessarily true
+in all \LaTeX\ variants.)
+\item[\cs{ifpdftex},    \cs{ifPDFTeX}]
+True if PDF\TeX\ is in use (whether writing PDF or DVI), so this is
+true for documents processed with both the  \textsf{latex} and
+\textsf{pdflatex} commands.
+\item[\cs{ifxetex},     \cs{ifXeTeX}]
+True if Xe\TeX\ is in use.
+\item[\cs{ifluatex},    \cs{ifLuaTeX}]
+True if Lua\TeX\ and extensions such as LuaHB\TeX\ are in use.
+\item[\cs{ifluahbtex},  \cs{ifLuaHBTeX}]
+True if the \textsf{luaharftex} Lua module is available.
+This will be true in \textsf{luahbtex} and may be true in
+\textsf{luatex} if a binary Lua \textsf{luaharftex} module has been
+compiled and is available in Lua's search path.
+\item[\cs{ifptex},      \cs{ifpTeX}]
+True if any of the p\TeX\ variants are in use.
+\item[\cs{ifuptex},     \cs{ifupTeX}]
+True if any of the up\TeX\ variants are in use. (\verb|\ifetex| could
+be used in addition to distinguish \textsf{uptex} and \textsf{euptex}.)
+\item[\cs{ifptexng},    \cs{ifpTeXng}]
+True if p\TeX-ng (Asiatic p\TeX) is in use.
+\item[\cs{ifvtex},      \cs{ifVTeX}]
+True if V\TeX\ is in use.
+\item[\cs{ifalephtex},  \cs{ifAlephTeX}]
+True if Aleph is in use. (The \textsf{aleph}-based \LaTeX\ command is
+\textsf{lamed}.)
+\item[\cs{iftutex},     \cs{ifTUTeX}]
+This is not strictly an engine variant, but it is true if
+\verb|\Umathchardef| is available, which essentially means that it is
+true for Lua\TeX\ and Xe\TeX, allowing constructs such as
+\begin{verbatim}
+\iftutex
+  \usepackage{fontspec}
+  \setmainfont{TeX Gyre Termes}
+  \usepackage{unicode-math}
+  \setmathfont{Stix Two Math}
+\else
+  \usepackage{newtxtext,newtxmath}
+\fi
+\end{verbatim}
+
+\end{description}
+
+\section{Requiring specific engines}
+For each supported engine, the package provides a command
+\verb|\Require...| which checks that the document is being processed
+with a suitable engine, and stops with an error message if not.
+
+\begin{description}
+\item[\cs{RequireeTeX}]
+\item[\cs{RequirePDFTeX}]
+\item[\cs{RequireXeTeX}]
+\item[\cs{RequireLuaTeX}]
+\item[\cs{RequireLuaHBTeX}]
+\item[\cs{RequirepTeX}]
+\item[\cs{RequireupTeX}]
+\item[\cs{RequirepTeXng}]
+\item[\cs{RequireVTeX}]
+\item[\cs{RequireAlephTeX}]
+\item[\cs{RequireTUTeX}]
+\end{description}
+
+
+\section{Output mode conditional}
+This package also provides an \verb|\ifpdf| conditional that is true
+if the format is set up to output in PDF mode rather than DVI. This is
+equivalent to the test in the existing \textsf{ifpdf} package.
+
+Unlike the engine tests above this is defined as if by \verb|\newif|
+with user-documented commands \verb|\pdftrue| and \verb|\pdffalse| that can
+change the boolean value. These would be needed to reset the boolean
+if the output mode is reset (for example by setting
+\verb|\pdfoutput=0| in PDF\LaTeX).
+
+Unlike the original \textsf{ifpdf} package, the version here also
+detects PDF output mode if running in V\TeX.
+
+\section{Additional packages}
+This extended \textsf{iftex} is designed to replace the original
+\textsf{iftex} and also the packages
+\textsf{ifetex},
+\textsf{ifluatex},
+\textsf{ifvtex},
+\textsf{ifxetex},
+\textsf{ifpdf}.
+
+This collection includes small packages with these names that include
+the main \textsf{iftex} package, and in some cases define additional
+commands for increased compatibility. These packages should mean that
+authors do not need to change existing documents, although it is
+recommended that new documents use the \textsf{iftex} package
+directly.
+
+
+Note that while this package provides basic support for detecting
+p\TeX\ (Japanese \TeX) variants and is broadly compatible with the
+\textsf{ifptex} package, the \textsf{ifptex} package has many more detailed
+tests for p\TeX\ variants and this package does \emph{not} replace the
+\textsf{ifptex} (or \textsf{ifxptex}) packages, which are maintained
+by their original authors and recommended for Japanese documents that
+need fine control over the Japanese \TeX\ system in use.
+
+\end{document}

Added: trunk/Master/texmf-dist/tex/generic/iftex/ifetex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/ifetex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/iftex/ifetex.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,18 @@
+% Compatibility stub package for ifetex
+
+%% LaTeX3 Project
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+
+% The original ifetex package was written by Martin Scharrer
+
+\ifx\RequirePackage\undefined
+  \input iftex.sty
+\else
+  \ProvidesPackage{ifetex}[2019/10/25 v1.3 ifetex legacy package. Use iftex instead.]
+  \RequirePackage{iftex}
+  \newcommand*\NeedsETeX[1][]{\RequireeTeX}
+\fi


Property changes on: trunk/Master/texmf-dist/tex/generic/iftex/ifetex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/iftex/ifluatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/ifluatex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/iftex/ifluatex.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,17 @@
+% Compatibility stub package for ifluatex
+
+%% LaTeX3 Project
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+
+% The original ifluatex package was written by Heiko Oberdiek
+
+\ifx\RequirePackage\undefined
+  \input iftex.sty
+\else
+  \ProvidesPackage{ifluatex}[2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.]
+  \RequirePackage{iftex}
+\fi


Property changes on: trunk/Master/texmf-dist/tex/generic/iftex/ifluatex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/iftex/ifpdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/ifpdf.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/iftex/ifpdf.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,17 @@
+% Compatibility stub package for ifpdf
+
+%% LaTeX3 Project
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+
+% The original ifpdf package was written by Heiko Oberdiek
+
+\ifx\RequirePackage\undefined
+  \input iftex.sty
+\else
+  \ProvidesPackage{ifpdf}[2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.]
+  \RequirePackage{iftex}
+\fi


Property changes on: trunk/Master/texmf-dist/tex/generic/iftex/ifpdf.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/generic/iftex/iftex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/iftex.sty	2019-11-01 21:53:03 UTC (rev 52608)
+++ trunk/Master/texmf-dist/tex/generic/iftex/iftex.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -1,97 +1,231 @@
+%% iftex TeX engine tests
+
+%% LaTeX3 Project
 %%
-%% This is file `iftex.sty',
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+%%
+%% Using ideas from:
+%%
+%% ifetex Martin Scharrer
+%% ifxetex Will Robertson
+%% iftex 0.2 Persian TeX Group / Vafa Khalighi
+%% ifluatex ifvtex Heiko Oberdiek
+%% ifptex Takayuki YATO
+%% ifpdf Heiko Oberdiek and LaTeX3 Project
 
-%% 
-%%   __________________________________
-%%   Copyright © 2010–2013 Persian TeX Group
-%% 
-%%   License information appended.
-%% 
-%% 
-\csname iftexloaded\endcsname
-\let\iftexloaded\endinput
+
+% Only load once (not needed in LaTeX, but does no harm).
+\csname IFTEX\string @loaded\endcsname
+\expandafter\let\csname IFTEX\string @loaded\endcsname\endinput
+
+% File loadable in initex
+% require { } # with standard catcodes.
+\catcode123=1
+\catcode125=2
+\catcode35=6
+
+
+% ProvidesPackage declaration in LaTeX
+\begingroup\expandafter\expandafter\expandafter\endgroup
 \expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
-  \ProvidesPackage{iftex}
-    [2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX, and LuaTeX]
+  \ProvidesPackage{iftex}[2019/10/24 v1.0a TeX engine tests]
 \fi
-\def\RequirePDFTeX{%
-  \ifPDFTeX\else
-    \begingroup
-      \errorcontextlines=-1\relax
-      \newlinechar=10\relax
-      \errmessage{^^J
-      ********************************************^^J
-      * PDFTeX is required to compile this document.^^J
-      * Sorry!^^J
+
+% Save @ catcode, to restore at end, not needed in LaTeX.
+\expandafter\chardef\csname IFTEX\string @atcatcode\endcsname\catcode64
+\catcode 64 11
+
+% Message format used in several pre-existing if*tex packages
+% Modified here to do a hard stop and not show any error context lines.
+\def\IFTEX at Require#1#2#3{%
+  #1\else
+      \newlinechar 64\relax
+      \errorcontextlines -1\relax
+      \immediate\write20{@
+      ********************************************@
+      * #2 is required to compile this document.@
+      * Sorry!@
       ********************************************}%
-    \endgroup
-  \fi}
-\def\RequireXeTeX{%
-  \ifXeTeX\else
-    \begingroup
-      \errorcontextlines=-1\relax
-      \newlinechar=10\relax
-      \errmessage{^^J
-      ********************************************^^J
-      * XeTeX is required to compile this document.^^J
-      * Sorry!^^J
-      ********************************************}%
-    \endgroup
-  \fi}
-\def\RequireLuaTeX{%
-  \ifLuaTeX\else
-    \begingroup
-      \errorcontextlines=-1\relax
-      \newlinechar=10\relax
-      \errmessage{^^J
-      ********************************************^^J
-      * LuaTeX is required to compile this document.^^J
-      * Sorry!^^J
-      ********************************************}%
-    \endgroup
-  \fi}
-\expandafter\ifx\csname ifPDFTeX\endcsname\relax\else
-  \expandafter\endinput
+    \batchmode\read -1 to \@tempa
+    #3%
+}
+
+
+% eTeX \protected if available.
+\ifx\protected\@undefined
+  \let\IFTEX at protected\relax
+\else
+  \let\IFTEX at protected\protected
 \fi
-\expandafter\ifx\csname ifXeTeX\endcsname\relax\else
-  \expandafter\endinput
+
+% make sure \detokenize and \protected are available in lualatex,
+% but avoid defining them after the package if not already defined.
+  {
+  \catcode34 12 % "
+  \catcode40 12 % (
+  \catcode41 12 % )
+  \catcode44 12 % ,
+  \catcode46 12 % .
+  \ifx\directlua\@undefined\else
+    \directlua{tex.enableprimitives("IFTEX@", {"detokenize","protected"})}
+  \fi
+  }
+
+% \Require... commands that stop if the wrong engine detected.
+\IFTEX at protected\def\RequireeTeX{\IFTEX at Require\ifetex{eTeX}\fi}
+\IFTEX at protected\def\RequirePDFTeX{\IFTEX at Require\ifpdftex{pdfTeX}\fi}
+\IFTEX at protected\def\RequireXeTeX{\IFTEX at Require\ifxetex{XeTeX}\fi}
+\IFTEX at protected\def\RequireLuaTeX{\IFTEX at Require\ifluatex{LuaTeX}\fi}
+\IFTEX at protected\def\RequireLuaHBTeX{\IFTEX at Require\ifluahbtex{LuaHBTeX}\fi}
+\IFTEX at protected\def\RequirepTeX{\IFTEX at Require\ifptex{pTeX}\fi}
+\IFTEX at protected\def\RequireupTeX{\IFTEX at Require\ifuptex{upTeX}\fi}
+\IFTEX at protected\def\RequirepTeXng{\IFTEX at Require\ifptexng{pTeX-ng}\fi}
+\IFTEX at protected\def\RequireVTeX{\IFTEX at Require\ifvtex{VTeX}\fi}
+% alephtex as aleph name too generic
+\IFTEX at protected\def\RequireAlephTeX{\IFTEX at Require\ifalephtex{Aleph}\fi}
+% tutex == has \Umathchardef == XeTeX or Lua(HB)TeX currently
+\IFTEX at protected\def\RequireTUTeX{\IFTEX at Require\iftutex{LuaTeX or XeTeX}\fi}
+
+
+% As a matter of policy over-write any existing \if*tex macro and set
+% by the tests here.
+
+% \csname and \let construct useful for hiding \ifzzz tokens from
+% outer level \if tests.
+\def\IFTEX at let#1#2{%
+  \expandafter\let\csname if#1\expandafter\endcsname
+  \csname if#2\endcsname}
+
+% etex (should always be true in latex based formats)
+\ifx\numexpr\@undefined
+  \IFTEX at let{etex}{false}
+\else
+  \IFTEX at let{etex}{true}
 \fi
-\expandafter\ifx\csname ifLuaTeX\endcsname\relax\else
-  \expandafter\endinput
+\IFTEX at let{eTeX}{etex}
+
+% pdftex (including in dvi mode)
+\ifx\pdftexversion\@undefined
+  \IFTEX at let{pdftex}{false}
+\else
+  \IFTEX at let{pdftex}{true}
 \fi
-\newif\ifPDFTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdfmatch\endcsname\relax
-  \PDFTeXfalse
+\IFTEX at let{PDFTeX}{pdftex}
+
+% xetex
+\ifx\XeTeXrevision\@undefined
+  \IFTEX at let{xetex}{false}
 \else
-  \PDFTeXtrue
+  \IFTEX at let{xetex}{true}
 \fi
-\newif\ifXeTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax
-  \XeTeXfalse
+\IFTEX at let{XeTeX}{xetex}
+
+
+% luatex (including luahbtex)
+\ifx\directlua\@undefined
+  \IFTEX at let{luatex}{false}
 \else
-  \XeTeXtrue
+  \IFTEX at let{luatex}{true}
 \fi
-\newif\ifLuaTeX
+\IFTEX at let{LuaTeX}{luatex}
+
+% luahbtex (or luatex + luaharfbuzz)
+% Use luaharfbuzz test rather than status.luatex_engine=="luahbtex"
+% for issue #2.
+\IFTEX at let{luahbtex}{false}
+\ifx\directlua\@undefined
+\else
+  \directlua{\IFTEX at detokenize{
+   if(pcall(require, 'luaharfbuzz')) then
+     tex.print("\\let\\ifluahbtex\\iftrue ")
+   end
+  }}
+
+\fi
+\IFTEX at let{LuaHBTeX}{luahbtex}
+
+
+% ptex (including all variants)
+\ifx\kanjiskip\@undefined
+  \IFTEX at let{ptex}{false}
+\else
+  \IFTEX at let{ptex}{true}
+\fi
+\IFTEX at let{pTeX}{ptex}
+
+% uptex (including euptex)
+\ifx\enablecjktoken \@undefined
+  \IFTEX at let{uptex}{false}
+\else
+  \IFTEX at let{uptex}{true}
+\fi
+\IFTEX at let{upTeX}{uptex}
+
+% ptex-ng
+\ifx\ngbanner\@undefined
+  \IFTEX at let{ptexng}{false}
+\else
+  \IFTEX at let{ptexng}{true}
+\fi
+\IFTEX at let{pTeXng}{ptexng}
+
+% vtex
+\ifx\VTeXversion\@undefined
+  \IFTEX at let{vtex}{false}
+\else
+  \IFTEX at let{vtex}{true}
+\fi
+\IFTEX at let{VTeX}{vtex}
+
+% aleph
+\IFTEX at let{alephtex}{false}
+\ifptex\else
+\ifx\omathchardef\@undefined
+\else
+  \IFTEX at let{alephtex}{true}
+\fi
+\fi
+\IFTEX at let{AlephTeX}{alephtex}
+
+
+% tutex (LuaTeX or XeTeX)
+\ifx\Umathchardef\@undefined
+  \IFTEX at let{tutex}{false}
+\else
+  \IFTEX at let{tutex}{true}
+\fi
+\IFTEX at let{TUTeX}{tutex}
+
+
+
+% Output mode 
+% declare with as if with \newif
+\def\pdftrue{\let\ifpdf\iftrue}
+\def\pdffalse{\let\ifpdf\iffalse}
+\pdffalse
+\ifx\directlua\undefined
 \begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname directlua\endcsname\relax
-  \LuaTeXfalse
+\expandafter\ifx\csname pdfoutput\endcsname\relax
+\ifvtex
+  \ifnum\OpMode=3 %
+    \pdftrue
+  \fi
+\fi
 \else
-  \LuaTeXtrue
+  \ifnum\pdfoutput>0 %
+    \pdftrue
+  \fi
 \fi
-%% 
-%% Copyright © 2010–2013      by Persian TeX Group     <persian-tex at tug.org>
-%% 
-%% Distributable under the LaTeX Project Public License,
-%% version 1.3c or higher (your choice). The latest version of
-%% this license is at: http://www.latex-project.org/lppl.txt
-%% 
-%% This work is "maintained" (as per LPPL maintenance status)
-%% by Persian TeX Group.
-%% 
-%% 
-%% 
-%% 
-%%
-%% End of file `iftex.sty'.
+\else
+\directlua{\IFTEX at detokenize{
+if (tex.outputmode or tex.pdfoutput or 0) > 0 then
+  tex.print('\\pdftrue')
+end
+}}
+\fi
+
+% restore things
+\catcode64 \IFTEX at atcatcode

Added: trunk/Master/texmf-dist/tex/generic/iftex/ifvtex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/ifvtex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/iftex/ifvtex.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,45 @@
+% Compatibility stub package for ifvtex
+
+%% LaTeX3 Project
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+
+% The original ifvtex package was written by Heiko Oberdiek
+
+\ifx\RequirePackage\undefined
+  \input iftex.sty
+\else
+  \ProvidesPackage{ifvtex}[2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.]
+  \RequirePackage{iftex}
+\fi
+
+
+\IFTEX at let{vtexdvi}{false}
+\IFTEX at let{vtexpdf}{false}
+\IFTEX at let{vtexps}{false}
+\IFTEX at let{vtexhtml}{false}
+\IFTEX at let{vtexgex}{false}
+
+\ifvtex
+  \ifcase\OpMode\relax
+    \IFTEX at let{vtexdvi}{true}
+  \or % 1
+    \IFTEX at let{vtexpdf}{true}
+  \or % 2
+    \IFTEX at let{vtexps}{true}
+  \or % 3
+    \IFTEX at let{vtexps}{true}
+  \or\or\or\or\or\or\or % 10
+    \IFTEX at let{vtexhtml}{true}
+  \fi
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname gexmode\endcsname\relax
+  \else
+    \ifnum\gexmode>0 %
+      \IFTEX at let{vtexgex}{true}
+    \fi
+  \fi
+\fi


Property changes on: trunk/Master/texmf-dist/tex/generic/iftex/ifvtex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/generic/iftex/ifxetex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/iftex/ifxetex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/iftex/ifxetex.sty	2019-11-01 21:55:07 UTC (rev 52609)
@@ -0,0 +1,17 @@
+% Compatibility stub package for ifxetex
+
+%% LaTeX3 Project
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version.
+
+% The original ifxetex package was written by Will Robertson
+
+\ifx\RequirePackage\undefined
+  \input iftex.sty
+\else
+  \ProvidesPackage{ifxetex}[2019/10/25 v0.7 ifxetex legacy package. Use iftex instead.]
+  \RequirePackage{iftex}
+\fi


Property changes on: trunk/Master/texmf-dist/tex/generic/iftex/ifxetex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc	2019-11-01 21:53:03 UTC (rev 52608)
+++ trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc	2019-11-01 21:55:07 UTC (rev 52609)
@@ -43,7 +43,6 @@
 depend gtl
 depend hlist
 depend hyplain
-depend iftex
 depend insbox
 depend js-misc
 depend kastrup



More information about the tex-live-commits mailing list