\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2017/06/18 LaTeX support of LuaTeX-ja]
-
-% LaTeX2e 2017/05/01 で行われる対策
-% 本 sty からは 2018/05/01 削除予定
-\ifx\document@default@language \@undefined
- \let\document@default@language\m@ne
-\fi
-\ifx\l@nohyphenation \@undefined
- \newlanguage\l@nohyphenation
-\fi
+\ProvidesPackage{ltj-latex}[2018/08/23 LaTeX support of LuaTeX-ja]
% cleanup at end of the document
%\let\ltj@@orig@end=\@@end
\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{unicode-math}
-\ltj@pkgpatch{xunicode}
-\ltj@pkgpatch{fontspec}
-\ltj@pkgpatch{footmisc}
+\ltj@pkgpatch@im{listings}
+\ltj@pkgpatch{xunicode} %% at \begin{document}
+\ltj@pkgpatch@im{fontspec}
+\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 にオプション指定したときにエラー出る
-}
-
%%------------------ all done
\ltj@latex@AtEnd