summaryrefslogtreecommitdiff
path: root/macros/jptex/latex/plautopatch
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-08-01 03:04:31 +0000
committerNorbert Preining <norbert@preining.info>2022-08-01 03:04:31 +0000
commitc7ecdfe2e07e2e010de5e2a8d94c001c5dc9fc27 (patch)
tree80bdca45c628ce054648b8b6adc4c97d21bd48bb /macros/jptex/latex/plautopatch
parent0d7064c66024537b237407f8b36413b055cf9a9a (diff)
CTAN sync 202208010304
Diffstat (limited to 'macros/jptex/latex/plautopatch')
-rw-r--r--macros/jptex/latex/plautopatch/LICENSE27
-rw-r--r--macros/jptex/latex/plautopatch/README.md99
-rw-r--r--macros/jptex/latex/plautopatch/plarydshln.sty35
-rw-r--r--macros/jptex/latex/plautopatch/plautopatch-ja.pdfbin0 -> 96578 bytes
-rw-r--r--macros/jptex/latex/plautopatch/plautopatch-ja.tex199
-rw-r--r--macros/jptex/latex/plautopatch/plautopatch.pdfbin0 -> 39961 bytes
-rw-r--r--macros/jptex/latex/plautopatch/plautopatch.sty271
-rw-r--r--macros/jptex/latex/plautopatch/plautopatch.tex197
-rw-r--r--macros/jptex/latex/plautopatch/plcollcell.sty199
-rw-r--r--macros/jptex/latex/plautopatch/plextarydshln.sty60
-rw-r--r--macros/jptex/latex/plautopatch/plsiunitx.sty71
-rw-r--r--macros/jptex/latex/plautopatch/pxpgfrcs.sty50
-rw-r--r--macros/jptex/latex/plautopatch/pxstfloats.sty120
13 files changed, 1328 insertions, 0 deletions
diff --git a/macros/jptex/latex/plautopatch/LICENSE b/macros/jptex/latex/plautopatch/LICENSE
new file mode 100644
index 0000000000..cc115568ea
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2018-2021 Hironobu Yamashita
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/macros/jptex/latex/plautopatch/README.md b/macros/jptex/latex/plautopatch/README.md
new file mode 100644
index 0000000000..2f399b8c9a
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/README.md
@@ -0,0 +1,99 @@
+# plautopatch
+
+Japanese pLaTeX/upLaTeX formats and packages often conflict
+with other LaTeX packages which are unaware of pLaTeX/upLaTeX.
+In the worst case, such packages throw a fatal error or
+end up with a wrong output.
+
+The goal of this package "plautopatch" is that
+there should be no need to worry about such incompatibilities,
+because specific patches are loaded automatically
+whenever necessary.
+This helps not only to simplify source files, but also
+to make the appearance of working pLaTeX/upLaTeX sources
+similar to those of ordinary LaTeX ones.
+
+The following patches are currently registered:
+
+- doc (latex) -> pldocverb (platex-tools)
+- tracefnt (latex) -> ptrace/uptrace (platex/uplatex)
+- fltrace (latex) -> pfltrace (platex)
+- array (latex-tools) -> plarray (platex-tools)
+- array (latex-tools) + plext (platex) -> plextarray (platex-tools)
+- delarray (latex-tools) + plext (platex) -> plextdelarray (platex-tools)
+- colortbl + plext (platex) -> plextcolortbl (platex-tools)
+- arydshln -> plarydshln (maintained here!)
+- arydshln + plext (platex) -> plextarydshln (maintained here!)
+- siunitx -> plsiunitx (maintained here!)
+- collcell -> plcollcell (maintained here!)
+- everysel (ms) -> pxeverysel (platex-tools)
+- everyshi (ms) -> pxeveryshi (platex-tools)
+- atbegshi (oberdiek) -> pxatbegshi (platex-tools)
+- ftnright (latex-tools) -> pxftnright (platex-tools)
+- multicol (latex-tools) -> pxmulticol (platex-tools)
+- xspace (latex-tools) -> pxxspace (platex-tools)
+- textpos -> pxtextpos (gentombow)
+- eso-pic -> pxesopic (gentombow)
+- pdfpages -> pxpdfpages (gentombow)
+- stfloats (sttools) -> pxstfloats (pxsttools)
+- hyperref -> pxjahyper (by Takayuki YATO)
+- pgfrcs (pgf) -> pxpgfrcs (maintained here!)
+- pgfcore (pgf) -> pxpgfmark (by Takayuki YATO)
+
+## Requirements
+
+If LaTeX2e 2020-10-01 or newer is running,
+this package uses the new hook system such as
+`\AddToHook{package/before/...}` and
+`\AddToHook{package/after/...}`.
+If LaTeX2e is older than that, this package depends on
+`filehook` package (written by Martin Scharrer).
+
+## Miscellaneous
+
+This bundle may distribute some tiny patches
+together with the main package.
+All packages are meant for use with pLaTeX/upLaTeX.
+Short information:
+
+- plarydshln.sty:
+ Patch for arydshln.sty (by Hiroshi Nakashima) to improve
+ compatibility with pLaTeX kernel.
+- plextarydshln.sty:
+ Patch for arydshln.sty (by Hiroshi Nakashima) to improve
+ compatibility with plext.sty in pLaTeX.
+- plsiunitx.sty:
+ Patch for siunitx.sty (by Joseph Wright) to fix
+ conflict with plarray.sty (platex-tools).
+- plcollcell.sty:
+ Patch for collcell.sty (by Martin Scharrer) to fix
+ conflict with plarray.sty (platex-tools).
+- pxpgfrcs.sty:
+ Patch for pgfrcs.sty (part of PGF) to support
+ Japanese classes for vertical writing.
+- pxstfloats.sty:
+ Patch for stfloats.sty (sttools) to improve
+ compatibility with pLaTeX kernel.
+ Actually part of pxsttols (https://github.com/aminophen/pxsttools)
+ but included here for convenience.
+
+## Installation
+
+- *.sty -> $TEXMF/tex/platex/plautopatch
+- *.tex, *.pdf -> $TEXMF/doc/platex/plautopatch
+
+## Repository
+
+The bundle is maintained on GitHub:
+ https://github.com/aminophen/plautopatch
+
+## License
+
+The bundle may be distributed and/or modified under the terms of
+the 3-clause BSD license (see [LICENSE](./LICENSE)).
+
+## Release Date
+
+2021-12-07
+
+Hironobu Yamashita
diff --git a/macros/jptex/latex/plautopatch/plarydshln.sty b/macros/jptex/latex/plautopatch/plarydshln.sty
new file mode 100644
index 0000000000..538fc11ea2
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plarydshln.sty
@@ -0,0 +1,35 @@
+%
+% plarydshln.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+% This package is expected to be compatible with
+% * arydshln.sty
+% (2004/08/31 v1.71 -- 2019/02/21 v1.76)
+% * plcore.ltx in platex
+% (2001/09/26 v1.2a -- 2021/06/03 v1.3j)
+%
+
+%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{plarydshln}
+ [2018/10/20 v0.4 arydshln package for pLaTeX/upLaTeX]
+\RequirePackage{arydshln}
+
+%% handle package compatibility issues beforehand
+\@ifpackageloaded{array}{\RequirePackage{plarray}}{}
+
+%% patching internal code for arydshln.sty
+%
+%% remove extra \xkanjiskip (pLaTeX2e 2016/04/17)
+\@ifl@t@r{\pfmtversion}{2016/04/17}{\@firstofone}{\@gobble}
+{% = for pLaTeX2e 2016/04/17 or newer
+\def\endtabular{\endarray $\egroup\null}
+\expandafter\let\csname endtabular*\endcsname\endtabular
+}% =
+%
+%% done
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/plautopatch-ja.pdf b/macros/jptex/latex/plautopatch/plautopatch-ja.pdf
new file mode 100644
index 0000000000..a6696d4409
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plautopatch-ja.pdf
Binary files differ
diff --git a/macros/jptex/latex/plautopatch/plautopatch-ja.tex b/macros/jptex/latex/plautopatch/plautopatch-ja.tex
new file mode 100644
index 0000000000..70589a2b50
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plautopatch-ja.tex
@@ -0,0 +1,199 @@
+%# -*- coding: utf-8 -*-
+\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016)
+ \epTeXinputencoding utf8 % ensure utf-8 encoding for platex
+\fi
+
+\documentclass[a4paper,dvipdfmx]{jsarticle}
+\usepackage{doc}
+\usepackage[verb]{bxghost}
+\xspcode"5C=3 % \
+\xspcode"3C=3 % <
+\xspcode"3E=3 % >
+\usepackage{plautopatch}% load this here to make \GetFileInfo work
+\GetFileInfo{plautopatch.sty}
+\title{Package \textsf{plautopatch} \fileversion}
+\author{Hironobu Yamashita}
+\date{\filedate}
+\begin{document}
+
+\maketitle
+
+日本の\pLaTeX/\upLaTeX{}フォーマットや専用パッケージが、
+これらを知らない\LaTeX{}パッケージ(しばしば海外で作られた
+汎用のもの)と衝突することがあります。
+最悪の場合にはエラーが出たり、誤った出力が得られたり
+することがあります。
+
+この\textsf{plautopatch}の目的は、こうした非互換を意識せずに
+済むようにすることです。具体的には、\pLaTeX/\upLaTeX{}と
+衝突するパッケージが使われた場合に、その衝突を解消するパッチを
+提供するパッケージを必要に応じて自動的に読み込みます。
+こうすることで、ソースコードを簡潔にできるだけでなく、
+\pLaTeX/\upLaTeX{}で動作するソースと通常の\LaTeX{}ソースの
+見た目を近づけることができます。
+
+このパッケージはGitHubで開発しています。
+\begin{verbatim}
+ https://github.com/aminophen/plautopatch
+\end{verbatim}
+
+\section*{動作条件}
+
+\LaTeXe~2020-10-01以降の場合は、
+カーネルが提供するフックシステムの
+\verb+\AddToHook{package/.../before}+及び
+\verb+\AddToHook{package/.../after}+を利用します。
+\LaTeXe{}が古い場合は、
+\textsf{filehook}パッケージ(Martin Scharrer氏の作)に依存します。
+
+\section*{使い方}
+
+このパッケージを\LaTeX{}ソースの冒頭で読み込みます。
+このために、\verb+\RequirePackage{plautopatch}+を
+\verb+\documentclass+や他のコマンドよりも\emph{前}に
+読み込むことをお勧めします
+(クラスファイルなどが問題のあるパッケージを読み込む可能性もあるため)。
+
+例を示します。
+\begin{verbatim}
+ %\RequirePackage{plautopatch}
+ \documentclass{tarticle}% 縦組クラス(plext使用)
+ \usepackage{array}% plextと非互換
+ \begin{document}
+ ...
+ \end{document}
+\end{verbatim}
+上記の例では、
+\textsf{tarticle}クラスが内部で読み込む\textsf{plext}パッケージと、
+ソース中で\verb+\usepackage+している\textsf{array}パッケージが
+衝突してエラーになる場合があります。しかし、冒頭で
+\verb+\RequirePackage{plautopatch}+とだけ書いておけば、
+\textsf{array}パッケージの時点で\textsf{plextarray}パッケージが
+追加で読み込まれるため、問題が解消します。
+このように自動追加されたパッケージは、\verb+\end{document}+の
+時点で次のように一覧として表示されます(複数の場合は
+コンマと空白で区切ったリストになります)。
+\begin{verbatim}
+***** List of packages loaded by `plautopatch': *****
+ plextarray.
+*****************************************************
+\end{verbatim}
+
+\section*{現在対応しているパッケージの一覧}
+
+\def\ITEMoTo#1 (#2) -> #3 (#4){%
+ \item \textsf{#1} (\textsf{#2})\\
+ $\rightarrow$ \textsf{#3} (\textsf{#4})}
+\def\ITEMoTx#1 (#2) -> #3 {%
+ \item \textsf{#1} (\textsf{#2})\\
+ $\rightarrow$ \textsf{#3} }
+\def\ITEMxTo#1 -> #2 (#3){%
+ \item \textsf{#1}\\
+ $\rightarrow$ \textsf{#2} (\textsf{#3})}
+\def\ITEMxTx#1 -> #2 {%
+ \item \textsf{#1}\\
+ $\rightarrow$ \textsf{#2} }
+\def\ITEMooTo#1 (#2) + #3 (#4) -> #5 (#6){%
+ \item \textsf{#1} (\textsf{#2}) + \textsf{#3} (\textsf{#4})\\
+ $\rightarrow$ \textsf{#5} (\textsf{#6})}
+\def\ITEMxoTo#1 + #2 (#3) -> #4 (#5){%
+ \item \textsf{#1} + \textsf{#2} (\textsf{#3})\\
+ $\rightarrow$ \textsf{#4} (\textsf{#5})}
+\def\ITEMxoTx#1 + #2 (#3) -> #4 {%
+ \item \textsf{#1} + \textsf{#2} (\textsf{#3})\\
+ $\rightarrow$ \textsf{#4} }
+
+凡例:
+\begin{itemize}
+\item \texttt{<元のパッケージ>} (\texttt{<元が含まれるバンドル名>})\\
+ \texttt{<パッチのパッケージ>} (\texttt{<パッチが含まれるバンドル名>})
+\end{itemize}
+
+現在のバージョン (\filedate\space\fileversion) がサポートしているのは
+下記のパッケージです。
+\begin{itemize}
+\ITEMoTo doc (latex) -> pldocverb (platex-tools)
+\ITEMoTo tracefnt (latex) -> ptrace/uptrace (platex/uplatex)
+\ITEMoTo fltrace (latex) -> pfltrace (platex)
+\ITEMoTo array (latex-tools) -> plarray (platex-tools)
+\ITEMooTo array (latex-tools) + plext (platex) -> plextarray (platex-tools)
+\ITEMooTo delarray (latex-tools) + plext (platex) -> plextdelarray (platex-tools)
+\ITEMxoTo colortbl + plext (platex) -> plextcolortbl (platex-tools)
+\ITEMxTx arydshln -> plarydshln (maintained here!)
+\ITEMxoTx arydshln + plext (platex) -> plextarydshln (maintained here!)
+\ITEMxTx siunitx -> plsiunitx (maintained here!)
+\ITEMxTx collcell -> plcollcell (maintained here!)
+\ITEMoTo everysel (ms) -> pxeverysel (platex-tools)
+\ITEMoTo everyshi (ms) -> pxeveryshi (platex-tools)
+\ITEMoTo atbegshi (oberdiek) -> pxatbegshi (platex-tools)
+\ITEMoTo ftnright (latex-tools) -> pxftnright (platex-tools)
+\ITEMoTo multicol (latex-tools) -> pxmulticol (platex-tools)
+\ITEMoTo xspace (latex-tools) -> pxxspace (platex-tools)
+\ITEMxTo textpos -> pxtextpos (gentombow)
+\ITEMxTo eso-pic -> pxesopic (gentombow)
+\ITEMxTo pdfpages -> pxpdfpages (gentombow)
+\ITEMoTo stfloats (sttools) -> pxstfloats (pxsttools)
+\ITEMxTx hyperref -> pxjahyper (by Takayuki YATO)
+\ITEMoTx pgfrcs (pgf) -> pxpgfrcs (maintained here!)
+\ITEMoTx pgfcore (pgf) -> pxpgfmark (by Takayuki YATO)
+\end{itemize}
+もちろん、このリストは随時、追加・削除・置き換えていく予定です。
+互換性の問題や追加したいパッケージがある場合はご一報ください。
+
+\section*{特定のパッケージを除外したい場合}
+
+デフォルトでは、上記のリストに登録されている\texttt{<元のパッケージ>}が
+使われたことを検出すると、全て自動的にパッチを読み込みます。
+しかし、時にはこれが逆効果となり、問題が起きる可能性は否定できません。
+そのような場合は
+\begin{verbatim}
+ \plautopatchdisable{<元のパッケージ>}
+\end{verbatim}
+と書くことで、そのパッケージを検出対象から除外します。複数ある場合は
+\begin{verbatim}
+ \plautopatchdisable{<元のパッケージ1>,<元のパッケージ2>}
+\end{verbatim}
+のようにコンマで区切っていくつでも除外できます。
+
+\section*{パッケージ特有の注意}
+
+\begin{itemize}
+ \item \textsf{hyperref}パッケージを使用する場合、パッチを提供する
+ \textsf{pxjahyper}パッケージが\textsf{hyperref}の\emph{直後}に
+ 自動的に読み込まれます。
+ もし\textsf{pxjahyper}パッケージのオプションが必要な場合は、
+ \textsf{hyperref}より前に
+ \verb+\PassOptionsToPackage{...}{pxjahyper}+
+ と書くことでオプション衝突のエラーを避けてください(とはいっても、
+ \textsf{pxjahyper}はデフォルトの設定でほとんどの場合に
+ 完璧に動作するため、ほとんど必要ないでしょう)。
+\end{itemize}
+
+\section*{変更履歴}
+
+\begin{itemize}
+ \item 2018/08/21 v0.2 最初のCTANリリース版
+ \item 2018/08/22 v0.3 元パッケージ検出の改良
+ \item 2018/09/21 v0.5 \textsf{colortbl}と\textsf{pgf}もサポート
+ \item 2018/10/02 v0.6 \textsf{arydshln}のサポート
+ \item 2018/10/27 v0.8 \textsf{everysel}サポートの改良
+ \item 2018/11/03 v0.9 \textsf{siunitx}のサポート
+ \item 2018/11/25 v0.9b \textsf{multicol}と\textsf{doc}のサポート
+ \item 2019/06/06 v0.9c \textsf{siunitx}のパッチ改良
+ \item 2019/09/05 v0.9d \textsf{xspace}と\textsf{stfloats}のサポート
+ \item 2020/02/25 v0.9e \textsf{textpos}のサポート
+ \item 2020/05/05 v0.9f \textsf{collcell}のサポート
+ \item 2020/05/25 v0.9g \textsf{pxjahyper}の自動読込
+ \item 2020/09/13 v0.9h \LaTeXe~2020-10-01では\textsf{filehook}非依存に
+ \item 2020/09/25 v0.9i \textsf{pxeveryshi}と\textsf{pxatbegshi}を不要に(\LaTeXe~2020-10-01対応)
+ \item 2020/09/27 v0.9j \textsf{eso-pic}のサポート(要\LaTeXe~2020-10-01)
+ \item 2020/10/14 v0.9k トンボ関連パッチを\textsf{gentombow}へ移動
+ \item 2020/10/21 v0.9l \verb+\plautopatchdisable+が機能しなかったバグを修正
+ \item 2020/11/26 v0.9m \textsf{pgf}最新版に追随
+ \item 2021/02/13 v0.9n \textsf{pxeverysel}を不要に(\LaTeXe{}開発版対応)
+ \item 2021/05/15 v0.9o \textsf{pxjahyper}の読込を遅延させない
+ \item 2021/05/31 v0.9p \LaTeXe~2021-06-01への準備
+ \item 2021/12/07 v0.9q \LaTeXe~2021-11-15への対応
+\end{itemize}
+
+\end{document}
diff --git a/macros/jptex/latex/plautopatch/plautopatch.pdf b/macros/jptex/latex/plautopatch/plautopatch.pdf
new file mode 100644
index 0000000000..cf34cc14b9
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plautopatch.pdf
Binary files differ
diff --git a/macros/jptex/latex/plautopatch/plautopatch.sty b/macros/jptex/latex/plautopatch/plautopatch.sty
new file mode 100644
index 0000000000..347dc2f0a2
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plautopatch.sty
@@ -0,0 +1,271 @@
+%
+% plautopatch.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+
+\NeedsTeXFormat{LaTeX2e}% not pLaTeX2e on purpose!
+\ProvidesPackage{plautopatch}
+ [2021/12/07 v0.9q Automated patches for pLaTeX/upLaTeX]
+
+\ifx\pfmtname\@undefined
+ \PackageInfo{plautopatch}{%
+ This package is meant for pLaTeX/upLaTeX,\MessageBreak
+ you will not need it.}
+ \expandafter\endinput
+\fi
+
+\NeedsTeXFormat{pLaTeX2e}% just in case ...
+\def\platpc@pkgname{plautopatch}
+\def\platpc@err{\PackageError\platpc@pkgname}
+\def\platpc@warn{\PackageWarningNoLine\platpc@pkgname}
+\def\platpc@info{\PackageInfo\platpc@pkgname}
+\let\platpc@debug\@gobble
+%\def\platpc@debug#1{\typeout{\platpc@pkgname: [DEBUG] #1}}% for debug
+
+%% Since LaTeX2e 2020-10-01, most of features in filehook.sty
+%% is available in ltfilehook.dtx.
+%% The new code defines \declare@file@substitution,
+%% so we can detect it!
+
+\ifx\declare@file@substitution\@undefined
+ % LaTeX2e 2020-02-02 PL5 or older
+ \RequirePackage{filehook}
+ \let\platpc@ExecuteAfterPackage=\AtEndOfPackageFile
+ \let\platpc@ExecuteBeforePackage=\AtBeginOfPackageFile
+\else\ifx\ActivateGenericHook\@undefined
+ % between LaTeX2e 2020-10-01 and LaTeX2e 2021-11-15
+ \def\platpc@ExecuteAfterPackage#1{\AddToHook{package/after/#1}}
+ \def\platpc@ExecuteBeforePackage#1{\AddToHook{package/before/#1}}
+\else
+ % LaTeX2e 2021-11-15 or newer
+ \def\platpc@ExecuteAfterPackage#1{\AddToHook{package/#1/after}}
+ \def\platpc@ExecuteBeforePackage#1{\AddToHook{package/#1/before}}
+\fi\fi
+
+% low-level helpers
+
+%% \platpc@ifreq@add{<package>}
+% = if not loaded yet, \RequirePackage{<package>}
+% and add to list.
+\def\platpc@ifreq@add#1{%
+ \@ifpackageloaded{#1}{}{%
+ \RequirePackage{#1}\platpc@addtolist{#1}%
+ }%
+}
+
+%% \platpc@addtolist{<package>}
+% = add <package> to list named \platpc@list.
+\def\platpc@addtolist#1{\xdef\platpc@list{\platpc@list, #1}}
+\def\platpc@list{}% initialize
+
+%% \platpc@ifnotdisabled{<package>}{<code>}
+% = execute <code> if <package> is not disabled.
+\def\platpc@ifnotdisabled#1{%
+ \expandafter\ifx\csname platpc@disable@#1\endcsname\relax
+ \expandafter\@firstofone
+ \else
+ \platpc@debug{Patch for #1 is disabled, not applying}%
+ \expandafter\@gobble
+ \fi
+}
+
+%% \platpc@err@toolate{<package>}
+% = content of the "too-late" error.
+\def\platpc@err@toolate#1{%
+ \platpc@err{Package `#1' already loaded!\MessageBreak
+ Use \string\RequirePackage{\platpc@pkgname} earlier}\@ehc
+}
+
+% high-level helpers
+
+%% \platpc@patch@after{<orig>}{<patch>}
+% = Load <patch> after <orig>.
+\def\platpc@patch@after#1#2{%
+ \expandafter\def\csname platpc@end@#1\endcsname{%
+ \platpc@ifnotdisabled{#1}{\platpc@ifreq@add{#2}}%
+ }%
+ \@ifpackageloaded{#1}{%
+ \csname platpc@end@#1\endcsname
+ }{%
+ \platpc@ExecuteAfterPackage{#1}{\csname platpc@end@#1\endcsname}%
+ }%
+}
+\@onlypreamble\platpc@patch@after
+
+%% \platpc@patch@after@both{<orig 1>}{<orig 2>}{<patch>}
+% = Load <patch> after both <orig 1> & <orig 2>.
+\def\platpc@patch@after@both#1#2#3{%
+ \expandafter\def\csname platpc@end@#1+#2\endcsname{%
+ \platpc@ifnotdisabled{#1}{\platpc@ifnotdisabled{#2}{%
+ \platpc@ifreq@add{#3}%
+ }}%
+ }%
+ \@ifpackageloaded{#1}{%
+ \@ifpackageloaded{#2}{%
+ \csname platpc@end@#1+#2\endcsname
+ }{%
+ \platpc@ExecuteAfterPackage{#2}{\csname platpc@end@#1+#2\endcsname}%
+ }%
+ }{%
+ \@ifpackageloaded{#2}{%
+ \platpc@ExecuteAfterPackage{#1}{\csname platpc@end@#1+#2\endcsname}%
+ }{%
+ \platpc@ExecuteAfterPackage{#1}{%
+ \@ifpackageloaded{#2}{\csname platpc@end@#1+#2\endcsname}{}%
+ }%
+ \platpc@ExecuteAfterPackage{#2}{%
+ \@ifpackageloaded{#1}{\csname platpc@end@#1+#2\endcsname}{}%
+ }%
+ }%
+ }%
+}
+\@onlypreamble\platpc@patch@after@both
+
+%% \platpc@patch@before{<orig>}{<patch>}
+% = Load <patch> before <orig>.
+% used when both conditions are met:
+% - <patch> must be loaded *before* <orig>
+% - <patch> contains \RequirePackage{<orig>}
+\def\platpc@patch@before#1#2{%
+ \expandafter\def\csname platpc@begin@#1\endcsname{%
+ \platpc@ifnotdisabled{#1}{%
+ % if <patch> is already loaded, nothing to do
+ \@ifpackageloaded{#2}{}{% else
+ % the code (*!) should be used only once,
+ % remove it immediately when this macro is executed
+ \expandafter\let\csname platpc@begin@#1\endcsname\relax
+ % pretend as if <orig> not loaded
+ \expandafter\let\csname ver@#1.sty\endcsname\relax
+ % load the <patch> package
+ \RequirePackage{#2}\platpc@addtolist{#2}%
+ % avoid loading <orig> twice by discarding "\@@input <orig>" (*!)
+ \platpc@discard@input{#1}%
+ % all done
+ }%
+ }%
+ }%
+ % if <orig> is already loaded at this point, too late!
+ \@ifpackageloaded{#1}{%
+ \platpc@err@toolate{#1}%
+ }{% else
+ \platpc@ExecuteBeforePackage{#1}{\csname platpc@begin@#1\endcsname}%
+ }%
+}
+\@onlypreamble\platpc@patch@before
+
+\ifx\declare@file@substitution\@undefined
+ % LaTeX2e 2020-02-02 PL5 or older
+ \def\platpc@discard@input#1{%
+ \let\platpc@filehook@@atbegin\filehook@@atbegin
+ \def\filehook@@atbegin\@@input##1\filehook@atend{%
+ \let\filehook@@atbegin\platpc@filehook@@atbegin
+ % avoid infinite loop even when \AtEndOfPackageFile used
+ \expandafter\let\csname filehook@atend@#1.sty\endcsname\relax
+ \filehook@@atbegin
+ \filehook@atend}}
+\else
+ % LaTeX2e 2020-10-01 or newer
+ \def\platpc@discard@input#1{%
+ \let\platpc@InputIfFileExists\InputIfFileExists
+ \def\InputIfFileExists##1##2##3{%
+ \let\InputIfFileExists\platpc@InputIfFileExists}}
+\fi
+\@onlypreamble\platpc@discard@input
+
+% interface for users who want don't patches
+
+%% \plautopatchdisable{<orig 1>,<orig 2>,...}
+% = Disable patches triggered by <orig 1>, <orig 2>, ...
+\newcommand{\plautopatchdisable}[1]{%
+ \edef\@tempa{\zap@space#1 \@empty}%
+ \@for\@tempa:=\@tempa\do{%
+ \expandafter\let\csname platpc@disable@\@tempa\endcsname\@empty
+ \platpc@debug{Disabled patch for #1}%
+ }%
+}
+\@onlypreamble\plautopatchdisable
+
+% show list of loaded patches
+
+\AtEndDocument{\platpc@showlist}
+\def\platpc@showlist{%
+ \ifx\platpc@list\@empty
+ \platpc@info{No additional packages loaded}
+ \else
+ % the first token of \platpc@list should be ','
+ \typeout{%
+ ***** List of packages loaded by `\platpc@pkgname': *****^^J%
+ \expandafter\@gobble\platpc@list.^^J%
+ *****************************************************}%
+ \fi
+}
+
+% register patches
+
+\platpc@patch@after{doc}{pldocverb}% platex-tools
+\ifx\enablecjktoken\@undefined
+ \platpc@patch@after{tracefnt}{ptrace}% platex
+\else
+ \platpc@patch@after{tracefnt}{uptrace}% uplatex
+\fi
+\platpc@patch@after{fltrace}{pfltrace}% platex
+\platpc@patch@after{array}{plarray}% platex-tools
+\platpc@patch@after@both{array}{plext}{plextarray}% platex-tools
+\platpc@patch@after@both{delarray}{plext}{plextdelarray}% platex-tools
+\platpc@patch@after@both{colortbl}{plext}{plextcolortbl}% platex-tools
+\platpc@patch@after{arydshln}{plarydshln}% (maintained here!)
+\platpc@patch@after@both{arydshln}{plext}{plextarydshln}% (maintained here!)
+\platpc@patch@after{siunitx}{plsiunitx}% (maintained here!)
+\platpc@patch@after{collcell}{plcollcell}% (maintained here!)
+% --- in most cases, pxeverysel can be safely loaded even after everysel
+% --- but it can fail when \AtBeginDocument{everysel} is involved
+% --- [Update] since LaTeX2e 2021-06-01, everysel.sty is merely
+% --- an emulation by everysel-ltx.sty from firstaid,
+% --- which is supported by pLaTeX2e kernel natively
+\@ifl@t@r{\fmtversion}{2021/06/01}{}%
+ {\platpc@patch@before{everysel}{pxeverysel}}% platex-tools
+% --- [Update] since LaTeX2e 2020-10-01, everyshi.sty is merely
+% --- an emulation by everyshi-ltx.sty from ltshipout.dtx,
+% --- which is supported by pLaTeX2e kernel natively
+\@ifl@t@r{\fmtversion}{2020/10/01}{}%
+ {\platpc@patch@after{everyshi}{pxeveryshi}}% platex-tools
+% --- [Update] since LaTeX2e 2020-10-01, atbegshi.sty is merely
+% --- an emulation by atbegshi-ltx.sty from ltshipout.dtx,
+% --- which is supported by pLaTeX2e kernel natively
+\@ifl@t@r{\fmtversion}{2020/10/01}{}%
+ {\platpc@patch@after{atbegshi}{pxatbegshi}}% platex-tools
+\platpc@patch@before{ftnright}{pxftnright}% platex-tools
+\platpc@patch@after{multicol}{pxmulticol}% platex-tools
+\platpc@patch@after{xspace}{pxxspace}% platex-tools
+\platpc@patch@after{textpos}{pxtextpos}% gentombow
+% --- until LaTeX2e 2020-10-01, patching eso-pic automatically
+% --- is not supported by pxesopic
+\@ifl@t@r{\fmtversion}{2020/10/01}%
+ {\platpc@patch@before{eso-pic}{pxesopic}}{}% gentombow
+\platpc@patch@after{pdfpages}{pxpdfpages}% gentombow
+\platpc@patch@before{stfloats}{pxstfloats}% pxsttools -- (!!)
+% --- in most cases, pxjahyper works without explicit options
+% --- however, in case a user specifies some, option clash will happen
+% --- [Note] if \AtBeginDocument{\usepackage{hyperref}} appears,
+% ---- writing to \jobname.out (= 'jacommentline' feature)
+% ---- does not work because it's too late.
+\platpc@patch@after{hyperref}{pxjahyper}% by Takayuki YATO (ZR)
+
+% for TikZ/PGF
+\platpc@patch@after{pgfrcs}{pxpgfrcs}% (maintained here!)
+% --- pxpgfmark is useful on e-(u)pTeX + dvipdfmx
+% --- but does no harm for other conditions
+% --- [Update] pgf 2019-01-05 v3.1 (with \gdef\pgfversion{3.1})
+% ---- already supports inter-picture connections
+% ---- so pxpgfmark is no longer required
+\platpc@patch@after{pgfcore}{pxpgfmark}% by Takayuki YATO (ZR)
+
+% special case, mainly for problematic packages
+% --- mdwtab forbids loading array
+% --- so plarray should also be forbidden
+\platpc@ExecuteAfterPackage{mdwtab}{\@namedef{ver@plarray.sty}{}}
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/plautopatch.tex b/macros/jptex/latex/plautopatch/plautopatch.tex
new file mode 100644
index 0000000000..7a1693adda
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plautopatch.tex
@@ -0,0 +1,197 @@
+%# -*- coding: utf-8 -*-
+\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016)
+ \epTeXinputencoding utf8 % ensure utf-8 encoding for platex
+\fi
+
+\documentclass[a4paper,dvipdfmx,english]{jsarticle}
+\usepackage{doc}
+\xspcode"5C=3 % \
+\xspcode"3C=3 % <
+\xspcode"3E=3 % >
+\usepackage{plautopatch}% load this here to make \GetFileInfo work
+\GetFileInfo{plautopatch.sty}
+\title{Package \textsf{plautopatch} \fileversion}
+\author{Hironobu Yamashita}
+\date{\filedate}
+\begin{document}
+
+\maketitle
+
+Japanese \pLaTeX/\upLaTeX\ formats and packages often conflict
+with other \LaTeX\ packages which are unaware of \pLaTeX/\upLaTeX.
+In the worst case, such packages throw a fatal error or
+end up with a wrong output.
+
+The goal of this package \textsf{plautopatch} is that
+there should be no need to worry about such incompatibilities,
+because specific patches are loaded automatically
+whenever necessary.
+This helps not only to simplify source files, but also
+to make the appearance of working \pLaTeX/\upLaTeX\ sources
+similar to those of ordinary \LaTeX\ ones.
+
+The package is maintained on GitHub:
+\begin{verbatim}
+ https://github.com/aminophen/plautopatch
+\end{verbatim}
+
+\section*{Requirements}
+
+If \LaTeXe~2020-10-01 or newer is running,
+this package uses the new hook system such as
+\verb+\AddToHook{package/.../before}+ and
+\verb+\AddToHook{package/.../after}+.
+If \LaTeXe\ is older than that, this package depends on
+\textsf{filehook} package (written by Martin Scharrer).
+
+\section*{Usage}
+
+Load this package at the very beginning of the \LaTeX\ source.
+It is strongly recommended to use
+\verb+\RequirePackage{plautopatch}+
+before \verb+\documentclass+ or any other commands,
+as such other classes and packages may load
+some problematic packages internally.
+
+Here is an example:
+\begin{verbatim}
+ %\RequirePackage{plautopatch}
+ \documentclass{tarticle}% vertical writing (requires plext)
+ \usepackage{array}% incompatible with plext
+ \begin{document}
+ ...
+ \end{document}
+\end{verbatim}
+In the above example, the class \textsf{tarticle} internally
+requires the package \textsf{plext}.
+However, \textsf{array} explicitly required by \verb+\usepackage+
+conflicts with \textsf{plext}.
+By using \verb+\RequirePackage{plautopatch}+,
+\textsf{plextarray} is automatically loaded and the problem goes.
+The list of automatically-loaded packages is shown at
+\verb+\end{document}+:
+\begin{verbatim}
+***** List of packages loaded by `plautopatch': *****
+ plextarray.
+*****************************************************
+\end{verbatim}
+When multiple packages are loaded, they are all printed
+as a list separated by commas and spaces.
+
+\section*{List of currently available patches}
+
+\def\ITEMoTo#1 (#2) -> #3 (#4){%
+ \item \textsf{#1} (\textsf{#2})\\
+ $\rightarrow$ \textsf{#3} (\textsf{#4})}
+\def\ITEMoTx#1 (#2) -> #3 {%
+ \item \textsf{#1} (\textsf{#2})\\
+ $\rightarrow$ \textsf{#3} }
+\def\ITEMxTo#1 -> #2 (#3){%
+ \item \textsf{#1}\\
+ $\rightarrow$ \textsf{#2} (\textsf{#3})}
+\def\ITEMxTx#1 -> #2 {%
+ \item \textsf{#1}\\
+ $\rightarrow$ \textsf{#2} }
+\def\ITEMooTo#1 (#2) + #3 (#4) -> #5 (#6){%
+ \item \textsf{#1} (\textsf{#2}) + \textsf{#3} (\textsf{#4})\\
+ $\rightarrow$ \textsf{#5} (\textsf{#6})}
+\def\ITEMxoTo#1 + #2 (#3) -> #4 (#5){%
+ \item \textsf{#1} + \textsf{#2} (\textsf{#3})\\
+ $\rightarrow$ \textsf{#4} (\textsf{#5})}
+\def\ITEMxoTx#1 + #2 (#3) -> #4 {%
+ \item \textsf{#1} + \textsf{#2} (\textsf{#3})\\
+ $\rightarrow$ \textsf{#4} }
+
+The legend:
+\begin{itemize}
+\item \texttt{<original package>} (\texttt{<bundle name of original package>})\\
+ \texttt{<patch package>} (\texttt{<bundle name of patch package>})
+\end{itemize}
+
+Current version (\filedate\space\fileversion) supports the followings:
+\begin{itemize}
+\ITEMoTo doc (latex) -> pldocverb (platex-tools)
+\ITEMoTo tracefnt (latex) -> ptrace/uptrace (platex/uplatex)
+\ITEMoTo fltrace (latex) -> pfltrace (platex)
+\ITEMoTo array (latex-tools) -> plarray (platex-tools)
+\ITEMooTo array (latex-tools) + plext (platex) -> plextarray (platex-tools)
+\ITEMooTo delarray (latex-tools) + plext (platex) -> plextdelarray (platex-tools)
+\ITEMxoTo colortbl + plext (platex) -> plextcolortbl (platex-tools)
+\ITEMxTx arydshln -> plarydshln (maintained here!)
+\ITEMxoTx arydshln + plext (platex) -> plextarydshln (maintained here!)
+\ITEMxTx siunitx -> plsiunitx (maintained here!)
+\ITEMxTx collcell -> plcollcell (maintained here!)
+\ITEMoTo everysel (ms) -> pxeverysel (platex-tools)
+\ITEMoTo everyshi (ms) -> pxeveryshi (platex-tools)
+\ITEMoTo atbegshi (oberdiek) -> pxatbegshi (platex-tools)
+\ITEMoTo ftnright (latex-tools) -> pxftnright (platex-tools)
+\ITEMoTo multicol (latex-tools) -> pxmulticol (platex-tools)
+\ITEMoTo xspace (latex-tools) -> pxxspace (platex-tools)
+\ITEMxTo textpos -> pxtextpos (gentombow)
+\ITEMxTo eso-pic -> pxesopic (gentombow)
+\ITEMxTo pdfpages -> pxpdfpages (gentombow)
+\ITEMoTo stfloats (sttools) -> pxstfloats (pxsttools)
+\ITEMxTx hyperref -> pxjahyper (by Takayuki YATO)
+\ITEMoTx pgfrcs (pgf) -> pxpgfrcs (maintained here!)
+\ITEMoTx pgfcore (pgf) -> pxpgfmark (by Takayuki YATO)
+\end{itemize}
+Note that, of course, the list may be adjusted
+(addition, deletion or replacement)
+in the future to get the expected result.
+Feel free to report some compatibility issue or request changes!
+
+\section*{Disabling a specific patch}
+
+By default, \texttt{<patch package>} is automatically loaded when
+\texttt{<original package>} is detected, following the whole list.
+However, there is still a possibility of another regression issue.
+In that case, you can disable the detection of
+\texttt{<original package>} by using the command:
+\begin{verbatim}
+ \plautopatchdisable{<original package>}
+\end{verbatim}
+If you want to disable multiple packages, you can give
+a comma-separated list of them:
+\begin{verbatim}
+ \plautopatchdisable{<original package 1>,<original package 2>}
+\end{verbatim}
+
+\section*{Package-specific notice}
+
+\begin{itemize}
+ \item If you use the \textsf{hyperref} package, the patch package
+ \textsf{pxjahyper} is loaded \emph{immediately} after \textsf{hyperref}.
+ If you need some explicit options of \textsf{pxjahyper} (though
+ it should be rare enough because it works almost perfectly without those),
+ you should write \verb+\PassOptionsToPackage{...}{pxjahyper}+
+ before \textsf{hyperref} to avoid an option clash.
+\end{itemize}
+
+\section*{Change History}
+
+\begin{itemize}
+ \item 2018/08/21 v0.2 First CTAN release
+ \item 2018/08/22 v0.3 Improve detection of problematic packages
+ \item 2018/09/21 v0.5 Add support for \textsf{colortbl} and \textsf{pgf}
+ \item 2018/10/02 v0.6 Add support for \textsf{arydshln}
+ \item 2018/10/27 v0.8 Better support for \textsf{everysel}
+ \item 2018/11/03 v0.9 Add support for \textsf{siunitx}
+ \item 2018/11/25 v0.9b Add support for \textsf{multicol} and \textsf{doc}
+ \item 2019/06/06 v0.9c Update patch for \textsf{siunitx}
+ \item 2019/09/05 v0.9d Add support for \textsf{xspace} and \textsf{stfloats}
+ \item 2020/02/25 v0.9e Add support for \textsf{textpos}
+ \item 2020/05/05 v0.9f Add support for \textsf{collcell}
+ \item 2020/05/25 v0.9g Automatically load \textsf{pxjahyper}
+ \item 2020/09/13 v0.9h No dependency for \textsf{filehook} on \LaTeXe~2020-10-01
+ \item 2020/09/25 v0.9i Do not require \textsf{pxeveryshi} and \textsf{pxatbegshi} on \LaTeXe~2020-10-01
+ \item 2020/09/27 v0.9j Add support for \textsf{eso-pic} (\LaTeXe~2020-10-01 required)
+ \item 2020/10/14 v0.9k Move tombow-related patches to \textsf{gentombow}
+ \item 2020/10/21 v0.9l Bug fix for \verb+\plautopatchdisable+
+ \item 2020/11/26 v0.9m Adapt to latest \textsf{pgf}
+ \item 2021/02/13 v0.9n Do not require \textsf{pxeverysel} on \LaTeXe~develop
+ \item 2021/05/15 v0.9o Do not delay \textsf{pxjahyper} loading
+ \item 2021/05/31 v0.9p Prepare for \LaTeXe~2021-06-01
+ \item 2021/12/07 v0.9q Adjust for \LaTeXe~2021-11-15
+\end{itemize}
+
+\end{document}
diff --git a/macros/jptex/latex/plautopatch/plcollcell.sty b/macros/jptex/latex/plautopatch/plcollcell.sty
new file mode 100644
index 0000000000..cee4efba27
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plcollcell.sty
@@ -0,0 +1,199 @@
+%
+% plcollcell.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+% This package is expected to be compatible with
+% * collcell.sty
+% (2011/02/27 v0.5)
+% * plarray.sty in platex-tools
+% (2018/03/12 v0.1e -- 2018/10/27 v0.1h)
+%
+
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{plcollcell}
+ [2020/05/05 v0.1 Tabular extension package for pLaTeX/upLaTeX]
+\RequirePackageWithOptions{collcell}
+\RequirePackage{plarray}% collcell.sty requires array.sty
+
+%% code from plarray.sty (for pLaTeX2e 2018/03/09 or later)
+\def\plclcl@insert@column{%
+ \the@toks \the \@tempcnta
+ \relax \pltx@next@inhibitglue
+ \ignorespaces \@sharp \unskip \removejfmglue
+ \the@toks \the \count@ \relax}
+% -- check
+\ifx\insert@column\plclcl@insert@column\else
+ \PackageWarningNoLine{pxcollcell}
+ {Patch to \noexpand\collectcell unsupported}
+ \expandafter\endinput
+\fi \let\plclcl@insert@column\@undefined
+
+%% \plclcl@patch@cmd\CMD{<orig>}{<new>}
+\@onlypreamble\plclcl@patch@cmd
+\def\plclcl@patch@cmd#1#2#3{%
+ \def\plclcl@next##1#2##2\plclcl@mark##3\plclcl@fin{%
+ \ifx\plclcl@mark##3\plclcl@mark
+ \let\plclcl@fragment\relax
+ \else
+ \def\plclcl@fragment{##2}%
+ \def#1{##1#3##2}%
+ \fi}%
+ \expandafter\plclcl@next#1\plclcl@mark#2\plclcl@mark\plclcl@fin}
+% -- prepend (TODO: \kern0pt enables \inhibitglue effect. why?)
+\plclcl@patch@cmd\collcell@beforeuser
+ {\ignorespaces}
+ {\kern0pt\inhibitglue\ignorespaces}
+\ifx\plclcl@fragment\relax
+ \PackageWarningNoLine{pxcollcell}
+ {Patch to \noexpand\collcell@beforeuser failed}
+\fi
+
+%% code from collcell.sty
+\def\plclcl@collectcell#1#2\ignorespaces{%
+ \begingroup
+ \collect@cell@count\z@
+ \collect@cell@toks{}%
+ \let\collect@cell@spaces\empty
+ \def\collect@cell@end{%
+ \expandafter\endgroup
+ \expandafter\collcell@beforeuser
+ \expandafter\ccell@swap\expandafter{\the\collect@cell@toks}{#1}%
+ \collcell@afteruser
+ }%
+ \collect@cell@look#2%
+}
+% -- check
+\ifx\collectcell\plclcl@collectcell\else
+ \PackageWarningNoLine{pxcollcell}
+ {Patching \noexpand\collect@cell@arg but maybe unsafe}
+\fi \let\plclcl@collectcell\@undefined
+% -- redefine to skip \relax\pltx@next@inhibitglue
+\def\collectcell#1#2\relax\pltx@next@inhibitglue\ignorespaces{%
+ \begingroup
+ \collect@cell@count\z@
+ \collect@cell@toks{}%
+ \let\collect@cell@spaces\empty
+ \def\collect@cell@end{%
+ \expandafter\endgroup
+ \expandafter\collcell@beforeuser
+ \expandafter\ccell@swap\expandafter{\the\collect@cell@toks}{#1}%
+ \collcell@afteruser
+ }%
+ \collect@cell@look#2%
+}
+
+%% code from collcell.sty
+\def\plclcl@collect@cell@arg#1{%
+ \cc@case
+ \\{\collect@cell@cr#1}%
+ \end{\collect@cell@checkend}%
+ \csname{\collect@cell@checkcsname}%
+ \unskip{%
+ \let\collect@cell@spaces\empty
+ %\collect@cell@addarg{#1}% do not include the \unskip
+ \collect@cell@look%
+ }%
+ \@sharp{%
+ \expandafter\collect@cell@addarg\expandafter{#1}%
+ \collect@cell@look
+ }%
+ \collectcell{%
+ \advance\collect@cell@count by \@ne
+ \collect@cell@addcc%
+ }%
+ \endcollectcell{%
+ \ifnum\collect@cell@count=\z@
+ \expandafter\collect@cell@end
+ \else
+ \expandafter\endgroup
+ \expandafter\collect@cell@addarg\expandafter
+ {\expandafter{\the\collect@cell@toks}}%
+ \advance\collect@cell@count by \m@ne%
+ \expandafter\collect@cell@look
+ \fi
+ }%
+ \cci{%
+ \collect@cell@look
+ }%
+ \default{%
+ \expandafter\ccell@swap\expandafter
+ {\csname endtabular*\endcsname\endtabular\endarray}{\in@{#1}}%
+ \ifin@
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ {\collect@cell@cr\\#1}%
+ {%
+ \collect@cell@addarg{#1}%
+ \collect@cell@look
+ }%
+ }%
+ \endcc@case
+}
+% -- check
+\ifx\collect@cell@arg\plclcl@collect@cell@arg\else
+ \PackageWarningNoLine{pxcollcell}
+ {Patching \noexpand\collect@cell@arg but maybe unsafe}
+\fi \let\plclcl@collect@cell@arg\@undefined
+% -- redefine to skip \removejfmglue
+\def\collect@cell@arg#1{%
+ \cc@case
+ \\{\collect@cell@cr#1}%
+ \end{\collect@cell@checkend}%
+ \csname{\collect@cell@checkcsname}%
+ \unskip{%
+ \let\collect@cell@spaces\empty
+ %\collect@cell@addarg{#1}% do not include the \unskip
+ \collect@cell@look%
+ }%
+ \@sharp{%
+ \expandafter\collect@cell@addarg\expandafter{#1}%
+ \collect@cell@look
+ }%
+ \collectcell{%
+ \advance\collect@cell@count by \@ne
+ \collect@cell@addcc%
+ }%
+ \endcollectcell{%
+ \ifnum\collect@cell@count=\z@
+ \expandafter\collect@cell@end
+ \else
+ \expandafter\endgroup
+ \expandafter\collect@cell@addarg\expandafter
+ {\expandafter{\the\collect@cell@toks}}%
+ \advance\collect@cell@count by \m@ne%
+ \expandafter\collect@cell@look
+ \fi
+ }%
+ \cci{%
+ \collect@cell@look
+ }%
+ %%% BEGIN
+ \removejfmglue{%
+ \collect@cell@look
+ }%
+ %%% END
+ \default{%
+ \expandafter\ccell@swap\expandafter
+ {\csname endtabular*\endcsname\endtabular\endarray}{\in@{#1}}%
+ \ifin@
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ {\collect@cell@cr\\#1}%
+ {%
+ \collect@cell@addarg{#1}%
+ \collect@cell@look
+ }%
+ }%
+ \endcc@case
+}
+
+%% all done
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/plextarydshln.sty b/macros/jptex/latex/plautopatch/plextarydshln.sty
new file mode 100644
index 0000000000..89a019e639
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plextarydshln.sty
@@ -0,0 +1,60 @@
+%
+% plextarydshln.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+% This package is expected to be compatible with
+% * arydshln.sty
+% (2004/08/31 v1.71 -- 2019/02/21 v1.76)
+% * plext.sty in platex
+% (2001/09/26 v1.2 -- 2020/10/07 v1.2m)
+%
+
+%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{plextarydshln}
+ [2018/10/20 v0.4 Merge plext and arydshln]
+\RequirePackage{plext}
+\RequirePackage{plarydshln}
+
+%% handle package compatibility issues beforehand
+% Note: The "arydshln" manual requests users to load
+% the following packages *before* arydshln,
+% to ensure compatibility:
+% array, longtable, colortab, colortbl.
+% So, hoping that users are clever enough to load
+% them before plextarydshln, load known patches
+% at this point when they are detected.
+\@ifpackageloaded{array}{\RequirePackage{plextarray}}{}
+\@ifpackageloaded{colortbl}{\RequirePackage{plextcolortbl}}{}
+% Note: The following package is not necessarily loaded
+% before arydshln; but handle the incompatibility
+% if loaded before plextarydshln.
+\@ifpackageloaded{delarray}{\RequirePackage{plextdelarray}}{}
+
+%% patching internal code for arydshln.sty and plext.sty
+%
+\let\adl@p@array\p@array
+\def\p@array{\adl@everyvbox\everyvbox
+ \everyvbox{\adl@arrayinit \the\adl@everyvbox \everyvbox\adl@everyvbox}%
+ \ifadl@inactive \adl@inactivate \else \adl@activate \fi
+ \let\adl@noalign\noalign
+ \adl@p@array}
+\def\endarray{\adl@endarray \egroup \adl@arrayrestore \egroup
+ \@end@alignbox \csname @arrayright\endcsname}
+%
+%% done
+
+%% compatibility with colortbl.sty
+%
+\@ifpackageloaded{colortbl}{\@firstofone}{\@gobble}
+{% = colortbl.sty loaded
+\def\endarray{\adl@endarray \egroup \adl@arrayrestore \CT@end \egroup
+ \@end@alignbox \csname @arrayright\endcsname}%
+}% =
+%
+%% done
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/plsiunitx.sty b/macros/jptex/latex/plautopatch/plsiunitx.sty
new file mode 100644
index 0000000000..f4041287d5
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/plsiunitx.sty
@@ -0,0 +1,71 @@
+%
+% plsiunitx.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+% (mostly based on lltjp-siunitx.sty 2019-06-06)
+%
+% This package is expected to be compatible with
+% * siunitx.sty
+% (????/??/?? v?.?? -- 2018/05/17 v2.7s)
+% * plarray.sty in platex-tools
+% (2018/03/01 v0.1d -- 2018/10/27 v0.1h)
+%
+
+%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{plsiunitx}
+ [2019/06/06 v0.3 siunitx package for pLaTeX/upLaTeX]
+\RequirePackageWithOptions{siunitx}
+\RequirePackage{plarray}% siunitx requires array
+
+\ExplSyntaxOn
+
+%% patching internal code for siunitx.sty
+%
+%% inhibit JFM glue around tabular cell components (pLaTeX2e 2018/03/09)
+\@ifl@t@r{\pfmtversion}{2017/07/29}{\@firstofone}{\@gobble}
+{% = for pLaTeX2e 2017/07/29 or newer
+%
+%% new table column: S and s
+\bool_new:N \l__platpc_siunitx_table_collect_relax_bool
+\cs_set_protected:Npn \__siunitx_table_collect_begin_s: {
+ \bool_set_false:N \l__platpc_siunitx_table_collect_relax_bool
+ \cs_set_eq:NN \__siunitx_table_collect_token:N
+ \__siunitx_table_collect_token_s:N
+ \cs_set_eq:NN \__siunitx_table_print: \__siunitx_table_print_s:
+ \__siunitx_table_collect_init_s:
+ \__siunitx_table_collect_get:
+}
+%
+\@ifpackageloaded{mdwtab}{}{%
+ \cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1
+ {
+ \token_if_eq_meaning:NNTF #1 \tex_relax:D {
+ \bool_if:NTF \l__platpc_siunitx_table_collect_relax_bool {
+ \__siunitx_table_collect_not_braced_aux_i:N #1
+ } {
+ \bool_set_true:N \l__platpc_siunitx_table_collect_relax_bool
+ }
+ } {
+ \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue {
+ \token_if_eq_meaning:NNF #1 \removejfmglue {
+ \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
+ {
+ \token_if_eq_meaning:NNF #1 \tex_unskip:D
+ { \__siunitx_table_collect_not_braced_aux_i:N #1 }
+ }
+ }}
+ }
+ \__siunitx_table_collect_next:
+ }
+ }
+%
+}% =
+%
+%% done
+
+\ExplSyntaxOff
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/pxpgfrcs.sty b/macros/jptex/latex/plautopatch/pxpgfrcs.sty
new file mode 100644
index 0000000000..38d72273ca
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/pxpgfrcs.sty
@@ -0,0 +1,50 @@
+%
+% pxpgfrcs.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+
+%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxpgfrcs}
+ [2020/11/26 v0.3 shadings etc in tate class]
+\RequirePackage{pgfrcs}% pgfutil-latex.def requires everyshi
+\ifx\@EveryShipout@Output\@undefined
+ % LaTeX2e 2020-10-01: an emulation by ``everyshi-ltx.sty''
+ % => pLaTeX2e 2020-10-01 natively supports it
+\else
+ % older: the real ``everyshi.sty'' is loaded
+ \IfFileExists{pxeveryshi.sty}{\RequirePackage{pxeveryshi}}{}
+\fi
+
+% Note: I chose the name "pxpgfrcs.sty"
+% (instead of "pgfutil-platex.def") because
+% * "pgfrcs.sty" is the only package
+% which contains \input pgfutil-latex.def.
+% * It is not common for LaTeX users to use
+% such an interface like \input pgfutil-platex.def.
+
+% patch pgfutil-latex.def (based on 2020-11-21 v3.1.7)
+\def\pgfutil@insertatbegincurrentpagefrombox#1{%
+ \edef\pgf@temp{\the\wd\pgfutil@abb}%
+ \global\setbox\pgfutil@abb\hbox{%
+ \yoko %%% add \yoko
+ \unhbox\pgfutil@abb%
+ %
+ % the order in which \pgfutil@insertatbegincurrentpagefrombox
+ % matters unless we make the following -shift!
+ % To see this, consider writing two such statements. The second
+ % one will (naturally) be placed more to the right, although there
+ % is no apparent reason why it should.
+ %
+ % CF observed problems when placing patterns in XObjects without
+ % this skip (dvipdfmx driver for pgfplots shader=interp)
+ \hskip\dimexpr\pgfutil@ifl@t@r\fmtversion{2020/10/01}{2in-2\hoffset}{}-\pgf@temp\relax%
+ #1%
+ \pgfutil@ifl@t@r\fmtversion{2020/10/01}{\hskip\dimexpr-2in-2\hoffset\relax}{}%
+ }%
+}
+
+\endinput
diff --git a/macros/jptex/latex/plautopatch/pxstfloats.sty b/macros/jptex/latex/plautopatch/pxstfloats.sty
new file mode 100644
index 0000000000..353f0c0b5e
--- /dev/null
+++ b/macros/jptex/latex/plautopatch/pxstfloats.sty
@@ -0,0 +1,120 @@
+%
+% pxstfloats.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is actually part of the pxsttools bundle, but
+% for now distributed as part of the plautopatch bundle.
+% https://github.com/aminophen/plautopatch
+%
+% This package is expected to be compatible with
+% * stfloats.sty in sttools
+% (2012/05/29 v1.1 -- 2017/03/27 v3.3)
+% * plcore.ltx in platex
+% (2001/09/26 v1.2a -- 2021/06/03 v1.3j)
+% Many thanks to lltjp-stfloats.sty in LuaTeX-ja project.
+%
+
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxstfloats}
+ [2021/05/24 v0.2a stfloats package for pLaTeX]
+\RequirePackage{stfloats}
+
+\ifx\pltx@adjust@wd@outputbox\@undefined
+ % pLaTeX2e <2020-10-01>+2 or older
+ \ifx\pdfprimitive\@undefined % just in case ...
+ \def\pltx@adjust@wd@outputbox{%
+ \ifydir\else\vbox{\hskip\z@}\fi}
+ \else % same as plcore.dtx 2021/03/25 v1.3i
+ \def\pltx@adjust@wd@outputbox{%
+ \ifydir\else\vbox{\pdfprimitive\everypar{}\hskip\z@}\fi}
+ \fi
+\fi
+
+%% mostly based on \fn@makecol in stfloats.sty, and
+%% the additions for supporting pLaTeX are based on
+%% pLaTeX2e 2021-06-01 community ed.
+%% the code is essentially compatible with
+%% fnpos.sty (yafoot) 1999/07/14 v1.0
+%% |\makeFNmid| + |\makeFNbelow| status.
+\gdef\pxstfl@fnbelowfl@makecol{%
+ \setbox\@outputbox \box\@cclv
+ \let\@elt\relax
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global \let \@midlist \@empty
+ \@combinefloats
+ \ifvoid\footins
+ \else
+ \setbox\@outputbox \vbox {%
+ \boxmaxdepth \@maxdepth
+ \unvbox \@outputbox
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup
+ }%
+ \fi
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox \vbox to\@colht {%
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \pltx@adjust@wd@outputbox %% for pLaTeX
+ \vskip -\dimen@
+ \@textbottom
+ }%
+ \fi
+ \global \maxdepth \@maxdepth
+}
+
+%% mostly based on \@makecol in latex.ltx, and
+%% the additions for supporting pLaTeX are based on
+%% pLaTeX2e 2021-06-01 community ed.
+%% the code is essentially compatible with
+%% fnpos.sty (yafoot) 1999/07/14 v1.0
+%% |\makeFNmid| + |\makeFNabove| status.
+\gdef\pxstfl@fnabovefl@makecol {%
+ \ifvoid\footins
+ \setbox\@outputbox \box\@cclv
+ \else
+ \setbox\@outputbox \vbox {%
+ \boxmaxdepth \@maxdepth
+ \unvbox \@cclv
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup
+ }%
+ \fi
+ \let\@elt\relax
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global \let \@midlist \@empty
+ \@combinefloats
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox \vbox to\@colht {%
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \pltx@adjust@wd@outputbox %% for pLaTeX
+ \vskip -\dimen@
+ \@textbottom
+ }%
+ \fi
+ \global \maxdepth \@maxdepth
+}
+
+%% the definition \fnunderfloat is unnecessary, as stfloats.sty
+%% has already defined it. others should be re-declared here
+\def\fnbelowfloat{\global\let\@makecol\pxstfl@fnbelowfl@makecol}
+\def\fnabovefloat{\global\let\@makecol\pxstfl@fnabovefl@makecol}
+
+%% all done
+
+\endinput