From 97106ae9313f56715ee9a7dd39d708158c1bedb9 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 4 Nov 2019 03:00:32 +0000 Subject: CTAN sync 201911040300 --- macros/generic/ifptex/LICENSE | 2 +- macros/generic/ifptex/README-ja.md | 29 +++++--- macros/generic/ifptex/README.md | 28 ++++--- macros/generic/ifptex/ifptex.sty | 149 ++++++++++++++++++++++++------------- macros/generic/ifptex/ifuptex.sty | 38 ++++++---- 5 files changed, 158 insertions(+), 88 deletions(-) (limited to 'macros/generic') diff --git a/macros/generic/ifptex/LICENSE b/macros/generic/ifptex/LICENSE index 8ada757fbc..534324b756 100644 --- a/macros/generic/ifptex/LICENSE +++ b/macros/generic/ifptex/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2017 Takayuki YATO (aka. "ZR") +Copyright (c) 2019 Takayuki YATO (aka. "ZR") Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/macros/generic/ifptex/README-ja.md b/macros/generic/ifptex/README-ja.md index 48690cce58..7578fcbe29 100644 --- a/macros/generic/ifptex/README-ja.md +++ b/macros/generic/ifptex/README-ja.md @@ -9,15 +9,17 @@ ifptex パッケージは ifxetex や ifluatex 等のパッケージの pTeX 版 ### システム要件 - - TeX フォーマット: plain TeX、LaTeX (および他の plain 互換なもの) - - TeX エンジン: 不問 - - DVI ウェア(DVI 出力時): 不問 + * TeX フォーマット: plain TeX、LaTeX、INI モード + * TeX エンジン: 不問 + * DVI ウェア(DVI 出力時): 不問 + * 依存パッケージ: + - iftex ### インストール TDS 1.1 に準拠するシステムの場合、以下のようにファイルを移動する: - - `*.sty` → $TEXMF/tex/latex/ifptex + - `*.sty` → $TEXMF/tex/generic/ifptex この後必要に応じて mktexlsr を実行する。 @@ -38,19 +40,19 @@ LaTeX の場合: 注意:e-TeX拡張の有無は区別されない。 - * `\ifpTeX`(又は `\ifptex`)[if-トークン] + * `\ifptex`(又は `\ifpTeX`)[if-トークン] pTeX(upTeX、pTeX-ng を含む)を使っているか。 - * `\ifstrictpTeX`(又は `\ifstrictptex`)[if-トークン] + * `\ifstrictptex`(又は `\ifstrictpTeX`)[if-トークン] pTeX(upTeX、pTeX-ng ではなく)を使っているか。 - * `\ifupTeX`(又は `\ifuptex`) [if-トークン] + * `\ifuptex`(又は `\ifupTeX`) [if-トークン] upTeX(pTeX-ng を含む)を使っているか。 - * `\ifstrictupTeX`(又は `\ifstrictuptex`) [if-トークン] + * `\ifstrictuptex`(又は `\ifstrictupTeX`) [if-トークン] upTeX(pTeX-ng ではなく)を使っているか。 - * `\ifnativeupTeX` [if-トークン] + * `\ifnativeuptex`(又は `\ifnativeupTeX`) [if-トークン] upTeX を内部文字コードが Unicode の状態で使っているか。 - * `\ifpTeXng`(又は `\ifptexng`)[if-トークン] + * `\ifptexng`(又は `\ifpTeXng`)[if-トークン] pTeX-ng を使っているか。 - ※一応 `\ifstrictpTeXng`(`\ifstrictptexng`)もある。 + ※一応 `\ifstrictptexng`(`\ifstrictpTeXng`)もある。 * `\RequirepTeX` `\ifpTeX` 不成立の場合はエラーを出す。 * `\RequireStirctpTeX` @@ -86,6 +88,11 @@ LaTeX の場合: 更新履歴 -------- + * Version 2.0 〈2019/11/01〉 + - LaTeX チームによる新しい iftex パッケージと動作を整合させる。 + - 特に、iftex を中で読み込むようにする。 + - `\if...tex` について常に小文字のみの名前を用意する。 + - INI モードでの読込に対応。 * Version 1.2c 〈2017/10/04〉 - バグ修正。 * Version 1.2b 〈2017/09/20〉 diff --git a/macros/generic/ifptex/README.md b/macros/generic/ifptex/README.md index c9d37688f9..9b5975b2e9 100644 --- a/macros/generic/ifptex/README.md +++ b/macros/generic/ifptex/README.md @@ -9,15 +9,17 @@ for backward compatibility. ### System Requirements - - TeX format: plain TeX, LaTeX (and any plain-compatible ones). - - TeX engine: Anything. - - DVI driver (in DVI mode): Anything. + * TeX format: plain TeX, LaTeX, and INI mode. + * TeX engine: Anything. + * DVI driver (in DVI mode): Anything. + * Dependent packages: + - iftex ### Installation In a system compliant to TDS 1.1, move the files as follows: - - `*.sty` → $TEXMF/tex/latex/ifptex + - `*.sty` → $TEXMF/tex/generic/ifptex And rehash your TEXMF trees if necessary. @@ -42,17 +44,17 @@ In LaTeX: NB: Here “e-TeX-ness” is not considered. - * `\ifpTeX` (or `\ifptex`) [if-token] + * `\ifptex` (or `\ifpTeX`) [if-token] Whether the engine is pTeX (including upTeX or pTeX-ng). - * `\ifstrictpTeX` (or `\ifstrictptex`) [if-token] + * `\ifstrictptex` (or `\ifstrictpTeX`) [if-token] Whether the engine is pTeX but *not* upTeX or pTeX-ng. - * `\ifupTeX` (or `\ifuptex`) [if-token] + * `\ifuptex` (or `\ifupTeX`) [if-token] Whether the engine is upTeX (including pTeX-ng). - * `\ifstrictupTeX` (or `\ifstrictuptex`) [if-token] + * `\ifstrictuptex` (or `\ifstrictupTeX`) [if-token] Whether the engine is upTeX but *not* pTeX-ng. - * `\ifnativeupTeX` [if-token] + * `\ifnativeuptex` (or `\ifnativeupTeX`) [if-token] Whether the engine is upTeX and its internal encoding is Unicode. - * `\ifpTeXng` (or `\ifptexng`) [if-token] + * `\ifptexng` (or `\ifpTeXng`) [if-token] Whether the engine is pTeX-ng. * `\RequirepTeX` Issues an error if `\ifpTeX` fails. @@ -92,6 +94,12 @@ Just the same as the ifptex package. Revision History ---------------- + * Version 2.0 〈2019/11/01〉 + - Adjust to work better with the new iftex package maintanined + by the LaTeX3 Project. + - Now iftex is loaded inside ifptex. + - Provide always all-lowercase `\if...tex` commands. + - Support for loading in INI mode. * Version 1.2c 〈2017/10/04〉 * Version 1.2b 〈2017/09/20〉 * Version 1.2a 〈2017/09/15〉 diff --git a/macros/generic/ifptex/ifptex.sty b/macros/generic/ifptex/ifptex.sty index 29cec914ef..e16121a381 100644 --- a/macros/generic/ifptex/ifptex.sty +++ b/macros/generic/ifptex/ifptex.sty @@ -1,7 +1,7 @@ %% %% This is file 'ifptex.sty'. %% -%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2019 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -9,50 +9,78 @@ %% % %% avoid multiple loading -\csname\if11bxipIfptexLoaded\fi\endcsname +\csname\if11bxipIfptexLoaded\fi\endcsname% %% code guards -\edef\x{% +\begingroup\count255\catcode61\global\catcode61\catcode48% +\catcode91=1\catcode93=2\xdef\bxipIfptexLoaded[% +\catcode61=\the\count255% +\catcode13=\the\catcode13% \catcode32=\the\catcode32% -\catcode33=\the\catcode33% \catcode35=\the\catcode35% -\catcode42=\the\catcode42% +\catcode123=\the\catcode123% +\catcode125=\the\catcode125% +\endlinechar=\the\endlinechar]% +\endgroup\catcode32=10\catcode13=5\endlinechar=13\relax% +\catcode35=6 \catcode123=1 \catcode125=2 +\edef\bxipIfptexLoaded{\bxipIfptexLoaded +\catcode33=\the\catcode33% +\catcode34=\the\catcode34% +\catcode39=\the\catcode39% +\catcode45=\the\catcode45% +\catcode46=\the\catcode46% +\catcode47=\the\catcode47% +\catcode58=\the\catcode58% \catcode60=\the\catcode60% \catcode62=\the\catcode62% +\catcode63=\the\catcode63% \catcode64=\the\catcode64% \catcode91=\the\catcode91% \catcode93=\the\catcode93% +\catcode96=\the\catcode96% \relax} -\catcode32=10\relax -\catcode33=11 %<"> -\catcode35=6 %<#> -\catcode42=12 %<*> -\catcode60=12 %<<> -\catcode62=12 %<>> -\catcode64=11 %<@> -\catcode91=12 %<[> -\catcode93=12 %<]> -\edef\bxip@restore@codes{\x +\catcode33=12 % +\catcode34=12 % <"> +\catcode39=12 % <'> +\catcode45=12 % <-> +\catcode46=12 % <.> +\catcode47=12 % +\catcode58=12 % <:> +\catcode60=12 % <<> +\catcode62=12 % <>> +\catcode63=12 % +\catcode64=11 % <@> +\catcode91=12 % <[> +\catcode93=12 % <]> +\catcode96=12 % <`> +\edef\bxip@restore@codes{\bxipIfptexLoaded \noexpand\let\noexpand\bxip@restore@codes\relax} \def\bxipIfptexLoaded{\endinput} %% check for LaTeX \ifx\RequirePackage\@undefined %<*!LaTeX> \let\bxip@latex=f - \long\def\x#1\ProvidesPackage#2[#3]{% + \long\def\bxip@input#1\ProvidesPackage#2[#3]{% + \def\bxip@input\RequirePackage##1[##2]{\input ##1.sty\relax}% \immediate\write-1{Package: #2 #3}} - \expandafter\x + \expandafter\bxip@input \else %<*LaTeX> - \let\bxip@latex=t \let\x\relax + \let\bxip@latex=t + \let\bxip@input\relax \fi % %% package declaration \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ifptex}[2017/10/04 v1.2c pTeX checker] +\ProvidesPackage{ifptex}[2019/11/01 v2.0 pTeX checker] \def\bxip@pkgname{ifptex} -%% enter the big group -\begingroup +%% packages +\ifx\newif\@undefined\else +\bxip@input +\RequirePackage{iftex}[2013/04/04]% v0.2 +\fi +%======================================= +\begingroup % entering a big group %--------------------------------------- helpers %% \bxip@csletcs{}{} @@ -96,18 +124,28 @@ \gdef\bxip@check@version@a#1#2#3#4#5#6\relax#7{% \bxip@err@required{#7 v.>=\number#2#3#4.#5#6}} -%% \bxip@err@required{} -% NB: Now the same style as in ifxetex is used. -\gdef\bxip@err@required#1{% - \begingroup - \errorcontextlines=-1\relax - \newlinechar=10\relax - \errmessage{^^J - ********************************************^^J - * #1 is required to compile this document.^^J - * Sorry!^^J +%% \bxip@Require\ifXXX{}\fi +% (Equivalent to \IFTEX@Require of iftex.) +\gdef\bxip@Require#1#2#3{% + #1\else + \newlinechar64\relax + \errorcontextlines-1\relax + \immediate\write20{@ + ********************************************@ + * #2 is required to compile this document.@ + * Sorry!@ ********************************************}% - \endgroup} + % do a hard stop + \batchmode\read-1to\bxip@tmpa + #3} +\gdef\bxip@err@required#1{\bxip@Require\iftrue{#1}\fi} + +%% \bxip@protected +\let\bxip@protected\protected +\ifx\directlua\@undefined\else + \directlua{tex.enableprimitives('bxip@', {'protected'})} +\fi +\bxip@csletcs{bxip@protected}{bxip@protected} %--------------------------------------- guess version @@ -135,12 +173,13 @@ %--------------------------------------- public stuffs % Note: -% 1) Names '\ifFooTeX' are used in iftex. +% 1) Names '\ifFooTeX' were used in old iftex. % 2) Names '\iffootex' are used in ifxetex/ifluatex/.... -% My preferences are: +% My preferences used to be: % - '\ifwhateverFooTeX' and '\RequireWhateverFooTeX'. -% But I also provide aliases '\iffootex' and '\ifstrictfootex' for -% compatibility with 1) and the old ifuptex. +% But now I adopt the preferences of new iftex: +% - '\ifwhateverfootex' and '\RequireWhateverFooTeX'. +% I also provide aliases '\ifwhateverFooTeX' for compatibility. %%<+> \ifpTeX \global\bxip@false{ifpTeX} @@ -161,6 +200,8 @@ \fi %%<+> \ifuptex == \ifupTeX \global\bxip@csletcs{ifuptex}{ifupTeX} +%%<+> \ifnativeuptex == \ifnativeupTeX +\global\bxip@csletcs{ifnativeuptex}{ifnativeupTeX} %%<+> \ifpTeXng \global\bxip@false{ifpTeXng} @@ -192,29 +233,29 @@ \global\bxip@csletcs{ifstrictptexng}{ifstrictpTeXng} %%<+> \RequirepTeX -\gdef\RequirepTeX{% - \ifpTeX\else \bxip@err@required{(u)pTeX}\fi} +\bxip@protected\gdef\RequirepTeX{% + \bxip@Require\ifpTeX{(u)pTeX}\fi} %%<+> \RequireStrictpTeX -\gdef\RequireStrictpTeX{% - \ifstrictpTeX\else \bxip@err@required{pTeX (not upTeX)}\fi} +\bxip@protected\gdef\RequireStrictpTeX{% + \bxip@Require\ifstrictpTeX{pTeX (not upTeX)}\fi} %%<+> \RequireupTeX -\gdef\RequireupTeX{% - \ifupTeX\else \bxip@err@required{upTeX}\fi} +\bxip@protected\gdef\RequireupTeX{% + \bxip@Require\ifupTeX{upTeX}\fi} %%<+> \RequireStrictupTeX -\gdef\RequireStrictupTeX{% - \ifstrictupTeX\else \bxip@err@required{upTeX (not pTeX-ng)}\fi} +\bxip@protected\gdef\RequireStrictupTeX{% + \bxip@Require\ifstrictupTeX{upTeX (not pTeX-ng)}\fi} %%<+> \RequireNativeupTeX -\gdef\RequireNativeupTeX{% - \ifnativeupTeX\else \bxip@err@required{upTeX in Unicode}\fi} +\bxip@protected\gdef\RequireNativeupTeX{% + \bxip@Require\ifnativeupTeX{upTeX in Unicode}\fi} %%<+> \RequirepTeXng -\gdef\RequirepTeXng{% - \ifpTeXng\else \bxip@err@required{pTeX-ng}\fi} +\bxip@protected\gdef\RequirepTeXng{% + \bxip@Require\ifpTeXng{pTeX-ng}\fi} %%<+> \RequireStrictpTeXng -\gdef\RequireStrictpTeXng{% - \ifstrictpTeXng\else \bxip@err@required{pTeX-ng}\fi} +\bxip@protected\gdef\RequireStrictpTeXng{% + \bxip@Require\ifstrictpTeXng{pTeX-ng}\fi} %--------------------------------------- KanjiKoodo declaration -\ifpTeX +\ifpTeX \ifx t\bxip@latex %% \bxip@def@str\CS{} \def\bxip@def@str#1#2{% @@ -283,7 +324,7 @@ \epTeXinputencoding utf8}% unterminated \fi -\fi +\fi\fi %--------------------------------------- deprecated stuffs %%<+>D \ifNativeupTeX == \ifnativeupTeX @@ -317,6 +358,10 @@ %--------------------------------------- all done \endgroup +% clean up +\let\bxip@latex\@undefined +\let\bxip@input\@undefined +\let\bxip@protected\@undefined \bxip@restore@codes \endinput %% EOF diff --git a/macros/generic/ifptex/ifuptex.sty b/macros/generic/ifptex/ifuptex.sty index cb84bd8cbd..a60dd36d4d 100644 --- a/macros/generic/ifptex/ifuptex.sty +++ b/macros/generic/ifptex/ifuptex.sty @@ -1,7 +1,7 @@ %% %% This is file 'ifuptex.sty'. %% -%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% Copyright (c) 2019 Takayuki YATO (aka. "ZR") %% GitHub: https://github.com/zr-tex8r %% Twitter: @zr_tex8r %% @@ -11,42 +11,52 @@ % NOTE: Now ifuptex is merely an alias to ifptex. % %% avoid multiple loading -\csname\if11bxipIfuptexLoaded\fi\endcsname +\csname\if11bxipIfuptexLoaded\fi\endcsname% %% code guards -\edef\x{% +\begingroup\count255\catcode61\global\catcode61\catcode48% +\catcode91=1\catcode93=2\xdef\bxipIfuptexLoaded[% +\catcode61=\the\count255% +\catcode13=\the\catcode13% \catcode32=\the\catcode32% +\catcode35=\the\catcode35% +\catcode123=\the\catcode123% +\catcode125=\the\catcode125% +\endlinechar=\the\endlinechar]% +\endgroup\catcode32=10\catcode13=5\endlinechar=13\relax% +\catcode35=6 \catcode123=1 \catcode125=2 +\edef\bxipIfuptexLoaded{\bxipIfuptexLoaded \catcode45=\the\catcode45% \catcode46=\the\catcode46% \catcode47=\the\catcode47% \catcode58=\the\catcode58% \catcode64=\the\catcode64% \relax} -\catcode32=10\relax \catcode45=12 % <-> \catcode46=12 % <.> \catcode47=12 % \catcode58=12 % <:> \catcode64=11 % <@> -\edef\bxip@up@restore@codes{\x +\edef\bxip@up@restore@codes{\bxipIfuptexLoaded \noexpand\let\noexpand\bxip@up@restore@codes\relax} \def\bxipIfuptexLoaded{\endinput} %% check for LaTeX -\ifx\RequirePackage\@undefined % non-LaTeX - \long\def\x#1\ProvidesPackage#2[#3]{% - \def\x\RequirePackage##1[##2]{\input ##1.sty\relax}% +\ifx\RequirePackage\@undefined %<*!LaTeX> + \long\def\bxip@input#1\ProvidesPackage#2[#3]{% + \def\bxip@input\RequirePackage##1[##2]{\input ##1.sty\relax}% \immediate\write-1{Package: #2 #3}} - \expandafter\x -\else % LaTeX - \let\x\relax -\fi + \expandafter\bxip@input +\else %<*LaTeX> + \let\bxip@input\relax +\fi % %% package declaration \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ifuptex}[2017/10/04 v1.2c upTeX checker] +\ProvidesPackage{ifuptex}[2019/11/01 v2.0 pTeX checker] %% load ifptex -\x\RequirePackage{ifptex}[2017/10/04] +\bxip@input +\RequirePackage{ifptex}[2019/11/01] %% all done \bxip@up@restore@codes -- cgit v1.2.3