From 4de9edb8e82d14a0bd8f1e8b77e9019944c1440e Mon Sep 17 00:00:00 2001 From: Andrew Dunning Date: Wed, 3 Feb 2021 16:54:11 +0000 Subject: [PATCH] LaTeX template: Update to iftex package (#7073) Load the iftex package directly rather than via the ifxetex and ifluatex compatibility wrappers, which have been merged into a single package that is part of the LaTeX core. The capitalization of the commands has been changed for compatibility with older versions of TeX Live that have the version of iftex by the Persian TeX Group. This had been removed in for compatibility with BasicTeX, but that is no longer an issue. --- MANUAL.txt | 5 ++--- data/templates/default.latex | 22 +++++++++++----------- test/lhs-test.latex | 6 +++--- test/lhs-test.latex+lhs | 6 +++--- test/writer.latex | 6 +++--- test/writers-lang-and-dir.latex | 12 ++++++------ 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index ebed63d2c..4a82703a3 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -136,7 +136,7 @@ to output the generated LaTeX. You can then test it with `pdflatex test.tex`. When using LaTeX, the following packages need to be available (they are included with all recent versions of [TeX Live]): [`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`], -[`ifxetex`], [`ifluatex`], [`listings`] (if the +[`iftex`], [`listings`] (if the `--listings` option is used), [`fancyvrb`], [`longtable`], [`booktabs`], [`graphicx`] (if the document contains images), [`hyperref`], [`xcolor`], @@ -180,8 +180,7 @@ footnotes in tables). [`graphicx`]: https://ctan.org/pkg/graphicx [`grffile`]: https://ctan.org/pkg/grffile [`hyperref`]: https://ctan.org/pkg/hyperref -[`ifluatex`]: https://ctan.org/pkg/ifluatex -[`ifxetex`]: https://ctan.org/pkg/ifxetex +[`iftex`]: https://ctan.org/pkg/iftex [`listings`]: https://ctan.org/pkg/listings [`lm`]: https://ctan.org/pkg/lm [`longtable`]: https://ctan.org/pkg/longtable diff --git a/data/templates/default.latex b/data/templates/default.latex index c567278e3..c98f53bb6 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -98,14 +98,14 @@ $endif$ $if(linestretch)$ \usepackage{setspace} $endif$ -\usepackage{ifxetex,ifluatex} -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\usepackage{iftex} +\ifPDFTeX \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex $if(mathspec)$ - \ifxetex + \ifXeTeX \usepackage{mathspec} \else \usepackage{unicode-math} @@ -129,7 +129,7 @@ $for(fontfamilies)$ $endfor$ $if(mathfont)$ $if(mathspec)$ - \ifxetex + \ifXeTeX \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} \else \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} @@ -139,18 +139,18 @@ $else$ $endif$ $endif$ $if(CJKmainfont)$ - \ifxetex + \ifXeTeX \usepackage{xeCJK} \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} \fi $endif$ $if(luatexjapresetoptions)$ - \ifluatex + \ifLuaTeX \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset} \fi $endif$ $if(CJKmainfont)$ - \ifluatex + \ifLuaTeX \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec} \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} \fi @@ -329,7 +329,7 @@ $for(header-includes)$ $header-includes$ $endfor$ $if(lang)$ -\ifxetex +\ifXeTeX % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) \usepackage{polyglossia} \setmainlanguage[$for(polyglossia-lang.options)$$polyglossia-lang.options$$sep$,$endfor$]{$polyglossia-lang.name$} @@ -346,15 +346,15 @@ $if(babel-newcommands)$ $endif$ \fi $endif$ -\ifluatex +\ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi $if(dir)$ -\ifxetex +\ifXeTeX % Load bidi as late as possible as it modifies e.g. graphicx \usepackage{bidi} \fi -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\ifPDFTeX \TeXXeTstate=1 \newcommand{\RL}[1]{\beginR #1\endR} \newcommand{\LR}[1]{\beginL #1\endL} diff --git a/test/lhs-test.latex b/test/lhs-test.latex index 32042b103..fdc344335 100644 --- a/test/lhs-test.latex +++ b/test/lhs-test.latex @@ -6,8 +6,8 @@ ]{article} \usepackage{amsmath,amssymb} \usepackage{lmodern} -\usepackage{ifxetex,ifluatex} -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\usepackage{iftex} +\ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols @@ -81,7 +81,7 @@ \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering -\ifluatex +\ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi diff --git a/test/lhs-test.latex+lhs b/test/lhs-test.latex+lhs index 4bc674f4a..f9149ba02 100644 --- a/test/lhs-test.latex+lhs +++ b/test/lhs-test.latex+lhs @@ -6,8 +6,8 @@ ]{article} \usepackage{amsmath,amssymb} \usepackage{lmodern} -\usepackage{ifxetex,ifluatex} -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\usepackage{iftex} +\ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols @@ -48,7 +48,7 @@ \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering -\ifluatex +\ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi diff --git a/test/writer.latex b/test/writer.latex index 7fc707b27..abf772df4 100644 --- a/test/writer.latex +++ b/test/writer.latex @@ -6,8 +6,8 @@ ]{article} \usepackage{amsmath,amssymb} \usepackage{lmodern} -\usepackage{ifxetex,ifluatex} -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\usepackage{iftex} +\ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols @@ -63,7 +63,7 @@ \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering -\ifluatex +\ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi diff --git a/test/writers-lang-and-dir.latex b/test/writers-lang-and-dir.latex index 1172d23a2..d91f77325 100644 --- a/test/writers-lang-and-dir.latex +++ b/test/writers-lang-and-dir.latex @@ -7,8 +7,8 @@ ]{article} \usepackage{amsmath,amssymb} \usepackage{lmodern} -\usepackage{ifxetex,ifluatex} -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\usepackage{iftex} +\ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols @@ -45,7 +45,7 @@ \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering -\ifxetex +\ifXeTeX % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) \usepackage{polyglossia} \setmainlanguage[]{english} @@ -69,14 +69,14 @@ \newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}} \newenvironment{french}[2][]{\begin{otherlanguage}{french}}{\end{otherlanguage}} \fi -\ifluatex +\ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi -\ifxetex +\ifXeTeX % Load bidi as late as possible as it modifies e.g. graphicx \usepackage{bidi} \fi -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex +\ifPDFTeX \TeXXeTstate=1 \newcommand{\RL}[1]{\beginR #1\endR} \newcommand{\LR}[1]{\beginL #1\endL}