diff options
Diffstat (limited to 'macros/jptex/latex/platex-tools')
35 files changed, 2118 insertions, 0 deletions
diff --git a/macros/jptex/latex/platex-tools/LICENSE b/macros/jptex/latex/platex-tools/LICENSE new file mode 100644 index 0000000000..ecbe9e9df9 --- /dev/null +++ b/macros/jptex/latex/platex-tools/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016-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/platex-tools/README.md b/macros/jptex/latex/platex-tools/README.md new file mode 100644 index 0000000000..89cd0ec22f --- /dev/null +++ b/macros/jptex/latex/platex-tools/README.md @@ -0,0 +1,88 @@ +# platex-tools + +This bundle is an extended version of latex-tools bundle developed +by LaTeX team, mainly intended to support pLaTeX2e and upLaTeX2e. +Patches for latex-tools bundle and ms bundle (by Martin Schröder) +and some additional packages are included. + +## Bundle contents + +All these packages can be used on pLaTeX and upLaTeX. + +- pldocverb.sty: + Patch for doc.sty (latex) to improve + compatibility with `\verb` redefinition in pLaTeX. +- plarray.sty: + Patch for array.sty (latex-tools) to improve + compatibility with pLaTeX kernel. +- plextarray.sty: + Patch for array.sty (latex-tools) to improve + compatibility with plext.sty in pLaTeX. +- plextdelarray.sty: + Patch for delarray.sty (latex-tools) to improve + compatibility with plext.sty in pLaTeX. +- plextcolortbl.sty: + Patch for colortbl.sty (by David Carlisle) to improve + compatibility with plext.sty in pLaTeX. +- pxftnright.sty: + Patch for ftnright.sty (latex-tools) to support + Japanese classes for vertical writing. +- pxmulticol.sty: + Patch for multicol.sty (latex-tools) to support + `\footnote` in vertical writing. +- pxxspace.sty: + Patch for xspace.sty (latex-tools) to fix + interword spacing with Japanese characters. + Version 0.2 was written by Takayuki YATO in 2019 + (https://gist.github.com/zr-tex8r/7de76036846e149bc28ec6399a683e3a), + and incorporated into this bundle by his courtesy. +- pxeverysel.sty: + Patch for everysel.sty (ms) to improve + compatibility with Japanese font selection in pLaTeX. + Version 0.1 was written by Takayuki YATO in 2015 + (https://gist.github.com/zr-tex8r/48c6910bbbe2f41d72de), + and incorporated into this bundle by his courtesy. +- pxeveryshi.sty: + Patch for everyshi.sty (ms) to support + Japanese classes for vertical writing. + Version 0.1 was written by Takayuki YATO in 2012 + (https://gist.github.com/zr-tex8r/2702969), + and incorporated into this bundle by his courtesy. +- pxatbegshi.sty: + Patch for atbegshi.sty (oberdiek) to support + Japanese classes for vertical writing. + The essential part of this package was proposed by + Hironori Kitagawa in 2017. + +The packages "gentombow" (formerly "pxgentombow") and "bounddvi" +are now distributed as part of +[gentombow](https://github.com/aminophen/gentombow) bundle. + +## Character encoding + +All the package files (.sty) contain ASCII characters only. +All the document files (.tex) are encoded in UTF-8. + +## Installation + +- *.sty -> $TEXMF/tex/platex/platex-tools +- *.tex, *.pdf -> $TEXMF/doc/platex/platex-tools + +## Repository + +The bundle is maintained on GitHub: + https://github.com/aminophen/platex-tools + +You can also obtain this bundle from CTAN: + https://www.ctan.org/pkg/platex-tools + +## 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-11 + +Hironobu Yamashita diff --git a/macros/jptex/latex/platex-tools/plarray.pdf b/macros/jptex/latex/platex-tools/plarray.pdf Binary files differnew file mode 100644 index 0000000000..92dd257adc --- /dev/null +++ b/macros/jptex/latex/platex-tools/plarray.pdf diff --git a/macros/jptex/latex/platex-tools/plarray.sty b/macros/jptex/latex/platex-tools/plarray.sty new file mode 100644 index 0000000000..a38cf54e76 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plarray.sty @@ -0,0 +1,60 @@ +% +% plarray.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * array.sty in latex-tools +% (2016/10/06 v2.4d -- 2021/10/04 v2.5f) +% * plcore.ltx in platex +% (2001/09/26 v1.2a -- 2021/12/08 v1.3l) +% + +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{plarray} + [2021/12/11 v0.1i Tabular extension package for pLaTeX/upLaTeX] +\RequirePackage{array} + +%% patching internal code for array.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\@tabular{% + \leavevmode \null + \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup + \let\d@llarend\endgroup + \@tabarray} +\def\endtabular{\endarray\m@th $\egroup\null} +\expandafter \let \csname endtabular*\endcsname = \endtabular +}% = +% +%% 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 +% first, provide old definition; there are some known incompatibility +% compared to LaTeX, pLaTeX or array +\def\insert@column{% + \the@toks \the \@tempcnta + \mbox{}\inhibitglue \ignorespaces \@sharp \unskip \unskip + \the@toks \the \count@ \relax} +% if both macros are available, override with new definition +% (= pLaTeX2e 2018/03/09 or later, built on e-(u)pTeX 180226) +\ifx\pltx@next@inhibitglue\@undefined\else + \ifx\removejfmglue\@undefined\else + \def\insert@column{% + \the@toks \the \@tempcnta + \relax \pltx@next@inhibitglue + \ignorespaces \@sharp \unskip \removejfmglue + \the@toks \the \count@ \relax} + \fi +\fi +}% = +% +%% done + +%% all done + +\endinput diff --git a/macros/jptex/latex/platex-tools/plarray.tex b/macros/jptex/latex/platex-tools/plarray.tex new file mode 100644 index 0000000000..66ea8f2fb5 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plarray.tex @@ -0,0 +1,80 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle}% supports \verb in \footnote +\usepackage{doc} +\usepackage{plarray} +\GetFileInfo{plarray.sty} +\title{Package \textsf{plarray} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +This package \textsf{plarray} provides small patches to \textsf{array} +package (\textsf{latex-tools} bundle) for use with Japanese +p\LaTeX/up\LaTeX. +By loading \textsf{plarray} in addition to/instead of \textsf{array}, +you can avoid conflicts between (u)p\LaTeX\ kernel and \textsf{array}% +\footnote{Below is recent changes introduced to +p\LaTeX/up\LaTeX\ kernels by Japanese \TeX\ Development Community, +which cannot cope with \textsf{array} package: +\begin{itemize} +\item Remove extra \verb+\xkanjiskip+ around tabular environment +\item Inhibit JFM (Japanese \TeX\ font metric) glue + around tabular cell components +\end{itemize} +The package \textsf{plarray} re-adds these changes to \textsf{array}.}. + +If you are going to use both \textsf{plext} and \textsf{array} packages +on p\LaTeX/up\LaTeX, the easiest way is to use \textsf{plextarray}; +please refer to its document. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +この\textsf{plarray}パッケージは、\textsf{latex-tools}バンドルの +\textsf{array}パッケージをp\LaTeX/up\LaTeX で使うときのwrapperとして +機能します。さらに、\textsf{array}パッケージによって上書きされて +無効化されてしまうp\LaTeX/up\LaTeX カーネルの修正点を再有効化する +働きもします(具体的には、「tabular環境前後に\verb+\xkanjiskip+由来の +余分なアキが入る現象」と、「表のセル内の要素が始め括弧類で始まる場合や +終わり括弧類で終わる場合にJFMグルーが不自然に入る現象」に対処します)。 + +\bigskip +\begin{minipage}{0.45\linewidth} +\begin{verbatim} + \documentclass{jarticle} % if you are using pLaTeX, + \usepackage{plarray} % load this! + \begin{document} + これは表の例です + \begin{tabular}{|>{$}c<{$}|c|}\hline + \exp(x) & 指数関数 \\ \hline + \log(x) & 対数関数 \\ \hline + \end{tabular}% + 終わり + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.5\linewidth} + これは表の例です + \begin{tabular}{|>{$}c<{$}|c|}\hline + \exp(x) & 指数関数 \\ \hline + \log(x) & 対数関数 \\ \hline + \end{tabular}% + 終わり +\end{minipage} +\bigskip + +p\LaTeX/up\LaTeX で、\textsf{array}パッケージに加えてさらに +\textsf{plext}パッケージも使いたい場合は、 +\textsf{plextarray}パッケージを読み込むのが簡単です。 + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pldocverb.pdf b/macros/jptex/latex/platex-tools/pldocverb.pdf Binary files differnew file mode 100644 index 0000000000..480cf59298 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pldocverb.pdf diff --git a/macros/jptex/latex/platex-tools/pldocverb.sty b/macros/jptex/latex/platex-tools/pldocverb.sty new file mode 100644 index 0000000000..a326fe1873 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pldocverb.sty @@ -0,0 +1,41 @@ +% +% pldocverb.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * doc.sty +% (2004/02/09 v2.1b -- 2021/05/28 v2.1n) +% * plcore.ltx in platex +% (2001/09/26 v1.2a -- 2021/12/08 v1.3l) +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pldocverb} + [2020/10/08 v0.2a 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/macros/jptex/latex/platex-tools/pldocverb.tex b/macros/jptex/latex/platex-tools/pldocverb.tex new file mode 100644 index 0000000000..e590f4a67d --- /dev/null +++ b/macros/jptex/latex/platex-tools/pldocverb.tex @@ -0,0 +1,54 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle}% supports \verb in \footnote +\usepackage{doc} +\usepackage{pldocverb} +\GetFileInfo{pldocverb.sty} +\title{Package \textsf{pldocverb} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +This package \textsf{pldocverb} provides small patches to +\textsf{doc} package of \textsf{latex(-base)} for use with +Japanese p\LaTeX/up\LaTeX. +Current package supports re-definition of \verb+\verb+ command. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +この\textsf{pldocverb}パッケージは、 +\textsf{latex(-base)}バンドルの\textsf{doc}パッケージによって +上書きされて無効化されてしまうp\LaTeX/up\LaTeX カーネルの修正点を +再有効化します。具体的には、\verb+\verb+コマンドの直前に +\verb+\xkanjiskip+挿入を許可するための修正に対応します。 + +\bigskip +\begin{minipage}{0.6\linewidth} +\noautoxspacing %% on purpose +\begin{verbatim} + \documentclass{jarticle} % if you are using pLaTeX, + \usepackage{pldocverb} % load this! + \usepackage{minijs} + \begin{document} + \setlength{\xkanjiskip}{10pt} + これが\verb+test+で\verb+テスト+です。 + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.35\linewidth} + \setlength{\xkanjiskip}{10pt} + これが\verb+test+で\verb+テスト+です。 +\end{minipage} +\bigskip + +\end{document} diff --git a/macros/jptex/latex/platex-tools/plextarray.pdf b/macros/jptex/latex/platex-tools/plextarray.pdf Binary files differnew file mode 100644 index 0000000000..ebf6a7aa51 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextarray.pdf diff --git a/macros/jptex/latex/platex-tools/plextarray.sty b/macros/jptex/latex/platex-tools/plextarray.sty new file mode 100644 index 0000000000..42b92ee929 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextarray.sty @@ -0,0 +1,121 @@ +% +% plextarray.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * array.sty in latex-tools +% (2016/10/06 v2.4d -- 2021/10/04 v2.5f) +% * plext.sty in platex +% (2001/09/26 v1.2 -- 2020/10/07 v1.2m) +% Largely based on lltjext.sty from LuaTeX-ja project. +% + +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{plextarray} + [2018/10/27 v1.1d Tabular extension package for plext and array] +\RequirePackage{plext} +\RequirePackage{plarray} + +%% save definitions from array.sty +% the <dir> option will be handled later in \@tabarray +\def\array{\col@sep\arraycolsep + \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\def\@halignto{}% + \@tabarray} +\def\tabular{\def\@halignto{}\@tabular} +%% merged definitions from array.sty and plext.sty +% take <dir> option first as in plext.sty, +% which will be passed to \@tabarray +\@namedef{tabular*}{\@ifnextchar<%> + {\p@stabular}{\p@stabular<Z>}} +\def\p@stabular<#1>#2{% + \setlength\dimen@{#2}% + \edef\@halignto{to\the\dimen@}\@tabular<#1>} + +%% patching internal code for array.sty and plext.sty +% +\@ifpackagelater{array}{2018/09/13}{\@firstoftwo}{\@secondoftwo} +{% = for 2018/09/13 v2.4i or newer +\def\@startpbox#1{\bgroup + \color@begingroup + \box@dir\adjustbaseline %% added + \setlength\hsize{#1}\@arrayparboxrestore + \everypar{% + \vrule \@height \ht\@arstrutbox \@width \z@ + \everypar{}}% + }% +}% = +{% = for 2018/04/30 v2.4h or older +\def\@startpbox#1{\bgroup + \box@dir\adjustbaseline %% added + \setlength\hsize{#1}\@arrayparboxrestore + \everypar{% + \vrule \@height \ht\@arstrutbox \@width \z@ + \everypar{}}% + }% +}% = +% +\def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}} +% +%% merged \@array (from array.sty) and \p@array (from plext.sty) +\def\p@array<#1>[#2]#3{% + %%%%% new code for box direction + \let\box@dir\relax + \iftdir + \if #1y\relax + \let\box@dir\yoko + \@tempcnta=\z@ % \(y)strutbox + \else\if #1z\relax + \@rotswtrue + \let\box@dir\tate + \@tempcnta=\tw@ % \zstrutbox + \else + \let\box@dir\tate + \@tempcnta=\@ne % \tstrutbox + \fi\fi + \else + \if #1t\relax + \let\box@dir\tate + \@tempcnta=\@ne % \tstrutbox + \else + \let\box@dir\yoko + \@tempcnta=\z@ % \(y)strutbox + \fi + \fi + %%%%% new code end + \setbox \@arstrutbox \hbox{\box@dir %% add \box@dir + % the behavior of \strutbox has been changed + % (box resister -> conditional macro) in pLaTeX2e 2017/04/08; + % so, \strutbox should appear after \box@dir is applied. + \@tempcntb=\ifcase\@tempcnta\strutbox + \or\tstrutbox\or\zstrutbox\or\@ctrerr\fi + \@tempdima \ht \@tempcntb + \advance \@tempdima by\extrarowheight + \vrule \@height \arraystretch \@tempdima + \@depth \arraystretch \dp \@tempcntb + \@width \z@}% + \fork@array@option<#1>[#2]% %% merged from plext + \begingroup + \@mkpream{#3}% + % following definition of \@preamble is from plext (\edef -> \xdef), + % but it's not the same as the one in array; why? + \xdef\@preamble{\ialign \noexpand \@halignto + \bgroup \tabskip \z@skip \@arstrut \@preamble + \tabskip \z@skip \cr}% + \endgroup + \@arrayleft + \@begin@alignbox %% defined inside \fork@array@option + \bgroup + \box@dir\adjustbaseline + \let\par\@empty + \let\@sharp##\let\protect\relax + \let\\\@arraycr\let\tabularnewline\\ + \lineskip\z@skip\baselineskip\z@skip\@preamble} +% +\def\endarray{\crcr \egroup \egroup \@end@alignbox \@arrayright \gdef\@preamble{}} +% +%% done + +\endinput diff --git a/macros/jptex/latex/platex-tools/plextarray.tex b/macros/jptex/latex/platex-tools/plextarray.tex new file mode 100644 index 0000000000..47e1f68e1f --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextarray.tex @@ -0,0 +1,157 @@ +%# -*- 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{array} +\usepackage{plextarray} +\GetFileInfo{plextarray.sty} +\title{Package \textsf{plextarray} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{array}, included in \textsf{latex-tools} bundle, is +incompatible with \textsf{plext} package on Japanese p\LaTeX. +This is because \textsf{plext} extends \texttt{tabular} and \texttt{array} +environments to add an optional argument for direction specification. +The package \textsf{plextarray} resolves this incompatibility, +and enables coexistence of both extensions provided by \textsf{plext} +and \textsf{array}. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\section*{Brief explanation of ``\textsf{plext}'' package} + +This section is for people who are not familiar with Japanese p\LaTeX\ +and \textsf{plext} package. + +Package \textsf{plext} extends \texttt{tabular} and \texttt{array} +environments by adding \texttt{<dir>} option, which specifies the +writing direction: +\begin{verbatim} + \begin{tabular}<dir>[pos]{table spec} ... \end{tabular} + \begin{tabular*}<dir>{width}[pos]{table spec} ... \end{tabular*} + \begin{array}<dir>[pos]{table spec} ... \end{array} +\end{verbatim} +The option \texttt{<dir>} permits one of the following three values. +If none of them is specified, the direction inside the environment +is same as that outside the environment. +\begin{quote} + \begin{description} + \item[y] \emph{yoko} direction (horizontal writing) + \item[t] \emph{tate} direction (vertical writing) + \item[z] native direction of \TeX +\end{description} +\end{quote} +The rest of this document is written in Japanese, and includes some +examples of usage. + +\bigskip + +\textsf{latex-tools}バンドルに含まれる\textsf{array}パッケージは、 +p\LaTeX の拡張パッケージである\textsf{plext}パッケージと互換性がありません。 +これは、\textsf{plext}パッケージは、文書中で局所的に組方向を変える「組方向 +オプション」の拡張を持っていますが、これと\textsf{array}パッケージによる拡張 +が衝突してしまうためです\footnote{\textsf{plext}→\textsf{array}の順に読み込む +と\textsf{plext}による拡張がキャンセルされて使えなくなります。 +逆に\textsf{array}→\textsf{plext}の順に読み込むとエラーが出てしまいます。}。 +この\textsf{plextarray}パッケージを読み込むことで、 +\textsf{plext}パッケージの組方向オプション拡張と\textsf{array}パッケージの +拡張の両方を使うことができるようになります。 + +\section{使いかた} + +\textsf{plext}と\textsf{array}を共存させたいときに、プリアンブルに +\verb+\usepackage{plextarray}+と書きます。既にいずれかのパッケージが +読み込まれていても問題ありません。また、\textsf{plextarray}パッケージを +読み込めば、\textsf{plext}と\textsf{array}\footnote{より正確には、 +\textsf{array}と(u)p\LaTeX の衝突を解消する\textsf{plarray}を読み込む +ことで、間接的に\textsf{array}も読み込まれます。}も自動的に読み込まれます。 + +\textsf{dcolumn}や\textsf{tabularx}のような、内部で\textsf{array}を利用 +しているパッケージを\textsf{plext}と共存させたい場合にも、 +\textsf{plextarray}が便利です。 + +以下に例を示します。横組中で縦組の表を書く例。 + +\bigskip +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \documentclass{jsarticle} + \usepackage{plextarray} + \begin{document} + 組方向 \verb+<t>+ 指定 + \begin{tabular}<t>{|>{$}c<{$}|c|}\hline + \exp(x) & 指数関数 \\ \hline + \log(x) & 対数関数 \\ \hline + \end{tabular}% + 終わり + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.3\linewidth} + 組方向 \verb+<t>+ 指定 + \begin{tabular}<t>{|>{$}c<{$}|c|}\hline + \exp(x) & 指数関数 \\ \hline + \log(x) & 対数関数 \\ \hline + \end{tabular}% + 終わり +\end{minipage} + +\bigskip + +縦組中で横組の表を書く例。\pLaTeX の縦組クラスでは\textsf{plext}パッケージが +最初から読み込まれているため、\textsf{array}パッケージを使用したい場合には +必ず\textsf{plextarray}パッケージを読み込む必要があります。 + +\bigskip +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \documentclass{tarticle} + %\usepackage{array} + \usepackage{plextarray} + \begin{document} + 組方向 \verb+<y>+ 指定 + \begin{tabular}<y>{|m{8zw}|m{5zw}|m{5zw}|} + \hline + \multicolumn{3}{|c|}{果物のリスト} \\ \hline + 品名 & 金額 & 産地 \\ \hline + りんご & 170円 & 青森県 \\ \hline + みかん & 150円 & 和歌山県 \\ \hline + パイナップル & 400円 & 沖縄県 \\ \hline + バナナ & 190円 & フィリピン \\ \hline + \end{tabular}% + 終わり + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}<t>{0.45\linewidth} +組方向 \verb+<y>+ 指定 +\begin{tabular}<y>{|m{8zw}|m{5zw}|m{5zw}|} + \hline + \multicolumn{3}{|c|}{果物のリスト} \\ \hline + 品名 & 金額 & 産地 \\ \hline + りんご & 170円 & 青森県 \\ \hline + みかん & 150円 & 和歌山県 \\ \hline + パイナップル & 400円 & 沖縄県 \\ \hline + バナナ & 190円 & フィリピン \\ \hline +\end{tabular}% +終わり +\end{minipage} +\bigskip + +\section{謝辞} + +本パッケージの実装にあたっては、 +Lua\TeX-jaプロジェクト\footnote{\texttt{https://osdn.net/projects/luatex-ja/}}の +\textsf{lltjext}パッケージを参考にしました。 + +\end{document} diff --git a/macros/jptex/latex/platex-tools/plextcolortbl.pdf b/macros/jptex/latex/platex-tools/plextcolortbl.pdf Binary files differnew file mode 100644 index 0000000000..10e8857f5e --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextcolortbl.pdf diff --git a/macros/jptex/latex/platex-tools/plextcolortbl.sty b/macros/jptex/latex/platex-tools/plextcolortbl.sty new file mode 100644 index 0000000000..027498df67 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextcolortbl.sty @@ -0,0 +1,39 @@ +% +% plextcolortbl.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * colortbl.sty +% (2012/06/21 v1.0b -- 2020/01/04 v1.0e) +% * plext.sty in platex +% (2001/09/26 v1.2 -- 2020/10/07 v1.2m) +% + +%% 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/macros/jptex/latex/platex-tools/plextcolortbl.tex b/macros/jptex/latex/platex-tools/plextcolortbl.tex new file mode 100644 index 0000000000..0cea5c1093 --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextcolortbl.tex @@ -0,0 +1,64 @@ +%# -*- 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{colortbl} +\usepackage{plextcolortbl} +\GetFileInfo{plextcolortbl.sty} +\title{Package \textsf{plextcolortbl} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +The package \textsf{plextcolortbl} provides a tiny patch to +make \textsf{colortbl} compatible with \textsf{plext}. + +\bigskip + +\textsf{plextcolortbl}パッケージは、David Carlisle氏による +\textsf{colortbl}パッケージと、p\LaTeX の拡張パッケージである +\textsf{plext}パッケージを同時に使えるようにするものです。 + +\section{使いかた} + +\textsf{plext}と\textsf{colortbl}を共存させたいときに、プリアンブルに +\verb+\usepackage{plextcolortbl}+と書きます。 + +以下に例を示します。 + +\bigskip +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \documentclass{jsarticle} + %\usepackage{plext} + %\usepackage{colortbl} + \usepackage{plextcolortbl} + \begin{document} + \begin{tabular*}<t>{3cm}{% + @{\extracolsep{\fill}} + >{\columncolor{green}[0pt][20mm]}l + >{\columncolor{yellow}[5mm][0pt]}l + @{}} + one & いち \\ + two & に + \end{tabular*} + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.4\linewidth} + \begin{tabular*}<t>{3cm}{% + @{\extracolsep{\fill}} + >{\columncolor{green}[0pt][20mm]}l + >{\columncolor{yellow}[5mm][0pt]}l + @{}} + one & いち \\ + two & に + \end{tabular*} +\end{minipage} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/plextdelarray.pdf b/macros/jptex/latex/platex-tools/plextdelarray.pdf Binary files differnew file mode 100644 index 0000000000..d45927b87d --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextdelarray.pdf diff --git a/macros/jptex/latex/platex-tools/plextdelarray.sty b/macros/jptex/latex/platex-tools/plextdelarray.sty new file mode 100644 index 0000000000..fff8dbb64c --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextdelarray.sty @@ -0,0 +1,55 @@ +% +% plextdelarray.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * delarray.sty in latex-tools +% (2014/10/28 v1.01) +% * plext.sty in platex +% (2001/09/26 v1.2 -- 2020/10/07 v1.2m) +% + +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{plextdelarray} + [2018/09/18 v1.0a array delimiter package for plext and delarray] +\RequirePackage{plextarray} +\RequirePackage{delarray} + +%% patching internal code for array.sty and plext.sty +% +\def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}} +% +%% adopt from \p@tabarray (from plext.sty) +\def\p@tabarray<#1>{\m@th\@ifnextchar[%] + {\p@@array<#1>}{\p@@array<#1>[c]}} +% +%% adopt from \@@array (from delarray.sty) +\def\p@@array<#1>[#2]{\@ifnextchar\bgroup + {\let\@arrayleft\relax\let\@arrayright\relax\p@array<#1>[#2]}% + {\p@del@array<#1>[#2]}} +% +%% adopt from \@del@array (from delarray.sty) +% Note: we can't use \unvbox\z@, because there is a possibility +% that \@arrayleft is followed by \raise etc, instead of +% a box-starting command (\vtop, \vbox etc). +% Otherwise, an error "! A <box> was supposed to be here." +% See definitions of \@begin@alignbox in \fork@array@option. +\def\p@del@array<#1>[#2]#3#4#5{% + \setbox\z@\hbox{$\left#3\right#5$}% + \if#2c\def\@arrayleft{\left#3}\def\@arrayright{\right#5}% + \else\def\@arrayleft{\setbox\z@=\hbox\bgroup}% !!! + \def\@arrayright{\egroup% !!! + \dimen@=\dp\z@ + \advance\dimen@-\ht\z@ + \divide \dimen@ by \tw@ + \advance\dimen@ by\fontdimen22 \textfont\tw@ + \lower\dimen@\hbox{$\left#3\vcenter{\box\z@}\right#5$}}% !!! + \fi + \p@array<#1>[#2]{#4}} +% +%% all done + +\endinput diff --git a/macros/jptex/latex/platex-tools/plextdelarray.tex b/macros/jptex/latex/platex-tools/plextdelarray.tex new file mode 100644 index 0000000000..cc5e5a745f --- /dev/null +++ b/macros/jptex/latex/platex-tools/plextdelarray.tex @@ -0,0 +1,159 @@ +%# -*- 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{delarray} +\usepackage{plextdelarray} +\GetFileInfo{plextdelarray.sty} +\title{Package \textsf{plextdelarray} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{delarray}, included in \textsf{latex-tools} bundle, is +incompatible with \textsf{plext} package for p\LaTeX. +The package \textsf{plextarray} resolves this incompatibility, +and enables coexistence of both extensions provided by \textsf{plext} +and \textsf{delarray}. If you are not familiar with Japanese p\LaTeX\ +and \textsf{plext} package, please find the documentation of +\textsf{plextarray} for brief explanation. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +The rest of this document is written in Japanese, and includes some +examples of usage. + +\bigskip + +\textsf{latex-tools}バンドルに含まれる\textsf{delarray}パッケージは、 +p\LaTeX の拡張パッケージである\textsf{plext}パッケージと互換性がありません。 +この\textsf{plextdelarray}パッケージは、\textsf{plext}パッケージの組方向 +オプション拡張と\textsf{delarray}パッケージの拡張の両方を「一応使える」状態 +にするものです。ただし、\textsf{plext}の内部実装の都合上、\textsf{delarray}と +完全に同じ結果にならない場合があるかもしれません\footnote{本パッケージは +「\textsf{delarray}を読み込んだだけで\textsf{plext}の部分的な縦書き機能が +すべて使えなくなってしまって困った」という場合の、あくまで非常手段という +程度にとらえてください。}。 + +\section{使いかた} + +\textsf{plext}と\textsf{delarray}を共存させたいときに、プリアンブルに +\verb+\usepackage{plextdelarray}+と書きます。既にいずれかのパッケージが +読み込まれていても問題ありません。また、\textsf{plextdelarray}パッケージを +読み込めば、\textsf{plext}と\textsf{delarray}も自動的に読み込まれます。 +また、\textsf{plextarray}パッケージも読み込みます。 + +以下に例を示します。左側が\textsf{delarray}の機能で左右括弧を付けたもの、 +右側が通常の\textsf{array}の機能で左右括弧を付けたものです。 +特に\verb+[t]+と\verb+[b]+は、\textsf{delarray}なしでは実現できない +ようです(例は\textsf{delarray}のドキュメントを少し改変)。 + +\bigskip +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \documentclass{jsarticle} + %\usepackage{plext} + %\usepackage{delarray} + \usepackage{plextdelarray} + \begin{document} + \[ + \begin{array}[t]\{{c}\} + 3 \\ 4 \\ 5 \end{array} + \begin{array}[c]\{{c}\} + 2 \\ 3 \\ 4 \end{array} + \begin{array}[b]\{{c}\} + 1 \\ 2 \\ 3 \end{array} + \] + \[ + \left\{ \begin{array}[t]{c} + 3 \\ 4 \\ 5 \end{array} \right\} + \left\{ \begin{array}[c]{c} + 2 \\ 3 \\ 4 \end{array} \right\} + \left\{ \begin{array}[b]{c} + 1 \\ 2 \\ 3 \end{array} \right\} + \] + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.4\linewidth} +\mbox{}\\[10ex] + \[ + \begin{array}[t]\{{c}\} + 3 \\ 4 \\ 5 \end{array} + \begin{array}[c]\{{c}\} + 2 \\ 3 \\ 4 \end{array} + \begin{array}[b]\{{c}\} + 1 \\ 2 \\ 3 \end{array} + \] +\\[5ex] + \[ + \left\{ \begin{array}[t]{c} + 3 \\ 4 \\ 5 \end{array} \right\} + \left\{ \begin{array}[c]{c} + 2 \\ 3 \\ 4 \end{array} \right\} + \left\{ \begin{array}[b]{c} + 1 \\ 2 \\ 3 \end{array} \right\} + \] +\end{minipage} +\bigskip + +\textsf{plext}と\textsf{delarray}の両方の拡張を同じ箇所で使用することも +できなくはありませんが、役に立つ状況は少ないと思います。 + +\bigskip +\begin{minipage}{0.5\linewidth} +\begin{verbatim} + \documentclass{jsarticle} + %\usepackage{plext} + %\usepackage{delarray} + \usepackage{plextdelarray} + \begin{document} + \[ + \begin{array}<t>[t]\{{c}\} + 3 \\ 4 \\ 5 \end{array} + \begin{array}<t>[c]\{{c}\} + 2 \\ 3 \\ 4 \end{array} + \begin{array}<t>[b]\{{c}\} + 1 \\ 2 \\ 3 \end{array} + \] + \[ + \newcolumntype{L}{>{$}l<{$}} + f(x)= + \begin{array}<t>\{{lL}. + 0 & if $x=0$ \\ + \sin(x)/x & otherwise + \end{array} + \] + \end{document} +\end{verbatim} +\end{minipage} +\begin{minipage}{0.4\linewidth} +\mbox{}\\[12ex] + \[ + \begin{array}<t>[t]\{{c}\} + 3 \\ 4 \\ 5 \end{array} + \begin{array}<t>[c]\{{c}\} + 2 \\ 3 \\ 4 \end{array} + \begin{array}<t>[b]\{{c}\} + 1 \\ 2 \\ 3 \end{array} + \] +\\[6ex] + \[ + \newcolumntype{L}{>{$}l<{$}} + f(x)= + \begin{array}<t>\{{lL}. + 0 & if $x=0$ \\ + \sin(x)/x & otherwise + \end{array} + \] +\end{minipage} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxatbegshi.pdf b/macros/jptex/latex/platex-tools/pxatbegshi.pdf Binary files differnew file mode 100644 index 0000000000..3e1a1f67eb --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxatbegshi.pdf diff --git a/macros/jptex/latex/platex-tools/pxatbegshi.sty b/macros/jptex/latex/platex-tools/pxatbegshi.sty new file mode 100644 index 0000000000..77e00d6a54 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxatbegshi.sty @@ -0,0 +1,133 @@ +% +% pxatbegshi.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% -------------------------------------------------------------------- +% [Note] +% Previous version (2018/09/21 v0.4) was largely based on +% "cope with tate-direction" +% of bxpapersize.sty 2017/05/02 v0.3a by T. Yato. +% -- concept: execute all hooks in temporary yoko direction, +% -- by prepending \yoko and switching back to the original +% However, it was problematic when used with multicol.sty. +% +% Thus, in newer version (2019/09/07 v0.5), I reverted back to +% the original code (2018/09/21 v0.3), which was largely based on +% H. Kitagawa's on GitHub:texjporg/tex-jp-build#21. +% -- concept: execute all hooks inside yoko direction \vbox +% +% Update: version 2020/09/09 v0.6 supports LaTeX2e 2020-10-01 +% based on a method proposed by H. Kitagawa in lltjp-atbegshi.sty. +% +% Update: version 2020/09/25 v0.7 does nothing, since +% pLaTeX2e 2020-10-01 will support the situation natively. +% -------------------------------------------------------------------- +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxatbegshi} + [2021/05/31 v0.7c Patch to atbegshi for (u)pLaTeX] + +%% Since LaTeX2e 2020-10-01, atbegshi.sty is merely +%% an emulation by atbegshi-ltx.sty from ltshipout.dtx. + +\chardef\pxabgs@status=\z@ +\@ifl@t@r\fmtversion{2020/10/01}{\chardef\pxabgs@status=\@ne}{} +\ifnum\pxabgs@status=\@ne + % if LaTeX2e and pLaTeX2e are inconsistent, raise an error! + \@ifl@t@r\pfmtversion{2020/10/01}{% + \PackageInfo{pxatbegshi}{This package is no longer needed}% + }{% + \PackageError{pxatbegshi}{Inconsistent LaTeX2e/pLaTeX2e combination}\@ehc + }% + \RequirePackage{atbegshi}% input anyway + \expandafter\endinput +\fi + +%% The rest of this package is meant for +%% LaTeX2e 2020-02-02 PL5 or older. + +\RequirePackage{atbegshi} + +\ifx\AtBegShi@Output\@undefined + \PackageError{pxatbegshi}{This should not happen}\@ehc + \expandafter\endinput +\fi + +%% preparations +\def\pxabgs@pkgname{pxatbegshi} +\def\pxabgs@warn{\PackageWarningNoLine\pxabgs@pkgname} + +%% internal macros are locally effective +\begingroup + +%--------------------------------------- helpers + +%% unique tokens +\def\pxabgs@mark{\pxabgs@mark@} +\def\pxabgs@fin{\pxabgs@fin@} + +%% \pxabgs@patch@cmd\CMD{<orig>}{<new>} +\@onlypreamble\pxabgs@patch@cmd +\def\pxabgs@patch@cmd#1#2#3{% + \def\pxabgs@next##1#2##2\pxabgs@mark##3\pxabgs@fin{% + \ifx\pxabgs@mark##3\pxabgs@mark + \let\pxabgs@fragment\relax + \else + \def\pxabgs@fragment{##2}% + \def#1{##1#3##2}% + \fi}% + \expandafter\pxabgs@next#1\pxabgs@mark#2\pxabgs@mark\pxabgs@fin} + +%--------------------------------------- + +% prepare +\let\pxabgs@AtBegShi@Output\AtBegShi@Output +% try first patch +\pxabgs@patch@cmd\pxabgs@AtBegShi@Output + {\let\AtBegShi@OrgProtect\protect}% + {\setbox8\vbox\bgroup\yoko\let\AtBegShi@OrgProtect\protect} +\ifx\pxabgs@fragment\relax % failure + \let\pxabgs@AtBegShi@Output\relax +\else % success, try second patch + \pxabgs@patch@cmd\pxabgs@AtBegShi@Output + {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox}% + {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox\egroup} + \ifx\pxabgs@fragment\relax % failure + \let\pxabgs@AtBegShi@Output\relax + \else % success, try third patch + \pxabgs@patch@cmd\pxabgs@AtBegShi@Output{% + \begingroup + \setbox\AtBeginShipoutBox\box\AtBeginShipoutBox + \endgroup + \let\protect\AtBegShi@OrgProtect + }{% + \begingroup + \setbox\AtBeginShipoutBox\box\AtBeginShipoutBox + \endgroup + \let\protect\AtBegShi@OrgProtect + \egroup + } + \ifx\pxabgs@fragment\relax % failure + \let\pxabgs@AtBegShi@Output\relax + \fi + \fi +\fi +% commit the change only when successful +\ifx\pxabgs@AtBegShi@Output\relax + \pxabgs@warn{Failed in patching \string\AtBegShi@Output} +\else + \global\let\AtBegShi@Output\pxabgs@AtBegShi@Output +\fi + +\endgroup +%% internal macros are no longer effective + +%--------------------------------------- done + +\endinput +%% EOF diff --git a/macros/jptex/latex/platex-tools/pxatbegshi.tex b/macros/jptex/latex/platex-tools/pxatbegshi.tex new file mode 100644 index 0000000000..0b1b326835 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxatbegshi.tex @@ -0,0 +1,98 @@ +%# -*- 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{pxatbegshi} +\GetFileInfo{pxatbegshi.sty} +\title{Package \textsf{pxatbegshi} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{atbegshi} (written by Heiko Oberdiek) provides +a command \verb+\AtBeginShipout{...}+, however it cannot be used +with Japanese classes for vertical writing (tarticle.cls, etc). +\begin{verbatim} + ! Incompatible direction list can't be unboxed. + \AtBeginShipoutAddToBox ...box \AtBeginShipoutBox + \kern 0pt}\AtBegShi@restor... +\end{verbatim} +The package \textsf{pxatbegshi} provides a patch for \textsf{atbegshi} +to work with both horizontal and vertical writing. + +With \pLaTeXe~2020-10-01 or later, this package does +nothing because the \pLaTeXe\ itself handles the situation. +Therefore, you will not need this package at all. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +Heiko Oberdiek氏による\textsf{atbegshi}パッケージは +\verb+\AtBeginShipout{...}+というコマンドを提供しますが、これを +p\LaTeX の縦組クラス(tarticle.clsなど)で使うとエラーが出てしまいます +\footnote{単に縦組クラスで\textsf{atbegshi}パッケージを読み込んだだけ +では、エラーは出ないようです。}。 +この\textsf{pxatbegshi}パッケージは、縦組クラスでも +\textsf{atbegshi}パッケージの機能を使えるようにするためのものです。 +もちろん、横組クラスで\textsf{pxatbegshi}パッケージを使用しても +ほぼ問題は起きません。ただし、制約事項として +\begin{quote} +「\verb+\AtBeginShipout+の中身が外部垂直モードで実行されること」を +想定した使用は\emph{サポートしない} +\end{quote} +と明言します(例:\verb+aminophen/platex-tools#15+)。 + +\LaTeXe~2020-10-01以降では、\textsf{atbegshi}と同等の機能がカーネルに +実装されていて、その対処は\pLaTeXe{}カーネルでなされます。 +この場合、\textsf{pxatbegshi}パッケージは何もしません。 + +\newpage +\section{使いかた} + +使いかたは、\textsf{atbegshi}パッケージの代わりに、あるいは +\textsf{atbegshi}パッケージに追加して、\textsf{pxatbegshi}パッケージを +読みこむだけです。使用例: +\begin{verbatim} + \documentclass[a4paper]{tarticle} + \usepackage[dvipdfmx]{graphicx} + \usepackage{pxatbegshi} + \AtBeginShipout{% + \AtBeginShipoutUpperLeft{% + \parbox[t][\paperheight][b]{\paperwidth}{% + \includegraphics[width=210truemm]{background.eps}}}} + \begin{document} + 背景に透かしを入れます。 + \end{document} +\end{verbatim} + +\section{謝辞} + +本パッケージの実装は、北川さん(Hironori Kitagawa)による +「\verb+\AtBegShi@Output+の処理を強引に横組でやらせるコード」 +をベースにしています\footnote{2018/09/21 v0.4では +Takayuki Yato (ZR) さんによる\textsf{bxpapersize}パッケージを参考に +していましたが、\textsf{multicol}パッケージで問題が起きるようなので +v0.3以前と同様に北川さんのコードベースに戻しました。}。 + +\section*{References} + +\begin{itemize} +\item utbookでatbegshiパッケージを使いたい\\ + \texttt{https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2134} +\item \relax[tex-jp-build] [ptex] ページ・数式の組方向 + (※北川さんのコードの初出)\\ + \texttt{https://github.com/texjporg/tex-jp-build/issues/21} +\item CTAN: Package \textsf{bxpapersize}\\ + \texttt{https://ctan.org/pkg/bxpapersize} +\end{itemize} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxeverysel.pdf b/macros/jptex/latex/platex-tools/pxeverysel.pdf Binary files differnew file mode 100644 index 0000000000..29460fef39 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeverysel.pdf diff --git a/macros/jptex/latex/platex-tools/pxeverysel.sty b/macros/jptex/latex/platex-tools/pxeverysel.sty new file mode 100644 index 0000000000..de267c9d56 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeverysel.sty @@ -0,0 +1,192 @@ +% +% pxeverysel.sty +% originally written by Takayuki Yato (ZR) +% and modified by Hironobu Yamashita +% +% This package is distributed as part of the platex-tools bundle +% maintained by Hironobu Yamashita +% by courtesy of the original author. +% https://github.com/aminophen/platex-tools +% +% -------------------------------------------------------------------- +% [Note] +% Update: since version 2021/02/13 v0.9a, this package does nothing, +% as pLaTeX2e 2021-06-01 will support the situation natively. +% -------------------------------------------------------------------- +% + +%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pxeverysel} + [2021/07/13 v0.9d Patch to everysel for (u)pLaTeX] + +%% Since LaTeX2e 2021-06-01, everysel.sty is merely +%% an emulation by everysel-ltx.sty from firstaid. + +\chardef\pxys@status=\z@ +\@ifl@t@r\fmtversion{2021/06/01}{\chardef\pxys@status=\@ne}{} +\ifnum\pxys@status=\@ne + % if LaTeX2e and pLaTeX2e are inconsistent, raise an error! + \ifx\delayed@k@adjustment\@undefined + \PackageError{pxeverysel}{Inconsistent LaTeX2e/pLaTeX2e combination}\@ehc + \else + \PackageInfo{pxeverysel}{This package is no longer needed}% + \fi + \RequirePackage{everysel}% input anyway + \expandafter\endinput +\fi + +%% The rest of this package is meant for +%% LaTeX2e 2020-10-01 PL4 or older. + +%% in case it's too late ... +\@ifpackageloaded{everysel}{% + % everysel.sty removes \@EverySelectfont@Init once it is used + \ifx\@EverySelectfont@Init\undefined + \PackageError{pxeverysel}{% + Patch too late!\MessageBreak + Load pxeverysel earlier}\@ehc + \expandafter\endinput + \fi +}{} + +%% load it, but ensure that \@EverySelectfont@Init is not executed +% [Note] everysel.sty contains +% \AtBeginDocument{\@EverySelectfont@Init} +% at the end. In most cases, the execution is actually delayed; +% however, +% \AtBeginDocument{\RequirePackage{everysel}} +% can execute it immediately (e.g. found in sidecap.sty). +% In this case, delay it until the end of pxeverysel.sty. +\ifx\AtBeginDocument\@firstofone + \def\pxys@begindocumenthook{\let\AtBeginDocument\@firstofone} + \def\AtBeginDocument{\g@addto@macro\pxys@begindocumenthook} + \AtEndOfPackage{\pxys@begindocumenthook} +\fi +\RequirePackage{everysel} + +%% support for (u)pLaTeX font tracing +\@ifpackageloaded{tracefnt}{% + \ifx\kanjiskip\@undefined\else + \ifnum\jis"2121="3000 \RequirePackage{uptrace}% + \else \RequirePackage{ptrace}\fi\fi}{} + +%--------------------------------------- helpers + +%% preparations +\def\pxys@pkgname{pxeverysel} +\def\pxys@warn{\PackageWarningNoLine\pxys@pkgname} + +%% unique tokens +\def\pxys@mark{\pxys@mark@} +\def\pxys@fin{\pxys@fin@} + +%% \pxys@patch@cmd\CMD{<pre>}{<post>}{<new>} +\@onlypreamble\pxys@patch@cmd +\def\pxys@patch@cmd#1#2#3#4{% + \def\pxys@next##1#2##2#3##3\pxys@mark##4\pxys@fin{% + \ifx\pxys@mark##4\pxys@mark + \let\pxys@fragment\relax + \else + \def\pxys@fragment{##2}% + \def#1{##1#4##3}% + \fi}% + \expandafter\pxys@next#1\pxys@mark#2#3\pxys@mark\pxys@fin} + +%% \pxys@append@to\CSa\CSb +\@onlypreamble\pxys@append@to +\def\pxys@append@to#1#2{% + \expandafter\g@addto@macro\expandafter#1\expandafter{#2}} + +%% \pxys@term +\let\pxys@term\relax + +%--------------------------------------- + +%% variables +\let\pxys@self@hook\@empty +\let\pxys@everysel@hook\@empty +\@onlypreamble\pxys@selectfont +\let\pxys@selectfont\relax +\@onlypreamble\pxys@org@selectfont +\let\pxys@org@selectfont\relax +\@onlypreamble\pxys@new@selectfont +\let\pxys@new@selectfont\relax + +%% \@EverySelectfont@Init redefined +\@onlypreamble\pxys@EverySelectfont@Init +\let\pxys@EverySelectfont@Init\@EverySelectfont@Init +\def\@EverySelectfont@Init{% + \pxys@preproc + \pxys@EverySelectfont@Init + \pxys@postproc} + +%% \pxys@preproc +\@onlypreamble\pxys@preproc +\def\pxys@preproc{% + % prepare + \expandafter\let\expandafter\pxys@selectfont + \csname selectfont \endcsname + \let\pxys@org@selectfont\pxys@selectfont + % extract "pre-\size@update" insertion + \pxys@append@to\pxys@selectfont\pxys@term + \pxys@patch@cmd\pxys@selectfont + {\pickup@font\font@name}{\size@update\pxys@term}% % plfonts/ptrace + {\pickup@font\font@name\pxys@self@hook\pxys@everysel@hook + \size@update}% + \ifx\pxys@fragment\relax + \let\pxys@selectfont\pxys@org@selectfont + % extract "pre-\enc@update" insertion + \pxys@patch@cmd\pxys@selectfont + {\pickup@font\font@name}{\size@update\enc@update}% % ltfsstrc/tracefnt + {\pickup@font\font@name\pxys@self@hook\pxys@everysel@hook + \size@update\enc@update}% + \ifx\pxys@fragment\relax % failure + \let\pxys@selectfont\relax + \else + \pxys@append@to\pxys@self@hook\pxys@fragment + \fi + \else + \pxys@append@to\pxys@self@hook\pxys@fragment + \fi + \let\pxys@new@selectfont\pxys@selectfont + % prepare for everysel routine + \let\pxys@CheckCommand\CheckCommand + \let\CheckCommand\@gobble + % hack for disabling duplicate font info + \expandafter\let\expandafter\pxys@ver@tracefnt + \csname ver@tracefnt.sty\endcsname + \expandafter\let\csname ver@tracefnt.sty\endcsname\@undefined} + +%% \pxys@postproc +\@onlypreamble\pxys@postproc +\def\pxys@postproc{% + % revert the hack for disabling duplicate font info + \expandafter\let\csname ver@tracefnt.sty\endcsname\pxys@ver@tracefnt + \let\pxys@ver@tracefnt\@undefined + % post handling of everysel routine + \let\CheckCommand\pxys@CheckCommand + \let\pxys@CheckCommand\@undefined + \expandafter\let\expandafter\pxys@selectfont + \csname selectfont \endcsname + % extract the code insertion by everysel + \pxys@patch@cmd\pxys@selectfont + {\pickup@font\font@name}{\size@update\enc@update}{}% + \ifx\pxys@fragment\relax % failure + \let\pxys@new@selectfont\relax + \else % success + \pxys@append@to\pxys@everysel@hook\pxys@fragment + \fi + % commit the change + \ifx\pxys@new@selectfont\relax % failure + \let\pxys@selectfont\pxys@org@selectfont % revert + \pxys@warn{Failed in patching \string\selectfont}% + \else % success + \let\pxys@selectfont\pxys@new@selectfont + \fi + \expandafter\let\csname selectfont \endcsname\pxys@selectfont} + +%--------------------------------------- done + +\endinput +%% EOF diff --git a/macros/jptex/latex/platex-tools/pxeverysel.tex b/macros/jptex/latex/platex-tools/pxeverysel.tex new file mode 100644 index 0000000000..156fa720e7 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeverysel.tex @@ -0,0 +1,73 @@ +%# -*- 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{pxeverysel} +\GetFileInfo{pxeverysel.sty} +\title{Package \textsf{pxeverysel} \fileversion} +\author{Takayuki Yato \& Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{everysel}, written by Martin Schr\"oder, +is incompatible with the definition of \verb+\selectfont+ redefined +by p\LaTeX\ kernel. For this reason, when using \textsf{everysel}, +font selection scheme for Japanese characters goes wrong. +The package \textsf{pxeverysel} provides a patch for \textsf{everysel} +to work with p\LaTeX\ font selection. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +Martin Schr\"oder氏による\textsf{everysel}パッケージをp\LaTeX で +使用すると、日本語の文字サイズが変わらなくなったり、 +\textsf{otf}パッケージで文字化けが起こったりします。 +これは、\pLaTeX カーネルが日本語用に再定義している\verb+\selectfont+が、 +\textsf{everysel}によって書き換えられてしまうためです。 +この\textsf{pxeverysel}パッケージを読み込むことで、p\LaTeX でも +\textsf{everysel}パッケージを使えるようになります。 + +\LaTeXe~2021-06-01以降では、\textsf{everysel}と同等の機能がカーネルに +実装されていて、その対処は\pLaTeXe{}カーネルでなされます。 +この場合、\textsf{pxeverysel}パッケージは何もしません。 + +\newpage +\section{使いかた} + +使いかたは、\textsf{everysel}パッケージの代わりに、あるいは +\textsf{everysel}パッケージに追加して、\textsf{pxeverysel}パッケージを +読み込むだけです\footnote{稀に\\\texttt{% +!~Package pxeverysel Error:~Patch too late!\\ +(pxeverysel)~~~~~~~~~~~~~~~~Load pxeverysel earlier.% +}\\というエラーが出ることがあります。この場合は、 +\textsf{pxeverysel}パッケージを少し早めに読み込んでみてください。}。 +\textsf{everysel}を内部で読み込んでいる\textsf{ragged2e}を例に示します: +\begin{verbatim} + \documentclass[a4paper]{jsarticle} + \usepackage{ragged2e}% 読み込むだけでアウト + \usepackage{pxeverysel} + \begin{document} + % 和文のフォントサイズが変わらない! + {\TeX}はアレ{\Large{\TeX}はアレ} + \end{document} +\end{verbatim} + +\section*{References} + +\begin{itemize} +\item vwcol.styとutf.styを併用したい\\ + \texttt{http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1763} +\item pLaTeXでeveryselしたい話\\ + \texttt{http://d.hatena.ne.jp/zrbabbler/20151212/1449898508} +\end{itemize} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxeveryshi.pdf b/macros/jptex/latex/platex-tools/pxeveryshi.pdf Binary files differnew file mode 100644 index 0000000000..1e1e1ced15 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeveryshi.pdf diff --git a/macros/jptex/latex/platex-tools/pxeveryshi.sty b/macros/jptex/latex/platex-tools/pxeveryshi.sty new file mode 100644 index 0000000000..5142e49043 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeveryshi.sty @@ -0,0 +1,61 @@ +% +% pxeveryshi.sty +% originally written by Takayuki Yato (ZR) +% and modified by Hironobu Yamashita +% +% This package is distributed as part of the platex-tools bundle +% maintained by Hironobu Yamashita +% by courtesy of the original author. +% https://github.com/aminophen/platex-tools +% +% -------------------------------------------------------------------- +% [Note] +% Update: version 2020/09/25 v0.2 does nothing, since +% pLaTeX2e 2020-10-01 will support the situation natively. +% -------------------------------------------------------------------- +% + +%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pxeveryshi} + [2021/05/31 v0.2d everyshi package for (u)pLaTeX] + +%% Since LaTeX2e 2020-10-01, everyshi.sty is merely +%% an emulation by everyshi-ltx.sty from ltshipout.dtx. + +\chardef\pxevsh@status=\z@ +\@ifl@t@r\fmtversion{2020/10/01}{\chardef\pxevsh@status=\@ne}{} +\ifnum\pxevsh@status=\@ne + % if LaTeX2e and pLaTeX2e are inconsistent, raise an error! + \@ifl@t@r\pfmtversion{2020/10/01}{% + \PackageInfo{pxeveryshi}{This package is no longer needed}% + }{% + \PackageError{pxeveryshi}{Inconsistent LaTeX2e/pLaTeX2e combination}\@ehc + }% + \RequirePackage{everyshi}% input anyway + \expandafter\endinput +\fi + +%% The rest of this package is meant for +%% LaTeX2e 2020-02-02 PL5 or older. + +\RequirePackage{everyshi} + +\ifx\@EveryShipout@Output\@undefined + \PackageError{pxeveryshi}{This should not happen}\@ehc + \expandafter\endinput +\fi + +\def\@EveryShipout@Output{% + \setbox8\vbox{% + \yoko + \@EveryShipout@Hook + \@EveryShipout@AtNextHook + \global\setbox\@cclv=\box\@cclv + }% + \gdef\@EveryShipout@AtNextHook{}% + \@EveryShipout@Org@Shipout\box\@cclv +} + +\endinput +%% EOF diff --git a/macros/jptex/latex/platex-tools/pxeveryshi.tex b/macros/jptex/latex/platex-tools/pxeveryshi.tex new file mode 100644 index 0000000000..0c5e2e5e9f --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxeveryshi.tex @@ -0,0 +1,77 @@ +%# -*- 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{pxeveryshi} +\GetFileInfo{pxeveryshi.sty} +\title{Package \textsf{pxeveryshi} \fileversion} +\author{Takayuki Yato \& Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{everyshi}, written by Martin Schr\"oder, +cannot be used with Japanese classes for vertical writing +(tarticle.cls, etc). This behavior is not comfortable, since +\textsf{everyshi} is required by some other packages +(e.g. \textsf{tikz}) and causes an error: +\begin{verbatim} + ! Incompatible direction list can't be unboxed. +\end{verbatim} +The package \textsf{pxeveryshi} provides a patch for \textsf{everyshi} +to work with both horizontal and vertical writing. + +With \pLaTeXe~2020-10-01 or later, this package does +nothing because the \pLaTeXe\ itself handles the situation. +Therefore, you will not need this package at all. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +Martin Schr\"oder氏による\textsf{everyshi}パッケージは、 +p\LaTeX の縦組クラス(tarticle.clsなど)で使うとエラーが出てしまいます。 +この挙動は、たとえば\textsf{tikz}のような内部で\textsf{everyshi}パッケージ +を必要とするパッケージを縦組で使用する際に問題になります。 +この\textsf{pxeveryshi}パッケージを読み込むことで、縦組クラスでも +\textsf{everyshi}パッケージ(およびこれに依存するパッケージ)が +使えるようになります。 + +\LaTeXe~2020-10-01以降では、\textsf{everyshi}と同等の機能がカーネルに +実装されていて、その対処は\pLaTeXe{}カーネルでなされます。 +この場合、\textsf{pxeveryshi}パッケージは何もしません。 + +\section{使いかた} + +使いかたは、\textsf{everyshi}パッケージの代わりに、あるいは +\textsf{everyshi}パッケージに追加して、\textsf{pxeveryshi}パッケージを +読みこむだけです。使用例: +\begin{verbatim} + \documentclass{tarticle} + \usepackage[dvipdfmx]{graphicx} + \usepackage{tikz} + \usepackage{pxeveryshi} + \begin{document} + \begin{tikzpicture} + \draw (0,0) -- (1,2); + \end{tikzpicture} + \end{document} +\end{verbatim} + +\section*{References} + +\begin{itemize} +\item tikz を縦書きで\\ + \texttt{https://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/56760.html} +\item Re: tikz を縦書きで\\ + \texttt{https://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/56761.html} +\end{itemize} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxftnright.pdf b/macros/jptex/latex/platex-tools/pxftnright.pdf Binary files differnew file mode 100644 index 0000000000..4119597606 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxftnright.pdf diff --git a/macros/jptex/latex/platex-tools/pxftnright.sty b/macros/jptex/latex/platex-tools/pxftnright.sty new file mode 100644 index 0000000000..e560c7e9f8 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxftnright.sty @@ -0,0 +1,153 @@ +% +% pxftnright.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package `pxftnright' is based on: +% * ftnright.sty in latex-tools (2014/10/28 v1.1f) +% * plcore.ltx in platex +% (2001/09/26 v1.2a -- 2021/12/08 v1.3l) +% +% Problems with ftnright to use with pLaTeX: +% * \@startcolumn is redefined +% (incompatible with vertical typesetting) +% * \@makecol is redefined +% (bottom float after footnote) +% * \@makefntext is redefined +% (incompatible with some pLaTeX classes) +% * \footnotesep is not suitable for vertical typesetting +% when used with pLaTeX 2016/11/29 or earlier +% (rather a problem of \strutbox in pLaTeX2e kernel) +% so, this package provides patches. +% + +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxftnright} + [2021/05/24 v1.1a footnote layout package for pLaTeX] + +%% save \@makefntext definition from pLaTeX class +\@ifpackageloaded{ftnright}{% + \PackageError{pxftnright}{% + Package ftnright is already loaded!\MessageBreak + Load pxftnright earlier}\@ehc +}{} +\let\pxftn@makefntext\@makefntext + +%% load ftnright package +\RequirePackage{ftnright} + +%% patches for ftnright to work fine with pLaTeX +%% This code is based on pLaTeX2e 2021-06-01 community ed. + +\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 + +\def\@startcolumn{% + \ifx\@deferlist\@empty + \global\@fcolmadefalse + \global\@colroom\@colht + \else + \ifvoid\footins\else + \ftn@amount\ht\footins + \advance\ftn@amount\dp\footins + \advance\ftn@amount\skip\footins + \fi + \global\advance\@colht-\ftn@amount + \global\@colroom\@colht + \@xstartcol + \global\advance\@colht\ftn@amount + \global\advance\@colroom\ftn@amount + \fi + \if@fcolmade + \setbox\@cclv\box\@outputbox + \@makecol + \else +%%%%% change for pLaTeX (import from \@reinserts in plcore) + \ifvoid\footins\else\insert\footins{% + \iftbox\footins\tate\else\yoko\fi + \unvbox\footins}\fi +%%%%% + \fi} + +\def\@makecol{% +%%%%% change for pLaTeX + \setbox\@outputbox\box\@cclv +%%%%% + \if@firstcolumn + \if@twocolumn \else + \ifvoid\footins \else + \@latexerr{ftnright package + used in one-column mode}% + {The ftnright package was designed to + work with LaTeX's standard^^Jtwocolumn + option. It does *not* work with the + multicol package.^^JSo please specify + `twocolumn' in the + \noexpand\documentclass command.}% + \shipout\box\footins \fi\fi + \ifnum\insertpenalties>\z@ + \@latexerr{ftnright package + scrambled footnotes}% + {There is too much footnote material in + the first column and ftnright^^Jis + unable to cope with this.^^JYou need + to reduce the amount to get a properly + formatted page.}% + \fi + \fi +%%%%% change for pLaTeX (bottom float first) + \xdef\@freelist{\@freelist\@midlist}% + \global \let \@midlist \@empty + \@combinefloats + \let\pltx@textbottom\@textbottom %%% pLaTeX + \if@firstcolumn\else + \ifvoid\footins\else + \setbox\@outputbox \vbox {% + \boxmaxdepth \@maxdepth + \unvbox \@outputbox + \@textbottom %%% pLaTeX + \vskip \skip\footins + \color@begingroup + \normalcolor + \footnoterule + \unvbox \footins + \color@endgroup + }% + \let\@textbottom\relax %%% pLaTeX + \fi + \fi +%%%%% + \ifvbox\@kludgeins + \@makespecialcolbox + \else + \setbox\@outputbox\vbox to\@colht + {\boxmaxdepth\maxdepth + \@texttop + \dimen@ \dp\@outputbox + \unvbox \@outputbox + \pltx@adjust@wd@outputbox %%% pLaTeX + \vskip -\dimen@ + \@textbottom}% + \fi + \let\@textbottom\pltx@textbottom %%% pLaTeX + \global\maxdepth\@maxdepth +} + +%% adjust \footnotesep for vertical typesetting +\AtBeginDocument + {\global\footnotesep\ht\iftdir\tstrutbox\else\strutbox\fi} + +%% restore \@makefntext +\let\@makefntext\pxftn@makefntext + +\endinput diff --git a/macros/jptex/latex/platex-tools/pxftnright.tex b/macros/jptex/latex/platex-tools/pxftnright.tex new file mode 100644 index 0000000000..d34c9dcfb9 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxftnright.tex @@ -0,0 +1,66 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle} +\begingroup + \def\NeedsTeXFormat#1\ProvidesPackage#2[#3 #4 #5]{% + \gdef\fileversion{#4}\gdef\filedate{#3}\endinput} + \input{pxftnright.sty} +\endgroup +\title{Package \textsf{pxftnright} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{ftnright}, included in \textsf{latex-tools} bundle, +cannot be used with Japanese classes for vertical writing +(tarticle.cls, etc). The package \textsf{pxftnright} provides some +patches to \textsf{ftnright} to work fine with vertical writing. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +The rest of this document is written in Japanese, and includes some +examples of usage. + +\bigskip + +\textsf{latex-tools}バンドルに含まれる\textsf{ftnright}パッケージは、 +p\LaTeX の縦組クラス(tarticle.clsなど)で使うとエラーが出てしまいます。 +この\textsf{pxftnright}パッケージを読み込むことで、縦組クラスでも +\textsf{ftnright}パッケージと同等の機能(二段組において、横組なら +脚注が右カラムに、縦組なら傍注\footnote{\verb+\footnote+という命令を +使用して得られるのは、縦組では正式には「傍注」と呼びます。}が下カラムに +まとまる)を得ることができます。 + +\section{使いかた} + +\textsf{ftnright}パッケージの代わりに、あるいは +\textsf{ftnright}パッケージより\emph{前}に、 +\textsf{pxftnright}パッケージを読みこみます(後に読みこんだ場合は +対策が手遅れになるため、エラーを出します)。 + +\begin{verbatim} + \documentclass[twocolumn]{tarticle} + \usepackage{pxftnright}% ftnright の代わり + \begin{document} + 縦組では\verb+\footnote+命令を使用すると、 + 傍注が出てきます\footnote{紛らわしいですね。}。 + また、… + \end{document} +\end{verbatim} + +\section*{References} + +\begin{itemize} +\item 縦書き2段組の脚注について\\ + \texttt{http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1896} +\end{itemize} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxmulticol.pdf b/macros/jptex/latex/platex-tools/pxmulticol.pdf Binary files differnew file mode 100644 index 0000000000..50a904177e --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxmulticol.pdf diff --git a/macros/jptex/latex/platex-tools/pxmulticol.sty b/macros/jptex/latex/platex-tools/pxmulticol.sty new file mode 100644 index 0000000000..cc0da9adeb --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxmulticol.sty @@ -0,0 +1,25 @@ +% +% pxmulticol.sty +% written by Hironobu Yamashita (@aminophen) +% +% This package is part of the platex-tools bundle. +% https://github.com/aminophen/platex-tools +% +% This package is expected to be compatible with +% * multicol.sty in latex-tools +% (1995/10/19 v1.5l -- 2021/11/30 v1.9d) +% + +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxmulticol} + [2018/11/25 v0.2 multicol package for pLaTeX] +\RequirePackageWithOptions{multicol} + +%% patching internal code for multicol.sty +% +\def\reinsert@footnotes{\ifvoid\footins\else + \insert\footins{\iftbox\footins\tate\else\yoko\fi}\fi} +% +%% done + +\endinput diff --git a/macros/jptex/latex/platex-tools/pxmulticol.tex b/macros/jptex/latex/platex-tools/pxmulticol.tex new file mode 100644 index 0000000000..352c46a541 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxmulticol.tex @@ -0,0 +1,62 @@ +%# -*- coding: utf-8 -*- +\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016) + \epTeXinputencoding utf8 % ensure utf-8 encoding for platex +\fi + +\documentclass[a4paper]{jsarticle} +\begingroup + \def\NeedsTeXFormat#1\ProvidesPackage#2[#3 #4 #5]{% + \gdef\fileversion{#4}\gdef\filedate{#3}\endinput} + \input{pxmulticol.sty} +\endgroup +\title{Package \textsf{pxmulticol} \fileversion} +\author{Hironobu Yamashita} +\date{\filedate} +\begin{document} + +\maketitle + +Package \textsf{multicol}, included in \textsf{latex-tools} bundle, +throws an error when \verb+\footnote+ appears in vertical writing on +(u)p\LaTeX. The package \textsf{pxmulticol} provides a patch to +solve this problem. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +The rest of this document is written in Japanese, and includes some +examples of usage. + +\bigskip + +\textsf{latex-tools}バンドルに含まれる\textsf{multicol}パッケージは、 +縦組で脚注 (\verb+\footnote+) を使うとエラーを出してしまいます。 +この\textsf{pxmulticol}パッケージを読み込むことで、縦組クラスでも +\textsf{multicols}環境内で脚注を使うことができるようになります。 + +\section{使いかた} + +\textsf{multicol}パッケージの代わりに、あるいは追加で +\textsf{pxmulticol}パッケージを読み込みます。 + +\begin{verbatim} + \documentclass[a4paper]{tarticle} + \usepackage{pxmulticol}% multicol の代わり + \begin{document} + \begin{multicols}{2} + 縦組で段組をする場合も、脚注\footnote{こんな感じです。}を使う + ことができます。 + \end{multicols} + \end{document} +\end{verbatim} + +\section*{References} + +\begin{itemize} +\item 縦書き二段組における段移動\\ + \texttt{https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2535} +\end{itemize} + +\end{document} diff --git a/macros/jptex/latex/platex-tools/pxxspace.pdf b/macros/jptex/latex/platex-tools/pxxspace.pdf Binary files differnew file mode 100644 index 0000000000..fb9645aa46 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxxspace.pdf diff --git a/macros/jptex/latex/platex-tools/pxxspace.sty b/macros/jptex/latex/platex-tools/pxxspace.sty new file mode 100644 index 0000000000..384a157be6 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxxspace.sty @@ -0,0 +1,133 @@ +% +% pxxspace.sty +% written by Takayuki Yato (ZR) +% +% This package is distributed as part of the platex-tools bundle +% maintained by Hironobu Yamashita +% by courtesy of the original author. +% https://github.com/aminophen/platex-tools +% +% Original copyright notice: +% -------------------------------------------------- +% Copyright (c) 2019 Takayuki YATO (aka. "ZR") +% GitHub: https://github.com/zr-tex8r +% Twitter: @zr_tex8r +% +% This package is distributed under the MIT License. +% -------------------------------------------------- +% +% This package is expected to be compatible with +% * xspace.sty in latex-tools +% (2009/10/20 v1.13 -- 2014/10/28 v1.13) +% + +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{pxxspace} + [2019/09/23 v0.2a Patch for xspace for pLaTeX/upLaTeX] +\def\pxxs@pkgname{pxxspace} + +%--------------------------------------- preparations + +%% e-TeX is required +\RequirePackage{etoolbox}[2011/01/03]% v2.1 +\ifx\numdef\@undefined \expandafter\endinput \fi + +%% packages +\RequirePackage{xspace}[2009/10/20]% v1.13 + +%% check if patchable +\chardef\pxxs@tmpa=\@ne +\ifpatchable\@xspace{% + \@xspace@lettoken@if@letter@TF +}{}{\chardef\pxxs@tmpa=\z@} +\ifpatchable\@xspace@eTeX@setup{% + \begingroup +}{}{\chardef\pxxs@tmpa=\z@} +\ifnum\pxxs@tmpa=\z@ + \PackageError\pxxs@pkgname + {Failure in patching}% + {Package loading is aborted.\MessageBreak\@ehc}% +\expandafter\endinput\fi\relax + +%--------------------------------------- helpers + +%% packages +\RequirePackage{pdftexcmds} + +%% engine check +\newif\ifpxxs@uptex +\pdf@isprimitive\forcecjktoken\forcecjktoken{\pxxs@uptextrue}{} + +%% \pxxs@forcecjktoken +\ifpxxs@uptex + \let\pxxs@forcecjktoken\forcecjktoken +\else + \let\pxxs@forcecjktoken\relax +\fi + +%--------------------------------------- adjustments to xspace + +%% \pxxs@jt@XXX : probe tokens +\begingroup + \def\do#1#2#3{% + \kcatcode#2=#3\relax \kansujichar1=#2\relax + \edef\next{% + \global\let\noexpand#1=\scantokens\expandafter{\kansuji1}% + }\next} + \pxxs@forcecjktoken + \everyeof{\noexpand}% disable EOF marker + \do\pxxs@jt@kanji{\jis"3441}{16}% + \do\pxxs@jt@kana{\jis"2422}{17}% + \do\pxxs@jt@other{\jis"2123}{18}% + \ifpxxs@uptex + \do\pxxs@jt@hangul{\ucs"D55C}{19}% + \fi +\endgroup + +%% \pxxs@lettoken@if@jachar{<true>}{<false>} +% Checks if \@let@token is a ja-character token. +% NB: Here \@let@token might be an \outer-token. +\let\@let@token\relax +\def\pxxs@tmpa#1#2{\unexpanded{% + \ifcat\noexpand\@let@token#1\expandafter\@firstoftwo + \else \expandafter#2\fi}} +\edef\pxxs@lettoken@if@jachar{% + \pxxs@tmpa\pxxs@jt@kana\pxxs@lettoken@if@jachar@a} +\edef\pxxs@lettoken@if@jachar@a{% + \pxxs@tmpa\pxxs@jt@kanji\pxxs@lettoken@if@jachar@b} +\edef\pxxs@lettoken@if@jachar@b{% + \pxxs@tmpa\pxxs@jt@other\pxxs@lettoken@if@jachar@c} +\edef\pxxs@lettoken@if@jachar@c{% + \pxxs@tmpa\pxxs@jt@hangul\@secondoftwo} +\unless\ifpxxs@uptex + \let\pxxs@lettoken@if@jachar@c\@secondoftwo +\fi + +%% \pxxs@precheck +% Placed just before \@xspace@lettoken@if@letter@TF to modify the +% behavior of \@xspace so that spaces are omitted if the following +% token is a ja-character. +\def\pxxs@precheck#1{% + \pxxs@lettoken@if@jachar{\@gobbletwo}{#1}% +} + +%% patch \@xspace +\patchcmd\@xspace{%from + \@xspace@lettoken@if@letter@TF +}{%to + \pxxs@precheck + \@xspace@lettoken@if@letter@TF +}{}{} + +%% patch \@xspace@eTeX@setup +\patchcmd\@xspace@eTeX@setup{%from + \begingroup +}{%to + \begingroup + \pxxs@forcecjktoken +}{}{} + +%--------------------------------------- done +\endinput +%% EOF diff --git a/macros/jptex/latex/platex-tools/pxxspace.tex b/macros/jptex/latex/platex-tools/pxxspace.tex new file mode 100644 index 0000000000..cbdba8abf3 --- /dev/null +++ b/macros/jptex/latex/platex-tools/pxxspace.tex @@ -0,0 +1,100 @@ +%# -*- 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{pxxspace} +\GetFileInfo{pxxspace.sty} +\title{Package \textsf{pxxspace} \fileversion} +\author{Takayuki Yato} +\date{\filedate} + +%%%%% BEGIN +% +% \RESTOREXSPACE: restore original behavior to show difference +% +\makeatletter\def\RESTOREXSPACE{% +% +%% patch \@xspace +\patchcmd\@xspace{%from + \pxxs@precheck + \@xspace@lettoken@if@letter@TF +}{%to + \@xspace@lettoken@if@letter@TF +}{}{} +%% patch \@xspace@eTeX@setup +\patchcmd\@xspace@eTeX@setup{%from + \begingroup + \pxxs@forcecjktoken +}{%to + \begingroup +}{}{} +% +}\makeatother +% +%%%%% END + +\begin{document} + +\maketitle + +The command \verb+\xspace+ of package \textsf{xspace} +(included in \textsf{latex-tools} bundle) +results in wrong interword spacing when followed by +a Japanese character. +The package \textsf{pxxspace} provides a patch for \textsf{xspace} +to correct interword spacing with Japanese characters. + +This package is part of \textsf{platex-tools} bundle: +\begin{verbatim} + https://github.com/aminophen/platex-tools +\end{verbatim} + +\bigskip + +\textsf{xspace}パッケージ(\textsf{latex-tools}バンドルの一つ)が +提供する \verb+\xspace+ 命令は、その直後に和文文字を伴うときに +その和文文字との間のスペーシングが正しくなりません。 +そこで、\textsf{pxxspace}パッケージを読み込めば +和文文字との間のスペーシングが修正されます。 + +以下に例を示します。 +\begin{verbatim} + % Sample code + \documentclass{article} + \usepackage{pxxspace}% or, \usepackage{xspace} + \newcommand\myTeX{\TeX\xspace} + \begin{document} + % ASCII-Kanji interword spacing should be 20pt. + % At the same time, no spacing before JP punctuations. + \xkanjiskip 20pt % visible + \myTeX is great!\par + \myTeX, it's awesome!\par + \myTeX は素晴らしい!\par + \myTeX、超スゴイ!\par + \end{document} +\end{verbatim} + +\begin{quote} +\begin{multicols}{2} + \xkanjiskip 20pt % visible + \newcommand\myTeX{\TeX\xspace} + \long\def\TEST{% + \myTeX is great!\par + \myTeX, it's awesome!\par + \myTeX は素晴らしい!\par + \myTeX、超スゴイ!\par + } + % 正しいスペーシング: + Correct with \verb+\usepackage{pxxspace}+\par + \TEST + % 誤ったスペーシング: + \RESTOREXSPACE + Wrong with \verb+\usepackage{xspace}+\par + \TEST +\end{multicols} +\end{quote} + +\end{document} |