% \iffalse meta-comment % % This is file `exppl2e.sty', for experimental pLaTeX2e. % % Copyright (c) 2016 Japanese TeX Development Community % % This file is part of the pLaTeX2e system (community edition). % ------------------------------------------------------------- % % ==================================================================== % 開発者の方へ (2016-06-29 aminophen) % % このファイルのコードを実際にカーネルに取り入れるとき、単純にカット・ % ペーストで dtx ファイルへ挿入します。ペーストした dtx ファイルから % ltx / sty ファイル等を生成したあとには、必ず % * フォーマット作成に使われる ltx ファイルが意図どおり変更されたか % * platexrelease.sty に新たなブロックが一つだけ追加されたか % (例外的に 0000/00/00 の日付が含まれる場合は、ブロックが二つか) % を確認します。 % ==================================================================== % %%%%%%%% ^^A driver-like trick using catcode difference % % This file `exppl2e.sty' is a normal LaTeX package, so % \RequirePackage{exppl2e} % and % \usepackage{exppl2e} % works. However, it can also be typeset alone: % platex exppl2e.sty % for convenience. % %<*hack> \ifx\undefined\@undefined\relax % case 1: This file must be a normal package \NeedsTeXFormat{pLaTeX2e} \ProvidesPackage{exppl2e} [2016/09/03 v1.0e Experimental pLaTeX2e features] \PackageWarningNoLine{exppl2e}{% 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} \else % case 2: This file pretends to be a document \documentclass{jltxdoc} \title{Experimental p\LaTeXe} \author{Japanese \TeX\ Development Community} \begin{document} \maketitle \DocInput{exppl2e.sty} \end{document} \fi % ^^A In case 2, this \fi comes after \end{document} % ^^A so it has no effect. % \fi ^^A This \fi corresponds to \iffalse, and another % ^^A \fi is required for \ifx, see below;) % %%%%%%%% ^^A trick end % % \fi % % % \emph{注意}:これはExperimentalなp\LaTeXe{}、すなわちunstableな % 実験的p\LaTeX{}コードを提供するパッケージです。 % % % \section{このパッケージの目的} % % コードの不用意な改変は即エンバグにつながり、利用者の多いp\LaTeX{}や % up\LaTeX{}では特に影響が大きいと思われます。その一方で、unstableなもの % もなるべく手軽にテストして頂きたいとも考えます。 % % このパッケージ\file{exppl2e.sty}は、カーネル(stable)に将来含める % ことを想定したunstableな実験的コードを配布することを目的に作成しました。 % テストをよろしくお願いします。 % % % \section{実験的コードの読みこみかた} % % デフォルトの配布では、実験的なコードは無効化されています。 % 実験的なp\LaTeXe{}を試したい場合は、以下のいずれかの方法を使います: % % \subsection{少しだけ試してみたい場合} % % パッケージ\file{exppl2e.sty}を読み込みます。ただし、|\usepackage|命令 % を使うのではなく、文書クラスより\emph{前}に読み込んでおくのが無難です。 %\begin{verbatim} % \RequirePackage{exppl2e} % \documentclass{article} %\end{verbatim} % % \subsection{常に実験的コードを使用したい場合} % % このパッケージと一緒にインストールされる新しいp\LaTeX{}は、お使いの % \texttt{platex}などのプログラムが見つけることのできる場所(簡単なの % はカレントディレクトリ、あるいは|$TEXMFLOCAL/tex|以下の適切な場所) % に\file{platex.cfg}というファイルがあれば、起動時にそれを読み込み % ます。この機能を利用すると、以下の内容の\file{platex.cfg}を用意し % ておくだけで、自動的に毎回\file{exppl2e.sty}が読み込まれます。 %\begin{verbatim} % \RequirePackage{exppl2e} %\end{verbatim} % % % \section{このドキュメントについて} % % コミュニティ版p\LaTeX{}が配布するほかのstyファイルとは異なり、 % 実質的には\file{exppl2e.sty}はdtxファイルと同等です。すなわち、 % コードと一緒にdtx互換ドキュメントが含まれています。このドキュメント % を組版するには %\begin{verbatim} % # platex exppl2e.sty %\end{verbatim} % を実行します。 % % % \section{コード} % % ここからp\LaTeXe{}のexperimentalコード本体です。 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \section{PDFのブックマークとアクセント文字} % % \begin{macro}{\pltx@isletter} % \changes{v???}{????/??/??}{PDFのしおりにアクセント文字が含まれる場合に対応} % \begin{macrocode} %\plIncludeInRelease{????/??/??}{\pltx@isletter} % {Support PD1 encoding}% %<*pldefs|platexrelease> \def\pltx@mark{\pltx@mark@} \let\pltx@scanstop\relax \long\def\pltx@cond#1\fi{% #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \def\pltx@pdfencA{PD1} \def\pltx@composite@chkenc{% \ifx\pltx@pdfencA\f@encoding \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} \long\def\pltx@isletter#1{% \expandafter\pltx@isletter@i#1\pltx@scanstop} \long\def\pltx@isletter@i#1\pltx@scanstop{% \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi{\@firstoftwo}% {\pltx@isletter@ii\pltx@scanstop#1\pltx@scanstop{}#1\pltx@mark}} \long\def\pltx@isletter@ii#1\pltx@scanstop#{% \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi% {\pltx@isletter@iii}{\pltx@isletter@iv}} \long\def\pltx@isletter@iii#1\pltx@mark{\@secondoftwo} \long\def\pltx@isletter@iv#1#2#3\pltx@mark{% \pltx@cond\ifx\pltx@mark#3\pltx@mark\fi{% \pltx@cond{\ifnum0\ifcat A\noexpand#21\fi\ifcat=\noexpand#21\fi>\z@}\fi {\@firstoftwo}{\pltx@composite@chkenc}% }{\pltx@composite@chkenc}} % %\plEndIncludeInRelease %\plIncludeInRelease{2016/06/10}{\pltx@isletter} % {Added \pltx@isletter}% %\def\pltx@mark{\pltx@mark@} %\let\pltx@scanstop\relax %\long\def\pltx@cond#1\fi{% % #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} %\long\def\pltx@isletter#1{% % \expandafter\pltx@isletter@i#1\pltx@scanstop} %\long\def\pltx@isletter@i#1\pltx@scanstop{% % \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi{\@firstoftwo}% % {\pltx@isletter@ii\pltx@scanstop#1\pltx@scanstop{}#1\pltx@mark}} %\long\def\pltx@isletter@ii#1\pltx@scanstop#{% % \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi% % {\pltx@isletter@iii}{\pltx@isletter@iv}} %\long\def\pltx@isletter@iii#1\pltx@mark{\@secondoftwo} %\long\def\pltx@isletter@iv#1#2#3\pltx@mark{% % \pltx@cond\ifx\pltx@mark#3\pltx@mark\fi{% % \pltx@cond{\ifnum0\ifcat A\noexpand#21\fi\ifcat=\noexpand#21\fi>\z@}\fi % {\@firstoftwo}{\@secondoftwo}% % }{\@secondoftwo}} %\plEndIncludeInRelease % \end{macrocode} % \end{macro} % % \begin{macro}{\@text@composite@x} % \changes{v???}{????/??/??}{v1.6eでいったんパッチを除去したコードを再導入} % \begin{macrocode} %\plIncludeInRelease{????/??/??}{\@text@composite@x} % {Fix for non-zero baselineshift}% %<*pldefs|platexrelease> \def\@text@composite@x#1#2{% \ifx#1\relax #2% \else\pltx@isletter{#1}{#1}{% \begingroup \setbox\z@\hbox\bgroup% \ybaselineshift\z@\tbaselineshift\z@ #1% \g@tlastchart@\@tempcntb \xdef\pltx@composite@temp{\noexpand\@tempcntb=\the\@tempcntb\relax}% \aftergroup\pltx@composite@temp \egroup % \end{macrocode} % \begin{macrocode} \ifnum\@tempcntb<\z@ \@tempdima=\iftdir \ifmdir \ifmmode\tbaselineshift\else\ybaselineshift\fi \else \tbaselineshift \fi \else \ybaselineshift \fi \@tempcntb=\@cclvi \else\@tempdima=\z@ \fi % \end{macrocode} % アクセントが付く「本体の文字」が欧文文字と推測される場合には、 % 一旦数式モードに入ることによって\cs{xkanjiskip}が前後に入るようにします。 % 必要なら、数式モードの前後に\cs{null}を補って\cs{xkanjiskip}の挿入を抑制します。 % \begin{macrocode} \ifnum\@tempcntb<\@cclvi \ifnum\@tempcntb>\m@ne\ifnum\@tempcntb<\@cclvi \ifodd\xspcode\@tempcntb\else\leavevmode\hbox{}\fi \fi\fi \begingroup\mathsurround\z@$% \ifx\textbaselineshiftfactor\@undefined\else \textbaselineshiftfactor\z@\fi \box\z@ $\endgroup% \ifnum\@tempcntb>\m@ne\ifnum\@tempcntb<\@cclvi \ifnum\xspcode\@tempcntb<2\hbox{}\fi \fi\fi % \end{macrocode} % \begin{macrocode} \else \ifdim\@tempdima=\z@{\ybaselineshift\z@\tbaselineshift\z@#1}% \else\lower\@tempdima\box\z@\fi \fi \endgroup}% \fi } % %\plEndIncludeInRelease % \end{macrocode} % \end{macro} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \section{脚注の合印直後での改行を許可} % % p\LaTeXe{}カーネル(2016/09/03)に導入したため削除。 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \section{支柱} % % \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} %\plIncludeInRelease{????/??/??}{\ystrutbox} % {Add \ystrutbox}% %<*plcore|platexrelease> \newbox\ystrutbox % %\plEndIncludeInRelease %\plIncludeInRelease{0000/00/00}{\ystrutbox} % {Add \ystrutbox}% %\let\ystrutbox\@undefined %\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} %\plIncludeInRelease{????/??/??}{\strut} % {Use \ystrutbox}% %<*plcore|platexrelease> \def\strut{\relax \ifydir \ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi \else \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi \fi} % %\plEndIncludeInRelease %\plIncludeInRelease{0000/00/00}{\strut} % {Use \ystrutbox}% %\def\strut{\relax % \ifydir % \ifmmode\copy\strutbox\else\unhcopy\strutbox\fi % \else % \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi % \fi} %\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} %\plIncludeInRelease{????/??/??}{\ystrut} % {Add \ystrut}% %<*plcore|platexrelease> \def\ystrut{\relax\hbox{\yoko \ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi}} % %\plEndIncludeInRelease %\plIncludeInRelease{0000/00/00}{\ystrut} % {Add \ystrut}% %\let\ystrut\@undefined %\plEndIncludeInRelease % \end{macrocode} % \end{macro} % % % %^^A================================================================= %^^A メモ:|\set@fontsize|のplatexreleaseガード、traceガードは未完成 %^^A================================================================= % % \begin{macro}{\set@fontsize} % |\fontsize|コマンドの内部形式です。 % ベースラインの設定と、支柱の設定を行ないます。 % \begin{macrocode} \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}% \def\strutbox{\iftdir\tstrutbox\else\ystrutbox\fi}% % \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 % \let\size@update\relax}} % \end{macrocode} % \end{macro} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \endinput