summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-01 21:55:07 +0000
committerKarl Berry <karl@freefriends.org>2019-11-01 21:55:07 +0000
commit8ec1800f45b685b5d011083689cb43a06ca49cd4 (patch)
treec4e1cc3d1c78eb202c6440273cc0d28f5a99ea05 /Master/texmf-dist/tex
parent0155f91399b1608d1ad2790cdbe662427799f37f (diff)
iftex, now with many if*.sty (1nov19)
git-svn-id: svn://tug.org/texlive/trunk@52609 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/generic/iftex/ifetex.sty18
-rw-r--r--Master/texmf-dist/tex/generic/iftex/ifluatex.sty17
-rw-r--r--Master/texmf-dist/tex/generic/iftex/ifpdf.sty17
-rw-r--r--Master/texmf-dist/tex/generic/iftex/iftex.sty304
-rw-r--r--Master/texmf-dist/tex/generic/iftex/ifvtex.sty45
-rw-r--r--Master/texmf-dist/tex/generic/iftex/ifxetex.sty17
6 files changed, 333 insertions, 85 deletions
diff --git a/Master/texmf-dist/tex/generic/iftex/ifetex.sty b/Master/texmf-dist/tex/generic/iftex/ifetex.sty
new file mode 100644
index 00000000000..51027d89c56
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/iftex/ifetex.sty
@@ -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
diff --git a/Master/texmf-dist/tex/generic/iftex/ifluatex.sty b/Master/texmf-dist/tex/generic/iftex/ifluatex.sty
new file mode 100644
index 00000000000..e762e8281fa
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/iftex/ifluatex.sty
@@ -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
diff --git a/Master/texmf-dist/tex/generic/iftex/ifpdf.sty b/Master/texmf-dist/tex/generic/iftex/ifpdf.sty
new file mode 100644
index 00000000000..ec500fba25a
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/iftex/ifpdf.sty
@@ -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
diff --git a/Master/texmf-dist/tex/generic/iftex/iftex.sty b/Master/texmf-dist/tex/generic/iftex/iftex.sty
index 7651466448f..feb5a75f8d7 100644
--- a/Master/texmf-dist/tex/generic/iftex/iftex.sty
+++ b/Master/texmf-dist/tex/generic/iftex/iftex.sty
@@ -1,97 +1,231 @@
+%% iftex TeX engine tests
+
+%% 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.
+%%
+%% Using ideas from:
%%
-%% This is file `iftex.sty',
-
-%%
-%% __________________________________
-%% Copyright © 2010–2013 Persian TeX Group
-%%
-%% License information appended.
-%%
-%%
-\csname iftexloaded\endcsname
-\let\iftexloaded\endinput
+%% 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
+
+
+% 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]
-\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
- ********************************************}%
- \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
+ \ProvidesPackage{iftex}[2019/10/24 v1.0a TeX engine tests]
+\fi
+
+% 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@Require#1#2#3{%
+ #1\else
+ \newlinechar 64\relax
+ \errorcontextlines -1\relax
+ \immediate\write20{@
+ ********************************************@
+ * #2 is required to compile this document.@
+ * Sorry!@
********************************************}%
- \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@protected\relax
+\else
+ \let\IFTEX@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@protected\def\RequireeTeX{\IFTEX@Require\ifetex{eTeX}\fi}
+\IFTEX@protected\def\RequirePDFTeX{\IFTEX@Require\ifpdftex{pdfTeX}\fi}
+\IFTEX@protected\def\RequireXeTeX{\IFTEX@Require\ifxetex{XeTeX}\fi}
+\IFTEX@protected\def\RequireLuaTeX{\IFTEX@Require\ifluatex{LuaTeX}\fi}
+\IFTEX@protected\def\RequireLuaHBTeX{\IFTEX@Require\ifluahbtex{LuaHBTeX}\fi}
+\IFTEX@protected\def\RequirepTeX{\IFTEX@Require\ifptex{pTeX}\fi}
+\IFTEX@protected\def\RequireupTeX{\IFTEX@Require\ifuptex{upTeX}\fi}
+\IFTEX@protected\def\RequirepTeXng{\IFTEX@Require\ifptexng{pTeX-ng}\fi}
+\IFTEX@protected\def\RequireVTeX{\IFTEX@Require\ifvtex{VTeX}\fi}
+% alephtex as aleph name too generic
+\IFTEX@protected\def\RequireAlephTeX{\IFTEX@Require\ifalephtex{Aleph}\fi}
+% tutex == has \Umathchardef == XeTeX or Lua(HB)TeX currently
+\IFTEX@protected\def\RequireTUTeX{\IFTEX@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@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@let{etex}{false}
+\else
+ \IFTEX@let{etex}{true}
\fi
-\expandafter\ifx\csname ifLuaTeX\endcsname\relax\else
- \expandafter\endinput
+\IFTEX@let{eTeX}{etex}
+
+% pdftex (including in dvi mode)
+\ifx\pdftexversion\@undefined
+ \IFTEX@let{pdftex}{false}
+\else
+ \IFTEX@let{pdftex}{true}
\fi
-\newif\ifPDFTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdfmatch\endcsname\relax
- \PDFTeXfalse
+\IFTEX@let{PDFTeX}{pdftex}
+
+% xetex
+\ifx\XeTeXrevision\@undefined
+ \IFTEX@let{xetex}{false}
\else
- \PDFTeXtrue
+ \IFTEX@let{xetex}{true}
\fi
-\newif\ifXeTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax
- \XeTeXfalse
+\IFTEX@let{XeTeX}{xetex}
+
+
+% luatex (including luahbtex)
+\ifx\directlua\@undefined
+ \IFTEX@let{luatex}{false}
\else
- \XeTeXtrue
+ \IFTEX@let{luatex}{true}
\fi
-\newif\ifLuaTeX
+\IFTEX@let{LuaTeX}{luatex}
+
+% luahbtex (or luatex + luaharfbuzz)
+% Use luaharfbuzz test rather than status.luatex_engine=="luahbtex"
+% for issue #2.
+\IFTEX@let{luahbtex}{false}
+\ifx\directlua\@undefined
+\else
+ \directlua{\IFTEX@detokenize{
+ if(pcall(require, 'luaharfbuzz')) then
+ tex.print("\\let\\ifluahbtex\\iftrue ")
+ end
+ }}
+
+\fi
+\IFTEX@let{LuaHBTeX}{luahbtex}
+
+
+% ptex (including all variants)
+\ifx\kanjiskip\@undefined
+ \IFTEX@let{ptex}{false}
+\else
+ \IFTEX@let{ptex}{true}
+\fi
+\IFTEX@let{pTeX}{ptex}
+
+% uptex (including euptex)
+\ifx\enablecjktoken \@undefined
+ \IFTEX@let{uptex}{false}
+\else
+ \IFTEX@let{uptex}{true}
+\fi
+\IFTEX@let{upTeX}{uptex}
+
+% ptex-ng
+\ifx\ngbanner\@undefined
+ \IFTEX@let{ptexng}{false}
+\else
+ \IFTEX@let{ptexng}{true}
+\fi
+\IFTEX@let{pTeXng}{ptexng}
+
+% vtex
+\ifx\VTeXversion\@undefined
+ \IFTEX@let{vtex}{false}
+\else
+ \IFTEX@let{vtex}{true}
+\fi
+\IFTEX@let{VTeX}{vtex}
+
+% aleph
+\IFTEX@let{alephtex}{false}
+\ifptex\else
+\ifx\omathchardef\@undefined
+\else
+ \IFTEX@let{alephtex}{true}
+\fi
+\fi
+\IFTEX@let{AlephTeX}{alephtex}
+
+
+% tutex (LuaTeX or XeTeX)
+\ifx\Umathchardef\@undefined
+ \IFTEX@let{tutex}{false}
+\else
+ \IFTEX@let{tutex}{true}
+\fi
+\IFTEX@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
-\fi
-%%
-%% Copyright © 2010–2013 by Persian TeX Group <persian-tex@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'.
+ \ifnum\pdfoutput>0 %
+ \pdftrue
+ \fi
+\fi
+\else
+\directlua{\IFTEX@detokenize{
+if (tex.outputmode or tex.pdfoutput or 0) > 0 then
+ tex.print('\\pdftrue')
+end
+}}
+\fi
+
+% restore things
+\catcode64 \IFTEX@atcatcode
diff --git a/Master/texmf-dist/tex/generic/iftex/ifvtex.sty b/Master/texmf-dist/tex/generic/iftex/ifvtex.sty
new file mode 100644
index 00000000000..109cf1cc092
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/iftex/ifvtex.sty
@@ -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@let{vtexdvi}{false}
+\IFTEX@let{vtexpdf}{false}
+\IFTEX@let{vtexps}{false}
+\IFTEX@let{vtexhtml}{false}
+\IFTEX@let{vtexgex}{false}
+
+\ifvtex
+ \ifcase\OpMode\relax
+ \IFTEX@let{vtexdvi}{true}
+ \or % 1
+ \IFTEX@let{vtexpdf}{true}
+ \or % 2
+ \IFTEX@let{vtexps}{true}
+ \or % 3
+ \IFTEX@let{vtexps}{true}
+ \or\or\or\or\or\or\or % 10
+ \IFTEX@let{vtexhtml}{true}
+ \fi
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname gexmode\endcsname\relax
+ \else
+ \ifnum\gexmode>0 %
+ \IFTEX@let{vtexgex}{true}
+ \fi
+ \fi
+\fi
diff --git a/Master/texmf-dist/tex/generic/iftex/ifxetex.sty b/Master/texmf-dist/tex/generic/iftex/ifxetex.sty
new file mode 100644
index 00000000000..8261ec26711
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/iftex/ifxetex.sty
@@ -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