From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/generic/ifptex/LICENSE | 21 +++ macros/generic/ifptex/README-ja.md | 108 +++++++++++++ macros/generic/ifptex/README.md | 111 +++++++++++++ macros/generic/ifptex/ifptex.sty | 322 +++++++++++++++++++++++++++++++++++++ macros/generic/ifptex/ifuptex.sty | 54 +++++++ 5 files changed, 616 insertions(+) create mode 100644 macros/generic/ifptex/LICENSE create mode 100644 macros/generic/ifptex/README-ja.md create mode 100644 macros/generic/ifptex/README.md create mode 100644 macros/generic/ifptex/ifptex.sty create mode 100644 macros/generic/ifptex/ifuptex.sty (limited to 'macros/generic/ifptex') diff --git a/macros/generic/ifptex/LICENSE b/macros/generic/ifptex/LICENSE new file mode 100644 index 0000000000..8ada757fbc --- /dev/null +++ b/macros/generic/ifptex/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/macros/generic/ifptex/README-ja.md b/macros/generic/ifptex/README-ja.md new file mode 100644 index 0000000000..48690cce58 --- /dev/null +++ b/macros/generic/ifptex/README-ja.md @@ -0,0 +1,108 @@ +ifptex パッケージバンドル +========================= + +TeX: エンジンが pTeX(やその派生)であるかを判定する + +ifptex パッケージは ifxetex や ifluatex 等のパッケージの pTeX 版に +相当する。ifuptex パッケージは ifptex の別名で、後方互換性のために +用意されている。 + +### システム要件 + + - TeX フォーマット: plain TeX、LaTeX (および他の plain 互換なもの) + - TeX エンジン: 不問 + - DVI ウェア(DVI 出力時): 不問 + +### インストール + +TDS 1.1 に準拠するシステムの場合、以下のようにファイルを移動する: + + - `*.sty` → $TEXMF/tex/latex/ifptex + +この後必要に応じて mktexlsr を実行する。 + +ifptex パッケージ ― pTeX 系エンジンの判定 +------------------------------------------ + +### パッケージ読込 + +plain TeX の場合: + + \input ifptex.sty + +LaTeX の場合: + + \usepackage{ifptex} + +### 機能 + +注意:e-TeX拡張の有無は区別されない。 + + * `\ifpTeX`(又は `\ifptex`)[if-トークン] + pTeX(upTeX、pTeX-ng を含む)を使っているか。 + * `\ifstrictpTeX`(又は `\ifstrictptex`)[if-トークン] + pTeX(upTeX、pTeX-ng ではなく)を使っているか。 + * `\ifupTeX`(又は `\ifuptex`) [if-トークン] + upTeX(pTeX-ng を含む)を使っているか。 + * `\ifstrictupTeX`(又は `\ifstrictuptex`) [if-トークン] + upTeX(pTeX-ng ではなく)を使っているか。 + * `\ifnativeupTeX` [if-トークン] + upTeX を内部文字コードが Unicode の状態で使っているか。 + * `\ifpTeXng`(又は `\ifptexng`)[if-トークン] + pTeX-ng を使っているか。 + ※一応 `\ifstrictpTeXng`(`\ifstrictptexng`)もある。 + * `\RequirepTeX` + `\ifpTeX` 不成立の場合はエラーを出す。 + * `\RequireStirctpTeX` + `\ifstrictpTeX` 不成立の場合はエラーを出す。 + * `\RequireupTeX` + `\ifupTeX` 不成立の場合はエラーを出す。 + * `\RequireStrictupTeX` + `\ifstrictupTeX` 不成立の場合はエラーを出す。 + * `\RequireNativeupTeX` + `\ifnativeupTeX` 不成立の場合はエラーを出す。 + * `\RequirepTeXng` + `\ifpTeXng` 不成立の場合はエラーを出す。 + ※一応 `\RequireStrictpTeXng` もある。 + + +ifuptex パッケージ ― ifptex の別名 +----------------------------------- + +ただ単に ifptex を読み込むだけのパッケージであり、0.2 版との後方互換性の +ために用意されている。 + +### パッケージ読込 + +plain TeX の場合: + + \input ifuptex.sty + +LaTeX の場合: + + \usepackage{ifuptex} + + +更新履歴 +-------- + + * Version 1.2c 〈2017/10/04〉 + - バグ修正。 + * Version 1.2b 〈2017/09/20〉 + - バグ修正。 + * Version 1.2a 〈2017/09/15〉 + - (試験的) `漢字コード=UTF-8` 機能を追加。 + * Version 1.2 〈2017/09/09〉 + - `\ifstrictupTeX`、`\RequireStrictupTeX` を追加。 + * Version 1.1 〈2017/05/04〉 + - 細かい調整。 + * Version 1.0 〈2013/04/29〉 + - 独立のバンドルに移動。 + - パッケージ名を ifptex に変更して、pTeX 判定機能を付加。 + - (試験的) upTeX の版判定機能を追加。 + * Version 0.2 〈2008/03/14〉 + - 最初の公開版。 + +-------------------- +Takayuki YATO (aka. "ZR") +https://github.com/zr-tex8r diff --git a/macros/generic/ifptex/README.md b/macros/generic/ifptex/README.md new file mode 100644 index 0000000000..c9d37688f9 --- /dev/null +++ b/macros/generic/ifptex/README.md @@ -0,0 +1,111 @@ +ifptex Package Bundle +===================== + +TeX: To check the engine is pTeX (or its derivatives) + +The ifptex package is a counterpart of ifxetex, ifluatex, etc. for +the pTeX engine. The ifuptex package is an alises to ifptex provided +for backward compatibility. + +### System Requirements + + - TeX format: plain TeX, LaTeX (and any plain-compatible ones). + - TeX engine: Anything. + - DVI driver (in DVI mode): Anything. + +### Installation + +In a system compliant to TDS 1.1, move the files as follows: + + - `*.sty` → $TEXMF/tex/latex/ifptex + +And rehash your TEXMF trees if necessary. + +### License + +This package is distributed under the MIT License. + +ifptex Package ― Test for pTeX engine +-------------------------------------- + +### Package Loading + +In plain TeX: + + \input ifptex.sty + +In LaTeX: + + \usepackage{ifptex} + +### Usage + +NB: Here “e-TeX-ness” is not considered. + + * `\ifpTeX` (or `\ifptex`) [if-token] + Whether the engine is pTeX (including upTeX or pTeX-ng). + * `\ifstrictpTeX` (or `\ifstrictptex`) [if-token] + Whether the engine is pTeX but *not* upTeX or pTeX-ng. + * `\ifupTeX` (or `\ifuptex`) [if-token] + Whether the engine is upTeX (including pTeX-ng). + * `\ifstrictupTeX` (or `\ifstrictuptex`) [if-token] + Whether the engine is upTeX but *not* pTeX-ng. + * `\ifnativeupTeX` [if-token] + Whether the engine is upTeX and its internal encoding is Unicode. + * `\ifpTeXng` (or `\ifptexng`) [if-token] + Whether the engine is pTeX-ng. + * `\RequirepTeX` + Issues an error if `\ifpTeX` fails. + * `\RequireStrictpTeX` + Issues an error if `\ifstrictpTeX` fails. + * `\RequireupTeX` + Issues an error if `\ifupTeX` fails. + * `\RequireStrictupTeX` + Issues an error if `\ifstrictupTeX` fails. + * `\RequireNativeupTeX` + Issues an error if `\ifnativeupTeX` fails. + * `\RequirepTeXng` + Issues an error if `\ifpTeXng` fails. + + +ifuptex Package ― Alias of ifptex +---------------------------------- + +The ifuptex package does nothing but loading ifptex internally. It is +provided for backward compatibility. + +### Package Loading + +In plain TeX: + + \input ifuptex.sty + +In LaTeX: + + \usepackage{ifuptex} + +### Usage + +Just the same as the ifptex package. + + +Revision History +---------------- + + * Version 1.2c 〈2017/10/04〉 + * Version 1.2b 〈2017/09/20〉 + * Version 1.2a 〈2017/09/15〉 + * Version 1.2 〈2017/09/09〉 + - Add `\ifstrictupTeX` and `RequireStrictupTeX`. + * Version 1.1 〈2017/05/04〉 + - Minor fix. + * Version 1.0 〈2013/04/29〉 + - Move to a separate bundle. + - Change the package name to ifptex, and added the test + for pTeX (besides upTeX). + * Version 0.2 〈2008/03/14〉 + - First public version. + +-------------------- +Takayuki YATO (aka. "ZR") +https://github.com/zr-tex8r diff --git a/macros/generic/ifptex/ifptex.sty b/macros/generic/ifptex/ifptex.sty new file mode 100644 index 0000000000..29cec914ef --- /dev/null +++ b/macros/generic/ifptex/ifptex.sty @@ -0,0 +1,322 @@ +%% +%% This is file 'ifptex.sty'. +%% +%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% +% +%% avoid multiple loading +\csname\if11bxipIfptexLoaded\fi\endcsname +%% code guards +\edef\x{% +\catcode32=\the\catcode32% +\catcode33=\the\catcode33% +\catcode35=\the\catcode35% +\catcode42=\the\catcode42% +\catcode60=\the\catcode60% +\catcode62=\the\catcode62% +\catcode64=\the\catcode64% +\catcode91=\the\catcode91% +\catcode93=\the\catcode93% +\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 + \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]{% + \immediate\write-1{Package: #2 #3}} + \expandafter\x +\else %<*LaTeX> + \let\bxip@latex=t \let\x\relax +\fi % + +%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ifptex}[2017/10/04 v1.2c pTeX checker] +\def\bxip@pkgname{ifptex} + +%% enter the big group +\begingroup + +%--------------------------------------- helpers + +%% \bxip@csletcs{}{} +\def\bxip@csletcs#1#2{% + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname} +%% \bxip@true{} +\def\bxip@true#1{% + \expandafter\let\csname#1\endcsname\iftrue} +%% \bxip@false{} +\def\bxip@false#1{% + \expandafter\let\csname#1\endcsname\iffalse} + +%% switches +\bxip@false{ifbxip@ok} + +%% \bxip@test@primitive\CS +\def\bxip@test@primitive#1{% + \edef\bxip@tmpa{\string#1}\edef\bxip@tmpb{\meaning#1}% + \ifx\bxip@tmpa\bxip@tmpb \bxip@true{ifbxip@ok}% + \else \bxip@false{ifbxip@ok}% + \fi} + +%% \bxip@with@default{}\CS +\gdef\bxip@with@default#1#2{% + \def\bxip@tmpa{#2}\def\bxip@tmpb{#2[#1]}% + \futurelet\bxip@tok\bxip@with@default@a} +\gdef\bxip@with@default@a{% + \ifx[\bxip@tok\expandafter\bxip@tmpa%] + \else \expandafter\bxip@tmpb + \fi} + +%% \bxip@check@version{}{}{