6 %% Avoid multiple loading.
7 \csname luatexjalatexLoaded\endcsname
8 \edef\ltj@latex@AtEnd{%
9 \endlinechar=\the\endlinechar
12 \def\luatexjalatexLoaded{\endinput}
14 \NeedsTeXFormat{LaTeX2e}
15 \ProvidesPackage{ltj-latex}[2018/06/15 LaTeX support of LuaTeX-ja]
17 % LaTeX2e 2017/05/01 で行われる対策
18 % 本 sty からは 2018/05/01 削除予定
19 \ifx\document@default@language \@undefined
20 \let\document@default@language\m@ne
22 \ifx\l@nohyphenation \@undefined
23 \newlanguage\l@nohyphenation
26 % cleanup at end of the document
27 %\let\ltj@@orig@end=\@@end
28 %\protected\def\@@end{%
29 % \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
31 % Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro)
32 \long\def\ltj@g@addto@macro#1#2{%
35 \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1}
39 \def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook}
41 \def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}}
43 % similar to \ltj@pkgpatch, but this is used .sty which
44 % can be reloaded inside the document by \input.
45 \def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}}
54 %%% default parameters
56 local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
57 luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {}
60 \ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt,
61 xkanjiskip=.25\zw plus 1pt minus 1pt,
62 autospacing, autoxspacing, jacharrange={-1},
63 yalbaselineshift=\z@, yjabaselineshift=\z@,
64 jcharwidowpenalty=500, differentjfm=paverage
67 \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
69 %%% patch for packages
70 \ltj@pkgpatch{listings}
71 \ltj@pkgpatch{unicode-math}
72 \ltj@pkgpatch{xunicode}
73 \ltj@pkgpatch{fontspec}
74 \ltj@pkgpatch{footmisc}
75 \ltj@pkgpatch{tascmac}
76 \ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{%
77 \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}%
78 \makeatletter\input{lltjp-tascmac.sty}%
79 \ltj@asc@temp\let\ltj@asc@temp=\relax
81 \ltj@pkgpatch{stfloats}
82 \ltj@pkgpatch{preview}
85 \RequirePackage{lltjp-geometry}
86 \RequirePackage{filehook}
87 \AtEndOfPackageFile*{fontspec}{%
88 \input{lltjp-fontspec-immediate.sty}
89 % \RequirePackage だと fontspec にオプション指定したときにエラー出る
92 \@ifpackageloaded{siunitx}{%
93 \chardef\ltj@patch@siunitx@execute\z@\input{lltjp-siunitx.sty}%
95 \AtBeginOfPackageFile*{siunitx}{\input{lltjp-siunitx.sty}}%
97 \AtEndOfPackageFile*{siunitx}{\csname __ltj_siunitx_patch:\endcsname}
99 %%------------------ all done