diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /language/japanese/plautopatch |
Initial commit
Diffstat (limited to 'language/japanese/plautopatch')
-rw-r--r-- | language/japanese/plautopatch/LICENSE | 27 | ||||
-rw-r--r-- | language/japanese/plautopatch/Makefile | 26 | ||||
-rw-r--r-- | language/japanese/plautopatch/README.md | 95 | ||||
-rw-r--r-- | language/japanese/plautopatch/plarydshln.sty | 35 | ||||
-rw-r--r-- | language/japanese/plautopatch/plautopatch-ja.pdf | bin | 0 -> 100134 bytes | |||
-rw-r--r-- | language/japanese/plautopatch/plautopatch-ja.tex | 154 | ||||
-rw-r--r-- | language/japanese/plautopatch/plautopatch.pdf | bin | 0 -> 33938 bytes | |||
-rw-r--r-- | language/japanese/plautopatch/plautopatch.sty | 208 | ||||
-rw-r--r-- | language/japanese/plautopatch/plautopatch.tex | 156 | ||||
-rw-r--r-- | language/japanese/plautopatch/pldocverb.sty | 41 | ||||
-rw-r--r-- | language/japanese/plautopatch/plextarydshln.sty | 60 | ||||
-rw-r--r-- | language/japanese/plautopatch/plextcolortbl.sty | 39 | ||||
-rw-r--r-- | language/japanese/plautopatch/plsiunitx.sty | 71 | ||||
-rw-r--r-- | language/japanese/plautopatch/pxpdfpages.sty | 51 | ||||
-rw-r--r-- | language/japanese/plautopatch/pxpgfrcs.sty | 34 |
15 files changed, 997 insertions, 0 deletions
diff --git a/language/japanese/plautopatch/LICENSE b/language/japanese/plautopatch/LICENSE new file mode 100644 index 0000000000..16f906567a --- /dev/null +++ b/language/japanese/plautopatch/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2018-2019 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/language/japanese/plautopatch/Makefile b/language/japanese/plautopatch/Makefile new file mode 100644 index 0000000000..5f2ef4e5d6 --- /dev/null +++ b/language/japanese/plautopatch/Makefile @@ -0,0 +1,26 @@ +KANJI = -kanji=utf8 +FONTMAP = -f ipaex.map -f ptex-ipaex.map +TEXMF = $(shell kpsewhich -var-value=TEXMFHOME) + +all: plautopatch.pdf plautopatch-ja.pdf + +.SUFFIXES: .tex .dvi .pdf +.tex.dvi: + platex $(KANJI) $< + platex $(KANJI) $< + rm *.aux *.log +.dvi.pdf: + dvipdfmx $(FONTMAP) $< + +.PHONY: install clean +install: + mkdir -p ${TEXMF}/doc/platex/plautopatch + cp ./Makefile ${TEXMF}/doc/platex/plautopatch/ + cp ./LICENSE ${TEXMF}/doc/platex/plautopatch/ + cp ./README.md ${TEXMF}/doc/platex/plautopatch/ + cp ./*.pdf ${TEXMF}/doc/platex/plautopatch/ + cp ./*.tex ${TEXMF}/doc/platex/plautopatch/ + mkdir -p ${TEXMF}/tex/platex/plautopatch + cp ./*.sty ${TEXMF}/tex/platex/plautopatch/ +clean: + rm -f *.dvi *.pdf diff --git a/language/japanese/plautopatch/README.md b/language/japanese/plautopatch/README.md new file mode 100644 index 0000000000..bfec3d0daf --- /dev/null +++ b/language/japanese/plautopatch/README.md @@ -0,0 +1,95 @@ +# 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 (maintained here!) +- 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 (maintained here!) +- arydshln -> plarydshln (maintained here!) +- arydshln + plext (platex) -> plextarydshln (maintained here!) +- siunitx -> plsiunitx (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) +- pdfpages -> pxpdfpages (maintained here!) +- pgfrcs (pgf) -> pxpgfrcs (maintained here!) +- pgfcore (pgf) -> pxpgfmark (by Takayuki YATO) + +## Requirements + +This package depends on "filehook" package, +written by Martin Scharrer. + +## Miscellaneous + +This bundle may distribute some tiny patches +together with the main package. Short information: + +- pldocverb.sty: + Patch for doc.sty (latex) to improve + compatibility with `\verb` redefinition in pLaTeX. + Can be used on pLaTeX/upLaTeX. +- plextcolortbl.sty: + Patch for colortbl.sty (by David Carlisle) to improve + compatibility with plext.sty in pLaTeX. + Can be used on pLaTeX/upLaTeX. +- plarydshln.sty: + Patch for arydshln.sty (by Hiroshi Nakashima) to improve + compatibility with pLaTeX/upLaTeX kernels. + Can be used on pLaTeX/upLaTeX. +- plextarydshln.sty: + Patch for arydshln.sty (by Hiroshi Nakashima) to improve + compatibility with plext.sty in pLaTeX. + Can be used on pLaTeX/upLaTeX. +- plsiunitx.sty: + Patch for siunitx.sty (by Joseph Wright) to fix + conflict with plarray.sty (platex-tools). + Can be used on pLaTeX/upLaTeX. +- pxpdfpages.sty: + Patch for pdfpages.sty (by Andreas Matthias) to support + Japanese-style crop marks (called 'tombow' in Japanese). + Can be used on pLaTeX/upLaTeX. +- pxpgfrcs.sty: + Patch for pgfrcs.sty (part of PGF) to support + Japanese classes for vertical writing. + Can be used on pLaTeX/upLaTeX. + +## 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 + +2019-06-06 + +Hironobu Yamashita diff --git a/language/japanese/plautopatch/plarydshln.sty b/language/japanese/plautopatch/plarydshln.sty new file mode 100644 index 0000000000..b7e2c3a144 --- /dev/null +++ b/language/japanese/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 -- 2018/09/02 v1.3) +% + +%% 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/language/japanese/plautopatch/plautopatch-ja.pdf b/language/japanese/plautopatch/plautopatch-ja.pdf Binary files differnew file mode 100644 index 0000000000..a1dfcfdac7 --- /dev/null +++ b/language/japanese/plautopatch/plautopatch-ja.pdf diff --git a/language/japanese/plautopatch/plautopatch-ja.tex b/language/japanese/plautopatch/plautopatch-ja.tex new file mode 100644 index 0000000000..f199a1b349 --- /dev/null +++ b/language/japanese/plautopatch/plautopatch-ja.tex @@ -0,0 +1,154 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle} +\usepackage{doc} +\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 + +日本のp\LaTeX/up\LaTeX{}フォーマットや専用パッケージが、 +これらを知らない\LaTeX{}パッケージ(しばしば海外で作られた +汎用のもの)と衝突することがあります。 +最悪の場合にはエラーが出たり、誤った出力が得られたり +することがあります。 + +この\textsf{plautopatch}の目的は、こうした非互換を意識せずに +済むようにすることです。具体的には、p\LaTeX/up\LaTeX{}と +衝突するパッケージが使われた場合に、その衝突を解消するパッチを +提供するパッケージを必要に応じて自動的に読み込みます。 +こうすることで、ソースコードを簡潔にできるだけでなく、 +p\LaTeX/up\LaTeX{}で動作するソースと通常の\LaTeX{}ソースの +見た目を近づけることができます。 + +このパッケージはGitHubで開発しています。 +\begin{verbatim} + https://github.com/aminophen/plautopatch +\end{verbatim} + +\section*{動作条件} + +このパッケージは +\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\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 (maintained here!) +\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) +\ITEMxoTx colortbl + plext (platex) -> plextcolortbl (maintained here!) +\ITEMxTx arydshln -> plarydshln (maintained here!) +\ITEMxoTx arydshln + plext (platex) -> plextarydshln (maintained here!) +\ITEMxTx siunitx -> plsiunitx (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) +\ITEMxTx pdfpages -> pxpdfpages (maintained here!) +\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 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}のパッチ改良 +\end{itemize} + +\end{document} diff --git a/language/japanese/plautopatch/plautopatch.pdf b/language/japanese/plautopatch/plautopatch.pdf Binary files differnew file mode 100644 index 0000000000..2d9b0ad42b --- /dev/null +++ b/language/japanese/plautopatch/plautopatch.pdf diff --git a/language/japanese/plautopatch/plautopatch.sty b/language/japanese/plautopatch/plautopatch.sty new file mode 100644 index 0000000000..378c2b3208 --- /dev/null +++ b/language/japanese/plautopatch/plautopatch.sty @@ -0,0 +1,208 @@ +% +% 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} + [2019/06/06 v0.9c Automated patches for pLaTeX/upLaTeX] + +\ifx\pfmtname\@undefined + \PackageWarningNoLine{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} + +\RequirePackage{filehook} + +% 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 + \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 + }{% + \AtEndOfPackageFile{#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 + }{% + \AtEndOfPackageFile{#2}{\csname platpc@end@#1+#2\endcsname}% + }% + }{% + \@ifpackageloaded{#2}{% + \AtEndOfPackageFile{#1}{\csname platpc@end@#1+#2\endcsname}% + }{% + \AtEndOfPackageFile{#1}{% + \@ifpackageloaded{#2}{\csname platpc@end@#1+#2\endcsname}{}% + }% + \AtEndOfPackageFile{#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>" (*!) + \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}% + % all done + }% + }% + }% + % if <orig> is already loaded at this point, too late! + \@ifpackageloaded{#1}{% + \platpc@err@toolate{#1}% + }{% else + \AtBeginOfPackageFile{#1}{\csname platpc@begin@#1\endcsname}% + }% +} +\@onlypreamble\platpc@patch@before + +% 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 + }% +} +\@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}% (maintained here!) +\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}% (maintained here!) +\platpc@patch@after{arydshln}{plarydshln}% (maintained here!) +\platpc@patch@after@both{arydshln}{plext}{plextarydshln}% (maintained here!) +\platpc@patch@after{siunitx}{plsiunitx}% (maintained here!) +% --- in most cases, pxeverysel can be safely loaded even after everysel +% --- but it can fail when \AtBeginDocument{everysel} is involved +\platpc@patch@before{everysel}{pxeverysel}% platex-tools +\platpc@patch@after{everyshi}{pxeveryshi}% platex-tools +\platpc@patch@after{atbegshi}{pxatbegshi}% platex-tools +\platpc@patch@before{ftnright}{pxftnright}% platex-tools +\platpc@patch@after{multicol}{pxmulticol}% platex-tools +\platpc@patch@after{pdfpages}{pxpdfpages}% (maintained here!) + +% 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 +\AtEndOfPackageFile{mdwtab}{\@namedef{ver@plarray.sty}{}} + +\endinput diff --git a/language/japanese/plautopatch/plautopatch.tex b/language/japanese/plautopatch/plautopatch.tex new file mode 100644 index 0000000000..06f2db6946 --- /dev/null +++ b/language/japanese/plautopatch/plautopatch.tex @@ -0,0 +1,156 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle} +\usepackage{doc} +\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/up\LaTeX\ formats and packages often conflict +with other \LaTeX\ packages which are unaware of p\LaTeX/up\LaTeX. +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 p\LaTeX/up\LaTeX\ 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} + +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\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 (maintained here!) +\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) +\ITEMxoTx colortbl + plext (platex) -> plextcolortbl (maintained here!) +\ITEMxTx arydshln -> plarydshln (maintained here!) +\ITEMxoTx arydshln + plext (platex) -> plextarydshln (maintained here!) +\ITEMxTx siunitx -> plsiunitx (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) +\ITEMxTx pdfpages -> pxpdfpages (maintained here!) +\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*{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} +\end{itemize} + +\end{document} diff --git a/language/japanese/plautopatch/pldocverb.sty b/language/japanese/plautopatch/pldocverb.sty new file mode 100644 index 0000000000..cf54a62353 --- /dev/null +++ b/language/japanese/plautopatch/pldocverb.sty @@ -0,0 +1,41 @@ +% +% pldocverb.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 +% * doc.sty +% (2004/02/09 v2.1b -- 2018/09/25 v2.1i) +% * plcore.ltx in platex +% (2001/09/26 v1.2a -- 2018/09/02 v1.3) +% + +%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pldocverb} + [2018/11/25 v0.2 doc package for pLaTeX/upLaTeX] +\RequirePackage{doc} +% doc.sty conditionally requires multicol.sty without passing options +\IfFileExists{pxmulticol.sty}{\RequirePackage{pxmulticol}}{} + +%% enable \xkanjiskip insertion, +%% while preserving beginning space characters (pLaTeX2e 2017/10/28) +\@ifl@t@r{\pfmtversion}{2017/10/28}{\@firstoftwo}{\@secondoftwo} +{% = for pLaTeX2e 2017/10/28 or newer +\def\verb{\relax\ifmmode\hbox\else\leavevmode\vadjust{}\fi + \bgroup \let\do\do@noligs \verbatim@nolig@list + \ttfamily \verb@eol@error \let\do\@makeother \dospecials + \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}} +}% = +{% = for pLaTeX2e 2017/09/26 or older +\def\verb{\relax\ifmmode\hbox\else\leavevmode\fi + \bgroup \let\do\do@noligs \verbatim@nolig@list + \ttfamily \verb@eol@error \let\do\@makeother \dospecials + \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}} +}% = +% +%% done + +\endinput diff --git a/language/japanese/plautopatch/plextarydshln.sty b/language/japanese/plautopatch/plextarydshln.sty new file mode 100644 index 0000000000..ac0059c5e4 --- /dev/null +++ b/language/japanese/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 -- 2018/10/07 v1.2k) +% + +%% 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/language/japanese/plautopatch/plextcolortbl.sty b/language/japanese/plautopatch/plextcolortbl.sty new file mode 100644 index 0000000000..08ae5bd82d --- /dev/null +++ b/language/japanese/plautopatch/plextcolortbl.sty @@ -0,0 +1,39 @@ +% +% plextcolortbl.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 +% * colortbl.sty +% (2012/06/21 v1.0b -- 2018/12/12 v1.0d) +% * plext.sty in platex +% (2001/09/26 v1.2 -- 2018/10/07 v1.2k) +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{plextcolortbl} + [2018/09/19 v0.1a Merge plext and colortbl] +\RequirePackage{plextarray}% colortbl requires array +\RequirePackageWithOptions{colortbl} + +%% patching internal code for colortbl.sty +% +\AtBeginDocument{% + % recover \@tabarray from plextarray.sty + \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}} + % change \p@tabarray instead + \expandafter\def\expandafter\p@tabarray + \expandafter<\expandafter#\expandafter1\expandafter>\expandafter{% + \expandafter\CT@start\p@tabarray<#1>}% +} +% +\def\endarray{\crcr \egroup \egroup + \@end@alignbox %% added from plext.sty + \@arrayright \gdef\@preamble{}\CT@end}% +% +%% done + +\endinput diff --git a/language/japanese/plautopatch/plsiunitx.sty b/language/japanese/plautopatch/plsiunitx.sty new file mode 100644 index 0000000000..f4041287d5 --- /dev/null +++ b/language/japanese/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/language/japanese/plautopatch/pxpdfpages.sty b/language/japanese/plautopatch/pxpdfpages.sty new file mode 100644 index 0000000000..43c8b274e8 --- /dev/null +++ b/language/japanese/plautopatch/pxpdfpages.sty @@ -0,0 +1,51 @@ +% +% pxpdfpages.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 +% * pdfpages.sty +% (2015/07/19 v0.5a -- 2017/10/31 v0.5l) +% * plcore.ltx in platex +% (2001/09/26 v1.2a -- 2018/09/02 v1.3) +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxpdfpages} + [2018/08/20 v0.1 Patch to pdfpages for (u)pLaTeX] + +%% preparations +\def\pxpdpg@pkgname{pxpdfpages} +\def\pxpdpg@warn{\PackageWarningNoLine\pxpdpg@pkgname} +\def\pxpdpg@info{\PackageInfo\pxpdpg@pkgname} + +%% load it +\RequirePackageWithOptions{pdfpages} +\RequirePackage{pxatbegshi}% pdfpages requires atbegshi + +%% patch internal for pdfpages to work with tombow +%% Note: this code should be copied to gentombow.sty! +\def\pxpdpg@patch@pdfpages{% + \RequirePackage{etoolbox} + \patchcmd{\AM@output}{% + \setlength{\@tempdima}{\AM@xmargin}% + \edef\AM@xmargin{\the\@tempdima}% + \setlength{\@tempdima}{\AM@ymargin}% + \edef\AM@ymargin{\the\@tempdima}% + }{% + \setlength{\@tempdima}{\AM@xmargin\iftombow+1in\fi}% + \edef\AM@xmargin{\the\@tempdima}% + \setlength{\@tempdima}{\AM@ymargin\iftombow-1in\fi}% + \edef\AM@ymargin{\the\@tempdima}% + } + {\pxpdpg@info{Patch for pdfpages applied}} + {\pxpdpg@warn{Patch for pdfpages failed}}% + } +\AtBeginDocument{\@ifpackageloaded{pdfpages}{\pxpdpg@patch@pdfpages}{}} + +%% all done + +\endinput diff --git a/language/japanese/plautopatch/pxpgfrcs.sty b/language/japanese/plautopatch/pxpgfrcs.sty new file mode 100644 index 0000000000..578e26de0b --- /dev/null +++ b/language/japanese/plautopatch/pxpgfrcs.sty @@ -0,0 +1,34 @@ +% +% 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} + [2018/09/21 v0.1] +\RequirePackage{pgfrcs} + +% 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 +\RequirePackage{pxeveryshi}% pgfutil-latex.def requires everyshi +\def\pgfutil@insertatbegincurrentpagefrombox#1{% + \edef\pgf@temp{\the\wd\pgfutil@abb}% + \global\setbox\pgfutil@abb\hbox{% + \yoko %%% add \yoko + \unhbox\pgfutil@abb% + \hskip-\pgf@temp\relax% + #1% + }% +}% + +\endinput |