The files are now incorporated into texjporg/platex repository.
Last active
March 2, 2017 12:24
-
-
Save aminophen/e99951599e7740523696663a0b78606a to your computer and use it in GitHub Desktop.
pLaTeX の \strutbox の挙動のテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% This is file `test-strutbox.sty', for experimental use only. | |
% See: https://github.com/texjporg/platex/issues/20 | |
% Copyright (c) 2016 Hironobu Yamashita | |
% | |
\NeedsTeXFormat{pLaTeX2e} | |
\ProvidesPackage{test-strutbox} | |
[2016/11/15 v0.2 Test for strutbox in pLaTeX] | |
\PackageWarningNoLine{test-strutbox}{% | |
This is the unstable, experimental part of pLaTeX2e.\MessageBreak | |
This package may contain:\MessageBreak | |
* future patches to pLaTeX\MessageBreak | |
* experimental new features\MessageBreak | |
Please note that these can be removed without any\MessageBreak | |
announcement at some point in the future, and may\MessageBreak | |
also have some critical bugs. We appreciate any\MessageBreak | |
reports and comments. Thank you for your cooperation} | |
\RequirePackage[latest]{platexrelease} | |
% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% | |
% \section{支柱} % ここから下は plfonts.dtx を改変して作成したもの | |
% | |
% \subsubsection{支柱} | |
% 行間の調整などに用いる支柱です。 | |
% 支柱のもととなるボックスの大きさは、フォントサイズが変更されるたびに、 | |
% |\set@fontsize|コマンドによって変化します。 | |
% | |
% フォントサイズが変更されたときに、|\set@fontsize|コマンドで更新されます。 | |
% | |
% 従来、横組ボックス用の支柱は|\strutbox|で、高さと深さが7対3となっていました。 | |
% これはp\LaTeX{}単体では問題になりませんでしたが、海外製の\LaTeX{}パッケージを | |
% 縦組で使用した場合に、意図しない幅や高さが取得されることがありました。 | |
% この不都合を回避するため、コミュニティ版p\LaTeX{}では次の方法をとります。 | |
% \begin{itemize} | |
% \item |\ystrutbox|(新設):高さと深さが7対3の横組ボックス用の支柱 | |
% \item |\tstrutbox|:高さと深さが5対5の縦組ボックス用の支柱 | |
% \item |\zstrutbox|:高さと深さが7対3の縦組ボックス用の支柱 | |
% \item |\strutbox|(仕様変更):縦横のディレクションに応じて | |
% |\tstrutbox|または|\ystrutbox|に展開されるマクロ | |
% \end{itemize} | |
% すなわち、従来のp\LaTeX{}における|\strutbox|と同じ挙動を示すのが、 | |
% 新設された|\ystrutbox|ということになります。 | |
% | |
% \begin{macro}{\tstrutbox} | |
% \begin{macro}{\zstrutbox} | |
% |\tstrutbox|は高さと深さが5対5、 | |
% |\zstrutbox|は高さと深さが7対3の支柱ボックスとなります。 | |
% これらは縦組ボックスの行間の調整などに使います。 | |
% \begin{macrocode} | |
\newbox\tstrutbox | |
\newbox\zstrutbox | |
% \end{macrocode} | |
% \end{macro} | |
% \end{macro} | |
% | |
% \begin{macro}{\ystrutbox} | |
% |\ystrutbox|は高さと深さが7対3の横組ボックス用の支柱です。 | |
% \changes{v????}{????/??/??}{\cs{ystrutbox}を追加} | |
% \begin{macrocode} | |
%<platexrelease>\plIncludeInRelease{????/??/??}{\ystrutbox} | |
%<platexrelease> {Add \ystrutbox}% | |
%<*plcore|platexrelease> | |
\newbox\ystrutbox | |
%</plcore|platexrelease> | |
%<platexrelease>\plEndIncludeInRelease | |
%<platexrelease>\plIncludeInRelease{0000/00/00}{\ystrutbox} | |
%<platexrelease> {Add \ystrutbox}% | |
%<platexrelease>\let\ystrutbox\@undefined | |
%<platexrelease>\plEndIncludeInRelease | |
% \end{macrocode} | |
% \end{macro} | |
% | |
% \begin{macro}{\strut} | |
% ディレクションに応じて|\ystrutbox|と|\tstrutbox|を使い分けます。 | |
% ^^A |\strutbox|は|\yoko|ディレクションで組まれていますので、 | |
% ^^A 縦組ボックス内で|\unhcopy|をするとエラーとなります。 | |
% 元々このマクロは\file{ltplain.dtx}で定義されています。 | |
% | |
% \changes{v1.1c}{1995/08/24}{``\cs{centerling}~\cs{strut}''の幅がゼロに | |
% なってしまうのを修正} | |
% \changes{v1.3h}{1999/08/09}{縦組のとき、幅のあるボックスになってしまう | |
% のを修正} | |
% \changes{v????}{????/??/??}{\cs{strutbox}の代わりに\cs{ystrutbox}を使用} | |
% \begin{macrocode} | |
%<platexrelease>\plIncludeInRelease{????/??/??}{\strut} | |
%<platexrelease> {Use \ystrutbox}% | |
%<*plcore|platexrelease> | |
\def\strut{\relax | |
\ifydir | |
\ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi | |
\else | |
\ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi | |
\fi} | |
%</plcore|platexrelease> | |
%<platexrelease>\plEndIncludeInRelease | |
%<platexrelease>\plIncludeInRelease{0000/00/00}{\strut} | |
%<platexrelease> {Use \ystrutbox}% | |
%<platexrelease>\def\strut{\relax | |
%<platexrelease> \ifydir | |
%<platexrelease> \ifmmode\copy\strutbox\else\unhcopy\strutbox\fi | |
%<platexrelease> \else | |
%<platexrelease> \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi | |
%<platexrelease> \fi} | |
%<platexrelease>\plEndIncludeInRelease | |
% \end{macrocode} | |
% \end{macro} | |
% | |
% \begin{macro}{\tstrut} | |
% \begin{macro}{\zstrut} | |
% \begin{macrocode} | |
\def\tstrut{\relax\hbox{\tate | |
\ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}} | |
\def\zstrut{\relax\hbox{\tate | |
\ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}} | |
% \end{macrocode} | |
% \end{macro} | |
% \end{macro} | |
% | |
% \begin{macro}{\ystrut} | |
% \changes{v????}{????/??/??}{\cs{ystrut}を追加} | |
% \begin{macrocode} | |
%<platexrelease>\plIncludeInRelease{????/??/??}{\ystrut} | |
%<platexrelease> {Add \ystrut}% | |
%<*plcore|platexrelease> | |
\def\ystrut{\relax\hbox{\yoko | |
\ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi}} | |
%</plcore|platexrelease> | |
%<platexrelease>\plEndIncludeInRelease | |
%<platexrelease>\plIncludeInRelease{0000/00/00}{\ystrut} | |
%<platexrelease> {Add \ystrut}% | |
%<platexrelease>\let\ystrut\@undefined | |
%<platexrelease>\plEndIncludeInRelease | |
% \end{macrocode} | |
% \end{macro} | |
% | |
% | |
% | |
%^^A================================================================= | |
%^^A メモ:|\set@fontsize|のplatexreleaseガード、traceガードは未完成 | |
%^^A================================================================= | |
% | |
% \begin{macro}{\set@fontsize} | |
% |\fontsize|コマンドの内部形式です。 | |
% ベースラインの設定と、支柱の設定を行ないます。 | |
% \begin{macrocode} | |
\def\strutbox{\iftdir\tstrutbox\else\ystrutbox\fi} | |
\def\set@fontsize#1#2#3{% | |
\@defaultunits\@tempdimb#2pt\relax\@nnil | |
\edef\f@size{\strip@pt\@tempdimb}% | |
\@defaultunits\@tempskipa#3pt\relax\@nnil | |
\edef\f@baselineskip{\the\@tempskipa}% | |
\edef\f@linespread{#1}% | |
\let\baselinestretch\f@linespread | |
\def\size@update{% | |
\baselineskip\f@baselineskip\relax | |
\baselineskip\f@linespread\baselineskip | |
\normalbaselineskip\baselineskip | |
% \end{macrocode} | |
% ここで、ベースラインシフトの調整と支柱を組み立てます。 | |
% \changes{v????}{????/??/??}{\cs{ystrutbox}を組み立てるように | |
% し、\cs{strutbox}を縦横両対応に} | |
% \begin{macrocode} | |
\adjustbaseline | |
\setbox\ystrutbox\hbox{\yoko | |
\vrule\@width\z@ | |
\@height.7\baselineskip \@depth.3\baselineskip}% | |
\setbox\tstrutbox\hbox{\tate | |
\vrule\@width\z@ | |
\@height.5\baselineskip \@depth.5\baselineskip}% | |
\setbox\zstrutbox\hbox{\tate | |
\vrule\@width\z@ | |
\@height.7\baselineskip \@depth.3\baselineskip}% | |
% \end{macrocode} | |
% フォントサイズとベースラインに関する診断情報を出力します。 | |
% \begin{macrocode} | |
%<*trace> | |
% \ifnum \tracingfonts>\tw@ | |
% \ifx\f@linespread\@empty | |
% \let\reserved@a\@empty | |
% \else | |
% \def\reserved@a{\f@linespread x}% | |
% \fi | |
% \@font@info{Changing size to\space | |
% \f@size/\reserved@a \f@baselineskip}% | |
% \aftergroup\type@restoreinfo | |
% \fi | |
%</trace> | |
\let\size@update\relax}} | |
% \end{macrocode} | |
% \end{macro} | |
% | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% | |
\endinput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass{tarticle} | |
\else | |
\documentclass{ltjtarticle} | |
\fi | |
\usepackage{amsmath} | |
\setlength{\parindent}{0cm} | |
\setlength{\textwidth}{8cm} | |
\begin{document} | |
% strutboxパッチなしでは数式や数式番号が揃わない | |
align環境、\verb+&+が1つ %% 少し上へ | |
\begin{align} | |
a_1& =b_1+c_1\\ | |
a_2& =b_2+c_2-d_2+e_2 | |
\end{align} | |
align環境、\verb+&+が3つ %% 少し上へ | |
\begin{align} | |
a_{11}& =b_{11}& | |
a_{12}& =b_{12}\\ | |
a_{21}& =b_{21}& | |
a_{22}& =b_{22}+c_{22} | |
\end{align} | |
align環境、\verb+&+が2つ %% 端に付く | |
\begin{align} | |
a_{11}& =b_{11}& | |
a_{12}\\ | |
a_{21}& =b_{21}& | |
a_{22} | |
\end{align} | |
align環境、\verb+&+なし %% 端に付く | |
\begin{align} | |
a_1=b_1+c_1 | |
\end{align} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass[a4paper,12pt]{tarticle} | |
\else | |
\documentclass[a4paper,12pt]{ltjtarticle} | |
\fi | |
\usepackage{array}% これを読むと plext がキャンセルされて文字が回る | |
%\usepackage{plextarray}% これを読むと strutbox パッチなしでも正常 | |
\begin{document} | |
% strutbox パッチなしでは表間隔が狭い | |
\begin{tabular}{|c|c|c|} | |
\hline | |
\multicolumn{3}{|c|}{\textbf{名古屋鉄道・知立駅の名物}} \\ \hline | |
品名 & 金額 & 評価 \\ \hline | |
栗入り大あん巻き & 170円 & ◎ \\ \hline | |
たこ焼き一皿 & 250円 & ▲ \\ \hline | |
うどん & 280円 & ○ \\ \hline | |
そば & 300円 & △ \\ \hline | |
知立ラーメン & 350円 & ☆ \\ \hline | |
\end{tabular} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass{tarticle} | |
\else | |
\documentclass{ltjtarticle} | |
\fi | |
\usepackage{longtable}% pLaTeX 2016/09/03 以降が必須(無限ループ防止) | |
\textheight3cm | |
\begin{document} | |
% strutbox パッチなしでは間隔が狭い | |
\begin{longtable}[c]{ccc} | |
\hline | |
ひらがな & カタカナ & Alphabet \\ | |
\hline | |
あ & ア & A \\ | |
い & イ & B \\ | |
う & ウ & C \\ | |
え & エ & D \\ | |
お & オ & E \\ | |
か & カ & F \\ | |
き & キ & G \\ | |
く & ク & H \\ | |
\end{longtable} | |
\clearpage | |
% 空ページのテスト | |
\null | |
\clearpage | |
% strutbox パッチなしでは調節が効かない | |
\renewcommand{\arraystretch}{1.5} | |
\begin{longtable}[c]{ccc} | |
\hline | |
ひらがな & カタカナ & Alphabet \\ | |
\hline | |
あ & ア & A \\ | |
い & イ & B \\ | |
う & ウ & C \\ | |
え & エ & D \\ | |
お & オ & E \\ | |
か & カ & F \\ | |
き & キ & G \\ | |
く & ク & H \\ | |
\end{longtable} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass[twocolumn]{tarticle} | |
\usepackage{pxftnright}% この中に strutbox パッチと等価な対処も含む | |
% 上の対処がない状況をエミュレートすると脚注同士が密着する。 | |
\AtBeginDocument{\global\footnotesep\ht\strutbox} | |
\else | |
\documentclass[twocolumn]{ltjtarticle} | |
\usepackage{ftnright} | |
\fi | |
\def\hoge{ほげほげ。ふがふがふが。ぴよぴよぴよぴよ。} | |
\def\HOGE{\hoge\hoge\hoge\hoge\hoge\hoge\hoge\hoge\hoge\hoge} | |
\begin{document} | |
\HOGE\HOGE | |
ここに脚注を\footnote{脚注です。}入れました。 | |
\HOGE\HOGE | |
もう一つ脚注を\footnote{ふたつめの脚注です。}入れてみましょう。 | |
\HOGE\HOGE | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass{tarticle} | |
\else | |
\documentclass{ltjtarticle} | |
\fi | |
\usepackage{empheq} | |
\textwidth6cm | |
\begin{document} | |
% strutbox パッチなしでは括弧と数式がくっつかない | |
% さらに縦数式ディレクションがずれる 2016 年の pTeX のバグも影響 | |
\begin{empheq}[left=\empheqlbrace]{align} | |
-2x + 4y &= 5\\ | |
x - y &= -2 | |
\end{empheq} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\ifx\directlua\undefined | |
\documentclass{tarticle} | |
\else | |
\documentclass{ltjtarticle} | |
\fi | |
\usepackage{mdwmath} | |
\begin{document} | |
% strutbox パッチなしでは括弧が大きくならない | |
% さらに縦数式ディレクションがずれる 2016 年の pTeX のバグも影響 | |
\begin{equation} | |
\Bigg( \sum_{n=0}^{\infty} \frac{1}{x^n} \Bigg) | |
\end{equation} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LuaTeX-ja のほうでも \strutbox が絡むソースについてテストを始めてみた。
! Missing \endgroup inserted.
エラーが出る。 → luatex-ja #37038脱線するが、いくつか LuaTeX-ja で気になったところ: