From 21a58c30431c4e45b1b0bc9f94f4e696bab9a217 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 25 Aug 2018 20:56:18 +0000 Subject: luatexja (25aug18) git-svn-id: svn://tug.org/texlive/trunk@48483 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/luatexja/README | 14 +- .../texmf-dist/doc/luatex/luatexja/luatexja-en.pdf | Bin 459077 -> 459210 bytes .../texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf | Bin 823506 -> 833286 bytes Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx | 263 ++++++++++++++----- .../tex/luatex/luatexja/addons/luatexja-adjust.sty | 25 +- .../tex/luatex/luatexja/addons/luatexja-preset.sty | 2 + .../texmf-dist/tex/luatex/luatexja/ltj-adjust.lua | 95 ++++++- .../tex/luatex/luatexja/ltj-adjust_85.lua | 291 --------------------- .../tex/luatex/luatexja/ltj-direction.lua | 40 +-- .../texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua | 16 +- .../texmf-dist/tex/luatex/luatexja/ltj-jfont.lua | 5 +- .../texmf-dist/tex/luatex/luatexja/ltj-latex.sty | 90 +++---- .../tex/luatex/luatexja/ltj-lineskip.lua | 116 ++++++++ Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua | 1 + .../tex/luatex/luatexja/luatexja-core.sty | 4 +- Master/texmf-dist/tex/luatex/luatexja/luatexja.lua | 3 +- Master/texmf-dist/tex/luatex/luatexja/luatexja.sty | 4 +- .../luatexja/patches/lltjp-fontspec-immediate.sty | 131 ---------- .../tex/luatex/luatexja/patches/lltjp-fontspec.sty | 137 +++++++++- .../tex/luatex/luatexja/patches/lltjp-listings.sty | 10 +- .../tex/luatex/luatexja/patches/lltjp-siunitx.sty | 20 +- .../tex/luatex/luatexja/patches/lltjp-stfloats.sty | 3 +- .../luatex/luatexja/patches/lltjp-unicode-math.sty | 58 ++-- 23 files changed, 651 insertions(+), 677 deletions(-) delete mode 100644 Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua create mode 100644 Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua delete mode 100644 Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README index 717a7d0df5a..44bb796c0ff 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/README +++ b/Master/texmf-dist/doc/luatex/luatexja/README @@ -1,4 +1,4 @@ -The LuaTeX-ja Package 20180803.0 +The LuaTeX-ja Package 20180825.0 -------------------------------- Copyright (c) 2011--2018 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -22,7 +22,7 @@ Installation 0. Please make sure that your TeX distribution is up-to-date. This version of LuaTeX-ja requires - - LuaTeX beta-0.85.0 or later + - LuaTeX 1.0.0 or later - luaotfload v2.6 - adobemapping (Adobe CMap files) - everysel package @@ -33,16 +33,16 @@ Installation - filehook package - stfloats package - IPAex fonts (http://ipafont.ipa.go.jp/) - Hence this version does not work in TeX Live 2015 (or earlier). + Hence this version does not work in TeX Live 2016 (or earlier). -1. If you are using TeX Live 2016 or later, you can install LuaTeX-ja via tlmgr. +1. If you are using TeX Live 2018 or later, you can install LuaTeX-ja via tlmgr. 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20180803.0 in the Git repository by + or tagged as 20180825.0 in the Git repository by + ;a=snapshot;h=refs/tags/20180825.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -87,4 +87,4 @@ Notes * src/*.{ins.dtx} and src/ltj-kinsoku_make.tex are not needed in regular use. -Last commit date: Fri Aug 3 13:24:03 2018 +0900 +Last commit date: Sat Aug 25 09:04:32 2018 +0900 diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf index 81a1fdf43fc..77f7763e705 100644 Binary files a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf and b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf differ diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf index 3b81dd9b308..e1696751733 100644 Binary files a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf and b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf differ diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx index 465ef208443..7c27d29b680 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx @@ -640,7 +640,7 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %The following packages are needed for the \LuaTeX-ja\ package. %\LuaTeX-jaパッケージの動作には次のパッケージ類が必要である. \begin{itemize} -\item \LuaTeX\ beta-0.85.0 (or later) +\item \LuaTeX\ 1.0.0 (or later) \item \Pkg{luaotfload} v2.6 (or later) \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files) \item \Pkg{etoolbox}, \Pkg{everysel} (if you want to use \LuaTeX-ja with \LaTeXe) @@ -649,9 +649,9 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %\item \emph{IPAex fonts} (\url{http://ipafont.ipa.go.jp/}) %\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})} \end{itemize} -%In summary, \LuaTeX-ja version 20160404.0 (or~later) no longer supports \TeX~Live~2015. +%In summary, \LuaTeX-ja version 20180825.0 (or~later) no longer supports \TeX~Live~2016. %<*ja> -要約すると,バージョン20160404.0以降の\LuaTeX-jaは\TeX~Live~2015以前では動作しない\footnote{% +要約すると,バージョン20180825.0以降の\LuaTeX-jaは\TeX~Live~2016以前では動作しない\footnote{% もっとも,自分で\LuaTeX のバイナリをSubversionリポジトリからビルドしていれば話は別である. }. % @@ -679,21 +679,6 @@ IPAex fonts are also available in these distributions. W32\TeX においてはIPAexフォントは \texttt{luatexja.tar.xz} 内にある. % -% %<*ja> -% 例えば\TeX~Live~2015を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を -% 使ってインストールすることができる. -% \begin{lstlisting} -% $ tlmgr install luatexja -% \end{lstlisting} -% % -% %<*en> -% If you are using \TeX~Live~2015, you can install \LuaTeX-ja -% from \TeX~Live manager (\texttt{tlmgr}): -% \begin{lstlisting} -% $ tlmgr install luatexja -% \end{lstlisting} -% % - %\paragraph{Manual installation} %\paragraph{手動インストール方法} @@ -6850,12 +6835,12 @@ for making the difference obvious.} %<*ja> この追加パッケージは以下の機能を提供する.詳細な仕様については\ref{sec-adjspec}章を参照してほしい. \begin{description} -\item[行末文字の位置調整] + \item[行末文字の位置調整] \pTeX では,(是非はともかく)「行末の読点はぶら下げか二分取りか全角取りのいずれかに」のように 行末文字と実際の行末の位置関係を2通り以上にすることは面倒であった. 和文フォントメトリックだけでは「常に行末の読点はぶら下げ」といったことしかできず, 前の文に書いたことを実現するには -\begin{lstlisting} + \begin{lstlisting} \def\。{% \penalty10000 % 禁則ペナルティ \hbox to0pt{。\hss}\penalty0 % ぶら下げの場合 @@ -6865,48 +6850,184 @@ for making the difference obvious.} \end{lstlisting} のような命令を定義し,文中の全ての句点を \lstinline+\。+ で書くことが必要だった. -\Pkg{luatexja-adjust}パッケージは,上で述べた行末文字と実際の行末との位置関係を -2通り以上から自動的に選択する機能を提供する. -\pdfTeX と同じように,「\TeX による行分割の後で行末文字の位置を補正する」方法と - 「行分割の過程で行末文字の位置を考慮に入れる」方法を選べるようにした( -\Pkg{luatexja-adjust}パッケージの既定では前者). + \Pkg{luatexja-adjust}パッケージは,上で述べた行末文字と実際の行末との位置関係を + 2通り以上から自動的に選択する機能を提供する. + \pdfTeX と同じように,「\TeX による行分割の後で行末文字の位置を補正する」方法と + 「行分割の過程で行末文字の位置を考慮に入れる」方法を選べるようにした + (\Pkg{luatexja-adjust}パッケージの既定では前者). -\item[優先順位付きの行長調整] -\pTeX では,行長調整において優先度の概念が存在しなかったため,図 -\ref{fig:adj}上段における半角分の半端は,\autoref{fig:adj}中段のように,鍵 -括弧周辺の空白と和文間空白(\Param{kanjiskip})の両方によって負担される.し -かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい -ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文 -文字はベタ組で組まれる(\autoref{fig:adj}下段)ことになっている. -\Pkg{luatexja-adjust}パッケージの提供する第2の機能は, -\cite{jlreq}や\cite{x4051}における規定のような,優先順位付き -の行長調整である. -\begin{itemize} - \item 優先度付き行長調整は,段落を行分割した後に個々の行について行われるものである. -そのため,行分割の位置は変化することはない. + \item[優先順位付きの行長調整] + \pTeX では,行長調整において優先度の概念が存在しなかったため,図 + \ref{fig:adj}上段における半角分の半端は,\autoref{fig:adj}中段のように,鍵 + 括弧周辺の空白と和文間空白(\Param{kanjiskip})の両方によって負担される.し + かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい + ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文 + 文字はベタ組で組まれる(\autoref{fig:adj}下段)ことになっている. + \Pkg{luatexja-adjust}パッケージの提供する第2の機能は, + \cite{jlreq}や\cite{x4051}における規定のような,優先順位付き + の行長調整である. + \begin{itemize} + \item 優先度付き行長調整は,段落を行分割した後に個々の行について行われるものである. + そのため,行分割の位置は変化することはない. + + \verb+\hbox{...}+ といった「途中で改行できない水平ボックス」では(たとえ幅が指定されていても)無効である. + \item 優先度付き行長調整を行うと,和文処理グルーの自然長は変化しないが,伸び量や縮み量は + 一般に変化する.そのため,既に組まれた段落を \cs{unhbox} などを利用して組み直す処理を + 行う場合には注意が必要である. + \end{itemize} + + \item[「中身までみた」行送り計算] + 複数行に渡る文章を組版するときには行間に空きが入ることが普通である. + \TeX では各行が一つずつの水平ボックスをなしていることを思い出すと,隣り合った + 2つの行(つまり水平ボックス)の間の空きは次のようにして決まるのだった: + \begin{itemize} + \item 「通常に組んだときの行間」$d$を,\cs{baselineskip}から + 「前の行」の深さと「次の行」の高さを加えたものを引いた値とする. + \item $d\ge\cs{lineskiplimit}$の場合, + 標準の行送り\cs{baselineskip}で組んでも十分な間隔があると判断され, + 2行の間には長さ$d$の空白が挿入される.つまり行送りは\cs{baselineskip}. + \item {\catcode`\<=12$d<\cs{lineskiplimit}$}の場合, + 2行の間には長さ\cs{lineskip}の空白が挿入される. + そのため(設定値によるが,多くの場合)行送りは\cs{baselineskip}より広がる. + \end{itemize} -\verb+\hbox{...}+ といった「途中で改行できない水平ボックス」では(たとえ幅が指定されていても)無効である. - \item 優先度付き行長調整を行うと,和文処理グルーの自然長は変化しないが,伸び量や縮み量は -一般に変化する.そのため,既に組まれた段落を \cs{unhbox} などを利用して組み直す処理を -行う場合には注意が必要である. -\end{itemize} + \begin{figure}[t] + \noindent\centering + \begin{minipage}[b]{18\zw} + \ltjenableadjust[profile=false, linestep=false] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (a)} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{18\zw} + \ltjenableadjust[profile] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (b)} + \end{minipage}\par + \caption{高い行が連続したときの状況}\label{fig:linegap1} + \end{figure} + + ここで,\TeX は行送りの決定で「高さ・深さを取っているものが + 行のどの水平位置にあるか」は一切考慮しないことに注意してほしい.そのため, + \autoref{fig:linegap1}~(a)のように「必要以上に行間が空いて見える」状況が起こることがある. + + \Pkg{luatexja-adjust}パッケージでは,「通常に組んだときの行間」$d$を + 各行の中身の文字・グルー・ボックスの寸法を勘案して計算するという方法を + 利用できるようにした.この機能を使うと,\autoref{fig:linegap1}~(b)のように + 行間の空きが必要以上に大きくなることを避けることができる. + \begin{itemize} + \item 段落中の隣り合った二行だけでなく,行間の空きは + 新たに水平ボックス$h$を(内部・外部問わず)垂直モードで追加した時にも自動で挿入される. + その場合には,前段落で述べた「中身までみる」処理は + \begin{itemize} + \item 現在のリストにおける最後のノード + \footnote{最後のノードが\cs{parskip}によるグルーであった場合のみ + さらに一つ前のノードを参照する}が水平ボックス$h'$であり,かつ + \item \cs{prevdepth}の値とその$h'$の深さの値が一致している + \end{itemize} + 場合にのみ発動するようにしている. + \item 行の中身に水平ボックス$h''$が入ってくることもあるが,その場合は$h''$の中身までは参照しない. + 参照するようにしてしまうと,\cs{smash}など手動で行った高さ・深さ調整の意味がなくなってしまうからである. + \end{itemize} + + \begin{figure}[t] + \noindent\centering + \begin{minipage}[b]{16\zw} + \ltjenableadjust[profile] + ……だから,①より$\dfrac{a^2}{b}= \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (a): 無効} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=0.25} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (b): $0.25$\cs{baselineskip}刻み} + \end{minipage}\par\medskip + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=0.5} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (c): 0.5\cs{baselineskip}刻み} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=1} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (d): \cs{baselineskip}刻み} + \end{minipage}\par + \caption{段階的な行送り増加}\label{fig:linegap2} + \end{figure} + + \item[段階的な行送り調整] + 既に述べたように, + 「通常に組んだときの行間」$d$が\cs{lineskiplimit}より小さい場合,\TeX 標準では + 行間は\cs{lineskip}となるのだった. + このとき行送りは「前の行の深さ」,「次の行の高さ」,\cs{lineskip}の3つの和になるわけだが, + 場合によっては行送りを「\cs{baselineskip}の整数倍」などと切りのいい値に揃えたいという状況が + 考えられなくもない. + + \Pkg{luatexja-adjust}パッケージでは,{\catcode`\<=12$d<\cs{lineskiplimit}$}のときに + 行送りを\cs{baselineskip}の\Param{linestep\_factor}倍ずつ増減させて + \begin{quote} + 行間が\cs{lineskip}以上となるような, + 最小の$(1+k\cdot \Param{linestep\_factor})\cs{baselineskip}$($k$は整数)の値 + \end{quote} + とする機能を利用できるようにした. + \autoref{fig:linegap2}の(a)がこの機能を無効にした状況で,(b),~(c),~(d)が + それぞれ\Param{linestep\_factor}を0.25,~0.5,~1とした状況である. + + なお,この機能は表組時(\cs{halign},~\cs{valign})には無効である. + \LaTeX における表組環境(tabular, arrayなど)では,\cs{baselineskip},~\cs{lineskip}はどちらも0に設定されているので + (代わりに各行に\cs{@arstrut}という支柱が入る)ために意味がないことと, + 数式を内部で表組を使って組むalign環境などではかえって行間が不揃いになってしまうからである. \end{description} -\Pkg{luatexja-adjust}パッケージは,上記で述べた2機能を有効化/無効化するための +\Pkg{luatexja-adjust}パッケージは,上記で述べた4機能を有効化/無効化するための 以下の命令を提供する.これらはすべてグローバルに効力を発揮する. \begin{cslist} \item[\cs{ltjenableadjust[...]}] -\verb+...+ に指定したkey-valueリストに従い,「行末文字の位置調整」「優先順位付きの行長調整」を有効化/無効化する. +\verb+...+ に指定したkey-valueリストに従い,「行末文字の位置調整」「優先順位付きの行長調整」 + 「『中身までみた』行送り計算」「段階的な行送り調整」を有効化/無効化する. 指定できるキーは以下の通り. \begin{description} \item[\texttt{lineend=[false,true,extended]}] 行末文字の位置調整の機能を無効化(\texttt{false}),「行分割後に調整」の形で有効化(\texttt{true}), - 「行分割の仮定で考慮」(\texttt{extended})する. + 「行分割の仮定で考慮」の形で有効化(\texttt{extended})する. \item[\texttt{priority=[false,true]}] - 優先順位付きの行長調整を無効化(\texttt{false}),または有効化(\texttt{true})する. + 優先順位付きの行長調整を無効化(\texttt{false}),または有効化(\texttt{true}). + \item[\texttt{profile=[false,true]}] + 「中身までみた」行送り計算を無効化(\texttt{false}),または有効化(\texttt{true}). + \item[\texttt{linestep=[false,true]}] + 段階的な行送り調整を無効化(\texttt{false}),または有効化(\texttt{true}). \end{description} -両キーともキー名のみを指定した場合は値として\texttt{true}が指定されたものと扱われる. +どのキーともキー名のみを指定した場合は値として\texttt{true}が指定されたものと扱われる. 互換性の為,オプション無しでただ\cs{ltjenableadjust}が呼び出された場合は, \begin{lstlisting} @@ -6917,13 +7038,13 @@ for making the difference obvious.} \item[\cs{ltjdisableadjust}] \Pkg{luatexja-adjust}パッケージの機能を無効化する. \begin{lstlisting} -\ltjenableadjust[lineend=false,priority=false] +\ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false] \end{lstlisting} と同義. \end{cslist} -また,優先順位付きの行長調整のために,次の2パラメータが\cs{ltjsetparameter}内で -追加される.両パラメータともグローバルに効力を発揮する. +また,優先順位付きの行長調整のために,次の3パラメータが\cs{ltjsetparameter}内で +追加される.いずれもグローバルに効力を発揮する. \begin{cslist}[style=standard] \item[\DParam{stretch\_priority}\,=\{\}] \Param{kanjiskip}, \Param{xkanjiskip},および「\textbf{JAglue}以外のグルー」を, @@ -6942,8 +7063,14 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} \item[\DParam{shrink\_priority}\,=\{\}] 同様に,「行を自然長より縮める」場合の調整に用いる優先度を指定する. それ以外は\Param{stretch\_priority}と指定の形式は変わらない. + + \item[\DParam{linestep\_factor}\,=] + 段階的な行送り調整の際,\cs{baselineskip}の何倍単位で行送りを変えるかを指定する. + 0を指定すると無効になるのと変わらない.また負数を指定すると, + その絶対値が指定されたかのように扱われる. + 初期値は0.5(つまり半行単位)である. \end{cslist} -初期値は\Param{stretch\_priority}, \Param{shrink\_priority}とも +\Param{stretch\_priority}, \Param{shrink\_priority}の初期値はどちらも \begin{lstlisting} {kanjiskip=-35,xkanjiskip=-25,others=50} \end{lstlisting} @@ -7448,12 +7575,12 @@ since we use same font for both series of gothic. いため, 「ゴシック体の中字」も同時に変更されることになる. % -\item[90jis] -%Use 90JIS glyph variants if possible. -%出来る限り90JISの字形を使う. -\item[jis2004] -%Use JIS2004 glyph variants if possible. -%出来る限りJIS2004の字形を使う. +\item[jis90\textrm{,~}90jis] +%Use JIS~X~0208:1990 glyph variants if possible. +%出来る限りJIS~X~0208:1990の字形を使う. +\item[jis2004\textrm{,~}2004jis] +%Use JIS~X~0213:2004 glyph variants if possible. +%出来る限りJIS~X~0213:2004の字形を使う. \item[jfm\_yoko=] %<*en> Use the JFM \texttt{jfm-.lua} for horizontal direction, instead of \texttt{jfm-ujis.lua}~(default JFM). @@ -7477,14 +7604,14 @@ Use the JFM \texttt{jfm-.lua} for vertical direction, instead of \texttt{jf \end{cslist} %<*en> -Note that \texttt{90jis} and \texttt{jis2004} only affect with mincho, +Note that \texttt{jis90},~\texttt{90jis}, \texttt{jis2004}~and~\texttt{2004jis} only affect with mincho, gothic (and, possibly rounded gothic) families defined by this package. -We didn't taken account of when both \texttt{90jis} and \texttt{jis2004} are specified. +We didn't taken account of when more than one options among them are specified. % %<*ja> -\texttt{90jis}と\texttt{jis2004}については本パッケージで定義された +\texttt{jis90},~\texttt{90jis}, \texttt{jis2004},~\texttt{2004jis}については本パッケージで定義された 明朝体・ゴシック体(・丸ゴシック体)にのみ有効である. -両オプションが同時に指定された場合の動作については全く考慮していない. +これら4オプションのうち複数が同時に指定された場合の動作については全く考慮していない. % %\subsubsection{Presets which support multi weights} @@ -7857,17 +7984,17 @@ Note that HG~Mincho~E, HG~Gothic~E, HG Soei Kaku Gothic UB, and HG Maru Gothic P are internally specified by: \begin{description} \item[default] by font name (\texttt{HGMinchoE}, etc.). -\item[{\tt 90jis}] by file name (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}). -\item[{\tt jis2004}] by file name (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}). +\item[\texttt{jis90}, \texttt{90jis}] by file name (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}). +\item[\texttt{jis2004}, \texttt{2004jis}] by file name (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}). \end{description} % %<*ja> なお,HG明朝E・HGゴシックE・HG創英角ゴシックUB・HG丸ゴシック体PROの4つについては,内部で \begin{description} \item[標準] フォント名(\texttt{HGMinchoE} など) -\item[{\tt 90jis}指定時] ファイル名 (% +\item[\texttt{jis90}, \texttt{90jis}指定時] ファイル名 (% \texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}) -\item[{\tt jis2004}指定時] ファイル名 (% +\item[\texttt{jis2004}, \texttt{2004jis}指定時] ファイル名 (% \texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}) \end{description} として指定を行っているので注意すること. @@ -7877,11 +8004,11 @@ are internally specified by: %\subsubsection{新たなプリセットの定義} %<*ja> -バージョン********.0以降では,自分で新たなプリセットを定義することが出来るようになった. +バージョン20170904.0以降では,自分で新たなプリセットを定義することが出来るようになった. 以下に説明する2命令はプリアンブルでしか実行できない. % %<*en> -From version~********.0, one can define new presets using \cs{ltjnewpreset}, +From version~20170904.0, one can define new presets using \cs{ltjnewpreset}, and use them by \cs{ltjapplypreset}. These two commands can only be used in the preamble. % \begin{cslist} diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty index 0416a3ebd77..57d9835caf5 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty @@ -64,7 +64,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-adjust}[2017/05/05] + \ProvidesPackage{luatexja-adjust}[2018/07/24] \fi % % Load core module if not yet. @@ -85,26 +85,31 @@ %%------------------ %! Main part of luatexja-adjust -\ifnum\luatexversion>90 - \RequireLuaTeXjaSubmodule{adjust} -\else - \RequireLuaTeXjaSubmodule{adjust_85} -\fi - +\RequireLuaTeXjaSubmodule{adjust} \newcount\ltjadj@status@le +\newcount\ltjadj@status@lp \newcount\ltjadj@status@pr +\newcount\ltjadj@status@ls \let\ltj@adjust@temp=\relax \define@choicekey[ltj]{adjust}{lineend}[\@@temp\ltj@adjust@temp]% {false,true,extended}[true]{% \ifnum\ltj@adjust@temp=-1 \else\ltjadj@status@le=\ltj@adjust@temp\fi\relax} \define@boolkey[ltj]{adjust}{priority}[true]{% \ltjadj@status@pr=\ifltj@adjust@priority1\else0\fi\relax} +\define@boolkey[ltj]{adjust}{profile}[true]{% + \ltjadj@status@lp=\ifltj@adjust@profile1\else0\fi\relax} +\define@boolkey[ltj]{adjust}{linestep}[true]{% + \ltjadj@status@ls=\ifltj@adjust@linestep1\else0\fi\relax} + \protected\def\@@ltjenableadjust[#1]{% \setkeys[ltj]{adjust}{#1}% - \directlua{luatexja.adjust.enable_cb(\the\ltjadj@status@le, \the\ltjadj@status@pr)}\ignorespaces + \directlua{luatexja.adjust.enable_cb( + \the\ltjadj@status@le, \the\ltjadj@status@pr, + \the\ltjadj@status@lp, \the\ltjadj@status@ls)}\ignorespaces } -\protected\def\ltjdisableadjust{\ltjenableadjust[lineend=false,priority=false]} +\protected\def\ltjdisableadjust{% + \ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false]} \protected\def\ltjenableadjust{% \ltx@ifnextchar[{\@@ltjenableadjust}{\@@ltjenableadjust[lineend,priority]}}%] @@ -127,6 +132,8 @@ stretch_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, shrink_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, } +\define@key[ltj]{japaram}{linestep_factor}{% + \directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax} %%------------------ all done diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty index b2eabb12fb4..4e577aad5ea 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty @@ -88,7 +88,9 @@ % 漢字字形 \tl_new:N \l_ltjpreset_kanji_shape_tl \ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis +\ltjpreset_declare_option:nn{jis90}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis \ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 +\ltjpreset_declare_option:nn{2004jis}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 % font preset \prop_new:N \g_ltjpreset_font_prop diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua index 7131bbc7b77..d9bd77a3ea8 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua @@ -1,10 +1,12 @@ -- -- ltj-adjust.lua -- +luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('direction'); local ltjd = luatexja.direction +luatexja.load_module('lineskip'); local ltjl = luatexja.lineskip luatexja.adjust = luatexja.adjust or {} local to_node = node.direct.tonode @@ -401,10 +403,11 @@ do return to_node(head) end local is_reg = false - function enable_cb(status_le, status_pr) + function enable_cb(status_le, status_pr, status_lp, status_ls) if (status_le>0 or status_pr>0) and (not is_reg) then - luatexbase.add_to_callback('post_linebreak_filter', - adjust_width, 'Adjust width', 100) + ltjb.add_to_callback('post_linebreak_filter', + adjust_width, 'Adjust width', + luatexbase.priority_in_callback('post_linebreak_filter', 'ltj.lineskip')-1) is_reg = true elseif is_reg and (status_le==0 and status_pr==0) then luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') @@ -412,7 +415,7 @@ do end if status_le==2 then if not luatexbase.in_callback('luatexja.adjust_jfmglue', 'luatexja.adjust') then - luatexbase.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust') + ltjb.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust') end myaw_step1, myaw_step1_last = dummy, aw_step1_last else @@ -426,9 +429,13 @@ do end end myaw_step2 = (status_pr>0) and aw_step2 or aw_step2_dummy + luatexja.lineskip.setting( + status_lp>0 and 'profile' or 'dummy', + status_ls>0 and 'step' or 'dummy' + ) end function disable_cb() -- only for compatibility - enable_cs(0) + enable_cs(0,0,0,0) end luatexja.adjust.enable_cb=enable_cb luatexja.adjust.disable_cb=disable_cb @@ -437,3 +444,81 @@ end luatexja.unary_pars.adjust = function(t) return is_reg and 1 or 0 end + +-- ----------------------------------- +luatexja.adjust.step_factor = 0.5 +do + local insert = table.insert + local rangedimensions, max = node.direct.rangedimensions, math.max + function ltjl.p_profile(before, after, mirrored, bw) + local t = {} + do + local w_acc, d_before = 0, 0 + local x = getlist(before); local xn = node_next(x) + while x do + local w, d + if xn then w, _, d= rangedimensions(before,x,xn) + else w, _, d= rangedimensions(before,x) end + if d~=d_before then + d_before = d; t[w_acc] = t[w_acc] or {} + if t[w_acc][1] then t[w_acc][1]=max(t[w_acc][1],d) + else t[w_acc][1]=d end + end + w_acc = w_acc + w + x = xn; if x then xn = node_next(x) end + end + end + do + local w_acc, h_before = 0, 0 + local x = getlist(after); local xn = node_next(x) + while x do + local w, h, d + if xn then w, h, d = rangedimensions(after,x,xn) + else w, h,d = rangedimensions(after,x) end + if mirrored then h=d end + if h~=h_before then + h_before = h; t[w_acc] = t[w_acc] or {} + if t[w_acc][2] then t[w_acc][2]=max(t[w_acc][2],h) + else t[w_acc][2]=h end + end + w_acc = w_acc + w + x = xn; if x then xn = node_next(x) end + end + end + local t2 = {} + for i,v in pairs(t) do insert(t2, { i, v[1], v[2] } ) end + table.sort(t2, function(a,b) return a[1]dmax then dmax=d end + if h>hmax then hmax=h end + if (bw-h-d) 0 then - local ratio = after/before - for i,_ in pairs(set_stretch_table) do - set_stretch_table[i] = nil - end - for q in node_traverse_id(id_glue, getlist(p)) do - local f = get_attr_icflag(q) - if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) - or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then - local qs, do_flag = getfield(q, 'spec'), true - for i=1,#set_stretch_table do - if set_stretch_table[i]==qs then do_flag = false end - end - if getfield(qs, 'writable') and getfield(qs, name..'_order')==0 and do_flag then - setfield(q, name, getfield(qs, name)*ratio) - set_stretch_table[#set_stretch_table+1] = qs - end - end - end - end -end - --- step 1: 行末に kern を挿入(句読点,中点用) -local ltjd_glyph_from_packed = ltjd.glyph_from_packed -local function aw_step1(p, res, total) - local head = getlist(p) - local x = node_tail(head); if not x then return false end - -- x: \rightskip - x = node_prev(x); if not x then return false end - local xi, xc = getid(x) - if xi == id_glue and getsubtype(x) == 15 then - -- 段落最終行のときは,\penalty10000 \parfillskip が入るので, - -- その前の node が本来の末尾文字となる - x = node_prev(node_prev(x)); xi = getid(x) - end - -- local xi = getid(x) - -- while (get_attr_icflag(x) == PACKED) - -- and ((xi == id_penalty) or (xi == id_kern) or (xi == id_kern)) do - -- x = node_prev(x); xi = getid(x) - -- end - if xi == id_glyph and getfield(x, 'lang')==lang_ja then - -- 和文文字 - xc = x - elseif xi == id_hlist and get_attr_icflag(x) == PACKED then - -- packed JAchar - xc = ltjd_glyph_from_packed(x) - while getid(xc) == id_whatsit do xc = node_next(xc) end -- これはなんのために? - else - return false-- それ以外は対象外. - end - local xk = ltjf_font_metric_table[getfont(xc)] - .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0 - - if xk>0 and total>=xk then - total = total - xk - local kn = node_new(id_kern) - setfield(kn, 'kern', (res.name=='shrink' and -1 or 1) * xk) - set_attr(kn, attr_icflag, FROM_JFM) - insert_after(head, x, kn) - return true - else return false - end -end - --- step 2: 行中の glue を変える -local function aw_step2(p, res, total, added_flag) - if total == 0 then -- もともと伸縮の必要なし - if added_flag then -- 行末に kern 追加したので,それによる補正 - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', nil) - setfield(p, 'glue_set', getfield(f, 'glue_set')) - setfield(p, 'glue_order', getfield(f, 'glue_order')) - setfield(p, 'glue_sign', getfield(f, 'glue_sign')) - node_free(f) - return - end - elseif total <= res[0] then -- 和文処理グルー以外で足りる - for _,v in pairs(priority_table) do clear_stretch(p, v, res.name) end - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', nil) - setfield(p, 'glue_set', getfield(f, 'glue_set')) - setfield(p, 'glue_order', getfield(f, 'glue_order')) - setfield(p, 'glue_sign', getfield(f, 'glue_sign')) - node_free(f) - else - total = total - res[0] - for i = 1, #priority_table do - local v = priority_table[i] - if total <= res[v] then - for j = i+1,#priority_table do - clear_stretch(p, priority_table[j], res.name) - end - set_stretch(p, total, res[v], v, res.name); break - end - total = total - res[v] - end - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', nil) - setfield(p, 'glue_set', getfield(f, 'glue_set')) - setfield(p, 'glue_order', getfield(f, 'glue_order')) - setfield(p, 'glue_sign', getfield(f, 'glue_sign')) - node_free(f) - end -end - - -local ltjs_fast_get_stack_skip = ltjs.fast_get_stack_skip -local function adjust_width(head) - if not head then return head end - local line = 1 - for p in node_traverse_id(id_hlist, to_direct(head)) do - line = line + 1 - local res, total = get_total_stretched(p, line) - -- this is the same table as the table which is def'd in l. 92 - if res and res.glue_set<1 then - total = round(total * res.glue_set) - aw_step2(p, res, total, aw_step1(p, res, total)) - end - end - for i,_ in pairs(gs_used_line) do - gs_used_line[i] = nil - end - return to_node(head) -end - -do - luatexja.adjust = luatexja.adjust or {} - local is_reg = false - function luatexja.adjust.enable_cb() - if not is_reg then - luatexbase.add_to_callback('post_linebreak_filter', - adjust_width, 'Adjust width', 100) - is_reg = true - end - end - function luatexja.adjust.disable_cb() - if is_reg then - luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') - is_reg = false - end - end -end - -luatexja.unary_pars.adjust = function(t) - return is_reg and 1 or 0 -end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua index aa97c7028b2..107d27a897a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua @@ -1059,45 +1059,7 @@ do end end --- append_to_vlist filter -do - local id_glue = node.id('glue') - local getglue = node.direct.getglue or - function(g) - return getfield(g,'width'), getfield(g,'stretch'), getfield(g,'shrink'), - getfield(g,'stretch_order'), getfield(g,'shrink_order') - end -local setglue = luatexja.setglue - local function copy_glue (new_glue, old_glue, subtype, new_w) - setfield(new_glue, 'subtype', subtype) - local w,st,sp,sto,spo = getglue(to_direct(old_glue)) - setglue(new_glue, new_w or w, st, sp, sto, spo) - end - local node_write = node.direct.write - local function dir_adjust_append_vlist(b, loc, prev, mirrored) - local old_b = to_direct(b) - local new_b = loc=='box' and - make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b - - if prev > -65536000 then - local d = tex.baselineskip.width - prev - - getfield(new_b, mirrored and 'depth' or 'height') - local g = node_new(id_glue) - if d < tex.lineskiplimit then - copy_glue(g, tex.lineskip, 1) - else - copy_glue(g, tex.baselineskip, 2, d); - end - node_write(g) - end - node_write(new_b) - tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth') - return nil -- do nothing on tex side - end - ltjb.add_to_callback('append_to_vlist_filter', - dir_adjust_append_vlist, - 'ltj.direction', 10000) -end +-- append_to_vlist filter: done in ltj-lineskip.lua -- finalize (executed just before \shipout) -- we supply correct pdfsavematrix nodes etc. inside dir_node diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index 895cf9ca496..9c051701557 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2018/02/18', + date = '2018/08/11', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -280,17 +280,19 @@ local function check_next_ickern(lp) end local function calc_np_pbox(lp, last) - local first, lpa, nc = (not Np.first), KINSOKU, nil + local first, nc = (not Np.first), nil + --local lpa = get_attr_icflag(lp)==PACKED and PACKED or KINSOKU -- KINSOKU: dummy + local lpa = get_attr_icflag(lp) Np.first = Np.first or lp; Np.id = id_pbox set_attr(lp, attr_icflag, get_attr_icflag(lp)); while lp ~=last and (lpa>=PACKED) and (lpa -65536000 then + local bw = tex.baselineskip.width + local normal = bw - prev + - getfield(new_b, mirrored and 'depth' or 'height') + local lmin, adj = nil, 0 + local tail = to_direct(tex.nest[tex.nest.ptr].tail) + if p_dummy~=ltj_profiler then + while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do + tail = node_prev(tail) + end + end + if tail then + if getid(tail)==id_hlist and getid(new_b)==id_hlist then + if getfield(tail, 'depth')==prev then + lmin, adj = ltj_profiler(tail, new_b, mirrored, bw) + end + end + end + local g = node_new(id_glue) + ltj_skip(lmin or normal, g, adj, normal, bw, loc) + node_write(g) + end + node_write(new_b) + tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth') + return nil -- do nothing on tex side + end + ltjb.add_to_callback('append_to_vlist_filter', + dir_adjust_append_vlist, + 'ltj.lineskip', 10000) +end + diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua index 22c7b85e2e3..b1688235ab8 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua @@ -252,6 +252,7 @@ local function texiface_low(rst, rtlr, rtlp) setfield(w, 'value', to_node(wv)) setfield(wv, 'type', 100) setfield(wv, 'value', floor(#rtlr)) + setfield(wv, 'user_id', RUBY_PRE) -- dummy set_attr(wv, attr_ruby, rst.rubyzw) set_attr(wv, attr_ruby_maxmargin, rst.maxmargin) set_attr(wv, attr_ruby_maxprep, rst.pre) diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index 51adc9bed85..e57739d0c21 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -101,10 +101,10 @@ \expandafter\endinput\fi\relax %% Check LuaTeX version. -\ifnum\luatexversion<85 +\ifnum\luatexversion<100 \@PackageError{luatexja-core} {This LuaTeX engine is too old for this package;\MessageBreak - at least beta-0.85.0 is needed} + at least 1.0.0 is needed} {Package loading is aborted now.\MessageBreak} \expandafter\endinput\fi\relax diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 2fc116003f3..59204dfdef0 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -102,13 +102,14 @@ if luatexja_debug then load_module('debug') end load_module('charrange'); local ltjc = luatexja.charrange load_module('stack'); local ltjs = luatexja.stack load_module('direction'); local ltjd = luatexja.direction -- +1 hlist +1 attr_list +load_module('lineskip'); local ltjl = luatexja.lineskip -- +1 hlist +1 attr_list load_module('jfont'); local ltjf = luatexja.jfont load_module('inputbuf'); local ltji = luatexja.inputbuf load_module('pretreat'); local ltjp = luatexja.pretreat load_module('setwidth'); local ltjw = luatexja.setwidth load_module('jfmglue'); local ltjj = luatexja.jfmglue -- +1 glue +1 gs +1 attr_list load_module('math'); local ltjm = luatexja.math -load_module('base'); local ltjb = luatexja.base +load_module('base'); local ltjb = luatexja.base local attr_jchar_class = luatexbase.attributes['ltj@charclass'] diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty index d3c77f3708c..acaa035fd59 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty @@ -34,10 +34,10 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja}[2018/07/28 Japanese Typesetting with Lua(La)TeX] + \ProvidesPackage{luatexja}[2018/08/25 Japanese Typesetting with Lua(La)TeX] \fi % %%%% VERSION -\def\LuaTeXjaversion{20180803.0} +\def\LuaTeXjaversion{20180825.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty deleted file mode 100644 index a0ee7b6dba4..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty +++ /dev/null @@ -1,131 +0,0 @@ -% -% lltjp-fontspec-immediate.sty -% - -\NeedsTeXFormat{LaTeX2e} -%%% \ProvidesPackage{lltjp-fontspec-immediate}[2017/08/07 Patch to fontspec for LuaTeX-ja] - -\RequirePackage{fontspec,luatexja} -\ExplSyntaxOn - -% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl -\ifdefined \g__fontspec_nfss_enc_tl \else - \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl } -\fi - -%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont -\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later -\cs_set:Nn \__fontspec_main_setmainfont:nn - { - \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} - \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setmainfont_hook:nn {#1} {#2} - \normalfont - } -\cs_set:Nn \__fontspec_main_setsansfont:nn - { - \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2} - \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setsansfont_hook:nn {#1} {#2} - \normalfont - } -\cs_set:Nn \__fontspec_main_setmonofont:nn - { - \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2} - \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setmonofont_hook:nn {#1} {#2} - \normalfont - } -}{ %% <= 2.6g -\DeclareDocumentCommand \setmainfont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} - \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -\DeclareDocumentCommand \setsansfont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} - \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_sffamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -\DeclareDocumentCommand \setmonofont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} - \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -} -\ExplSyntaxOff -\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} -\endinput - diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty index 4db2ffe8a4c..32e4ef0b8ab 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty @@ -1,28 +1,137 @@ % -% lltjp-fontspec.sty +% lltjp-fontspec.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-fontspec}[2017/08/07 Patch to fontspec for LuaTeX-ja] \RequirePackage{fontspec,luatexja} \ExplSyntaxOn -\@ifpackagelater{fontspec}{2017/01/01}{ - \cs_set:Nn \fontspec_visible_space: +% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl +\ifdefined \g__fontspec_nfss_enc_tl \else + \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl } +\fi + +%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont +\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later +\cs_set:Nn \__fontspec_main_setmainfont:nn + { + \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} + \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmainfont_hook:nn {#1} {#2} + \normalfont + } +\cs_set:Nn \__fontspec_main_setsansfont:nn + { + \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2} + \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \sffamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setsansfont_hook:nn {#1} {#2} + \normalfont + } +\cs_set:Nn \__fontspec_main_setmonofont:nn + { + \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2} + \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \ttfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmonofont_hook:nn {#1} {#2} + \normalfont + } +}{ %% <= 2.6g +\DeclareDocumentCommand \setmainfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} + \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } +\DeclareDocumentCommand \setsansfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} + \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } { - \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \ltjalchar"2423\scan_stop: } - { \fontspec_visible_space_fallback: } + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_sffamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% + \exp_not:N \selectfont } -}{ - \cs_set:Nn \fontspec_visible_space: + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } +\DeclareDocumentCommand \setmonofont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} + \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } { - \font_glyph_if_exist:NnTF \font {"2423} - { \ltjalchar"2423\scan_stop: } - { \fontspec_visible_space_fallback: } + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% + \exp_not:N \selectfont } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } } + +\cs_set:Nn \fontspec_visible_space: + { + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \ltjalchar"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } + \def\verb { \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore @@ -32,11 +141,11 @@ \@ifstar\__fontspecsverb\@verb } - -%%%%%%%% shapes in \em \cs_set:Npn \emshape { \gtfamily \itshape } \cs_set:Npn \eminnershape { \mcfamily \upshape } \ExplSyntaxOff \expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} + \endinput + diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty index e0470a2cbee..abcf05b9e79 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty @@ -1,9 +1,8 @@ % -% lltjp-listings.sty +% lltjp-listings.sty 2018-08-25 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-listings}[2017/05/05 Patch to listings for LuaTeX-ja] \RequirePackage{listings,luatexbase-cctb} %%%%%%%%%%%%%%%% Japanese support @@ -387,6 +386,13 @@ \fi}} \endgroup +%%%%%%%%%%%%%%%% texcl +\lst@AddToHook{AfterBeginComment} + {\ifnum\lst@mode=\lst@TeXLmode + \catcode`\^^M=13\relax + \catcode\ltjlineendcomment=9\relax + \fi} + %%%%%%%%%%%%%%%% \lstloadaspects{writefile} \begingroup \catcode`\^^I=11 diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty index 738760c1bba..d629fd3cb1e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty @@ -1,5 +1,5 @@ % -% lltjp-siunitx.sty +% lltjp-siunitx.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} @@ -18,17 +18,13 @@ \__ltj_siunix_patch_inner:n { l__siunitx_#1_math } \__ltj_siunix_patch_inner:n { l__siunitx_#1_text } } -\cs_new:Nn \__ltj_siunitx_patch: { - \AtBeginDocument { - \__ltj_siunix_patch_inner:n { c__siunitx_minus } - \__ltj_siunix_patch_inner:n { c__siunitx_mu } - \__ltj_siunix_patch_inner_math:n { angstrom } - \__ltj_siunix_patch_inner_math:n { arcminute } - \__ltj_siunix_patch_inner_math:n { arcsecond } - \__ltj_siunix_patch_inner_math:n { ohm } - } +\AtBeginDocument { + \__ltj_siunix_patch_inner:n { c__siunitx_minus } + \__ltj_siunix_patch_inner:n { c__siunitx_mu } + \__ltj_siunix_patch_inner_math:n { angstrom } + \__ltj_siunix_patch_inner_math:n { arcminute } + \__ltj_siunix_patch_inner_math:n { arcsecond } + \__ltj_siunix_patch_inner_math:n { ohm } } -\ifdefined\ltj@patch@siunitx@executed\__ltj_siunitx_patch:\fi - \ExplSyntaxOff \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty index 34228479510..6f7590c2a4d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty @@ -1,9 +1,8 @@ % -% lltjp-stfloats.sty +% lltjp-stfloats.sty 2017-05-05 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-stfloats}[2017/05/05 Patch to stfloats for LuaTeX-ja] \RequirePackage{stfloats,luatexja} \RequirePackage{etoolbox} diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty index acca226a7f0..9c8bbfca9f9 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty @@ -1,49 +1,41 @@ % -% lltjp-unicode-math.sty +% lltjp-unicode-math.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-unicode-math}[2018/01/14 Patch to unicode-math for LuaTeX-ja] \RequirePackage{unicode-math,luatexja,etoolbox} \ExplSyntaxOn -\group_begin: - \bool_new:N \__lltjp_um_patch_mathgroup_bool - \bool_set_true:N \__lltjp_um_patch_mathgroup_bool - \cs_gset:Nn \__um_define_math_chars: { - \group_begin: - \cs_set:Npn \__um_sym:nnn ##1##2##3 - { - \tl_if_in:nnT - { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } - {##3} - { - \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} } - \ltjsetmathletter{ ##1 } - } - } - \__um_input_math_symbol_table: - \group_end: - } - -\bool_if:NT \__lltjp_um_patch_mathgroup_bool { - \cs_gset:Npn \use@mathgroup #1 #2 - { - %\typeout{UM <#1><#2>} - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! +\cs_set:Nn \__um_define_math_chars: { + \group_begin: + \cs_set:Npn \__um_sym:nnn ##1##2##3 { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% - \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi - \math@egroup + \ltjsetmathletter{ ##1 } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} + { + \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} } + } } + \__um_input_math_symbol_table: + \group_end: +} +\cs_set:Npn \use@mathgroup #1 #2 +{ + %\typeout{UM <#1><#2>} + \mode_if_math:T % <- not sure + { + \math@bgroup + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% + \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi + \math@egroup } } -\group_end: \ifcsname jsc@mag@xrealtrue \endcsname \else \expandafter\expandafter\expandafter \ExplSyntaxOff \expandafter \endinput -- cgit v1.2.3