OSDN Git Service

ltj-latex.sty etc.: reworked patching
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 23 Aug 2018 13:55:35 +0000 (22:55 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 23 Aug 2018 13:55:35 +0000 (22:55 +0900)
src/ltj-latex.sty
src/patches/lltjp-siunitx.sty
src/patches/lltjp-unicode-math.sty [moved from src/patches/lltjp-unicode-math-immediate.sty with 100% similarity]
test/test07-math-unicode.pdf
test/test07-math-unicode.tex
test/test09-fontspec.pdf
test/test09-fontspec.tex

index 0514636..e892d8f 100644 (file)
 
 \def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}}
 
-% similar to \ltj@pkgpatch, but this is used .sty which
-% can be reloaded inside the document by \input.
-\def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}}
-
 \endlinechar=13
 
 %%% patch for LaTeX
 \usepackage{lltjdefs}
 \usepackage{lltjcore}
 
+\RequirePackage{filehook}
+\def\ltj@pkgpatch@im#1{%
+ \@ifnextchar[{\ltj@pkgpatch@im@{#1}}{\ltj@pkgpatch@im@{#1}[lltjp-#1]}}%]
+\def\ltj@pkgpatch@im@#1[#2]{\AtEndOfPackageFile*{#1}{\input{#2.sty}}}
+
 %%% default parameters
 \directlua{
   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
 \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
 
 %%% patch for packages
-\ltj@pkgpatch{listings}
-\ltj@pkgpatch{xunicode}
-\ltj@pkgpatch{fontspec}
-\ltj@pkgpatch{footmisc}
+\ltj@pkgpatch@im{listings}
+\ltj@pkgpatch{xunicode}  %% at \begin{document}
+\ltj@pkgpatch{fontspec}  %% at \begin{document}
+\ltj@pkgpatch@im{fontspec}[lltjp-fontspec-immediate]
+\ltj@pkgpatch{footmisc}  %% at \begin{document}
 \ltj@pkgpatch{tascmac}
 \ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{%
   \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}%
   \makeatletter\input{lltjp-tascmac.sty}%
   \ltj@asc@temp\let\ltj@asc@temp=\relax
 }{}}% ascmac
-\ltj@pkgpatch{stfloats}
-\ltj@pkgpatch{preview}
-\ltj@pkgpatch{array}
+\ltj@pkgpatch@im{stfloats}
+\ltj@pkgpatch{preview}  %% at \begin{document}
+  % (preview package has delayed option)
+\ltj@pkgpatch{array}    %% at \begin{document}
+\ltj@pkgpatch@im{unicode-math}
+\ltj@pkgpatch@im{siunitx}
 
 \RequirePackage{lltjp-geometry}
-\RequirePackage{filehook}
-\AtEndOfPackageFile*{fontspec}{%
-  \input{lltjp-fontspec-immediate.sty}
-  % \RequirePackage だと fontspec にオプション指定したときにエラー出る
-}
-\AtEndOfPackageFile*{unicode-math}{%
-  \input{lltjp-unicode-math-immediate.sty}
-}
-
-\@ifpackageloaded{siunitx}{%
-  \chardef\ltj@patch@siunitx@execute\z@\input{lltjp-siunitx.sty}%
-}{%
-  \AtBeginOfPackageFile*{siunitx}{\input{lltjp-siunitx.sty}}%
-}
-\AtEndOfPackageFile*{siunitx}{\csname __ltj_siunitx_patch:\endcsname}
 
 %%------------------ all done
 \ltj@latex@AtEnd
index 738760c..489c70f 100644 (file)
    \__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
index 4a248cc..6095b14 100644 (file)
Binary files a/test/test07-math-unicode.pdf and b/test/test07-math-unicode.pdf differ
index 0b63236..c16ee31 100644 (file)
@@ -1,23 +1,23 @@
 %#!lualatex
-\documentclass{ltjsarticle}
+\documentclass{article}
 \usepackage[a4paper]{geometry}
-\makeatletter\ltj@alljachar %←全部の(>=U+0080な)文字を和文文字扱いに!
+\makeatletter
 
-\usepackage{luatexja-fontspec}
 \usepackage{unicode-math}
 
-
-\setmathfont{XITSMath}
+\usepackage{luatexja-fontspec}
 \setmainjfont{IPAGothic}
+\setmathfont{XITSMath}
+
+\ltj@alljachar %←全部の(>=U+0080な)文字を和文文字扱いに!
+\setmainfont{TexGyreTermes}
 
-\makeatletter
 \reDeclareMathAlphabet{\mathtestA}{\mathrm}{\mathmc}
 \reDeclareMathAlphabet{\mathtestB}{\mathrm}{\mathtestb}
 \reDeclareMathAlphabet{\mathtestC}{\mathtesta}{\mathmc}
 \reDeclareMathAlphabet{\mathtestD}{\mathtesta}{\mathtestb}
 \reDeclareMathAlphabet{\mathtestE}{\mathtestE}{\mathmc}
 \begin{document}\makeatletter
-
 \[
  \frac1{1^2}+\frac1{2^2}+\cdots=
 \sum_{n=1}^\infty \frac1{n^s}=\zeta(2)=\frac{\pi^2}{6}
@@ -48,4 +48,9 @@ mathgt: $\mathgt{\alpha あいうえおabcde}$
 \tt\meaning\mathtestD
 
 \tt\meaning\mathtestE
+
+\meaning\lfloor
+\[
+\lceil x\rceil + \lfloor x\rfloor +\hat a-\sqrt{a} - [\hbar]
+\]
 \end{document}
index b23fa78..31c94e0 100644 (file)
Binary files a/test/test09-fontspec.pdf and b/test/test09-fontspec.pdf differ
index c97b74b..355827a 100644 (file)
@@ -11,7 +11,8 @@
 
 
 \usepackage{luatexja}
-\usepackage{luatexja-fontspec,booktabs,array,lltjext}
+\usepackage{luatexja-fontspec}
+\usepackage{booktabs,array,lltjext}
 
 \defaultfontfeatures{Numbers=OldStyle}
 \setmainfont{TeXGyreTermes}
@@ -21,7 +22,7 @@
 \setmainjfont[BoldFont=IPAexGothic]{IPAexMincho} % default: JFM=ujis
 \setsansjfont{IPAexGothic}
 
-\newjfontfamily\ipajisninety[CJKShape=JIS1990]{IPAexMincho}
+\setjfontfamily\ipajisninety[CJKShape=JIS1990]{IPAexMincho}
 
 \normalsize
 \usepackage[margin=25mm,a4paper]{geometry}
 \vbox{\hsize=7\zw\tate\parindent1\zw\R}}
 
 \subsection{Kerning}
-{\jfontspec[NoEmbed]{Ryumin-Light}
-
+{\jfontspec{KozMinPr6N-Regular}
 アノ ← Kerning=Off
 
 \noindent{\addjfontfeatures{Kerning=On} アノ ← Kerning=On}
-}
+\par}
 
 \subsection{unicode}
 
@@ -96,7 +96,7 @@
 
 \newpage
 \section{fontspecによる非埋め込みフォント}
-\newjfontfamily\test[BoldFont=GothicBBB-Medium, NoEmbed]{Ryumin-Light}
+\setjfontfamily\test[BoldFont=GothicBBB-Medium, NoEmbed]{Ryumin-Light}
 
 %{\test
 %\begin{tabular}<y>{ll>{\itshape}l>{\slshape}l}
 %\end{tabular}}
 
 \section{JFMの違い}
-\newjfontfamily\test[ TateFont=KozGoPr6N-Light ]{KozMinPr6N-Bold}
+\setjfontfamily\test[ TateFont=KozGoPr6N-Light ]{KozMinPr6N-Bold}
 
 \def\yttest{\leavevmode%
 \parbox<y>{20\zw}{%
 \yttest
 
 
+\section{match}
+
+\normalfont
+\sffamily aiuあいう\rmfamily aiuあいう \ttfamily aiuあいう
+
 \end{document}
\ No newline at end of file