OSDN Git Service

simplified patch for fontspec package
[luatex-ja/luatexja.git] / src / ltj-latex.sty
1 %
2 % ltj-latex.sty
3 %
4
5 %! これは外から読まれない
6 %% Avoid multiple loading.
7 \csname luatexjalatexLoaded\endcsname
8 \edef\ltj@latex@AtEnd{%
9 \endlinechar=\the\endlinechar
10 \relax}
11 \endlinechar\m@ne%
12 \def\luatexjalatexLoaded{\endinput}
13
14 \NeedsTeXFormat{LaTeX2e}
15 \ProvidesPackage{ltj-latex}[2018/08/23 LaTeX support of LuaTeX-ja]
16
17 % cleanup at end of the document
18 %\let\ltj@@orig@end=\@@end
19 %\protected\def\@@end{%
20 %  \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
21
22 % Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro)
23 \long\def\ltj@g@addto@macro#1#2{%
24   \begingroup
25     \def\ltj@tmpa{#2}
26     \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1}
27     \xdef#1{\the\toks@}
28   \endgroup}
29
30 \def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook}
31
32 \def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}}
33
34 \endlinechar=13
35
36 %%% patch for LaTeX
37 \usepackage{lltjfont}
38 \usepackage{lltjdefs}
39 \usepackage{lltjcore}
40
41 \RequirePackage{filehook}
42 \def\ltj@pkgpatch@im#1{%
43  \@ifnextchar[{\ltj@pkgpatch@im@{#1}}{\ltj@pkgpatch@im@{#1}[lltjp-#1]}}%]
44 \def\ltj@pkgpatch@im@#1[#2]{\AtEndOfPackageFile*{#1}{\input{#2.sty}}}
45
46 %%% default parameters
47 \directlua{
48   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
49   luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {}
50 }
51
52 \ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt,
53   xkanjiskip=.25\zw plus 1pt minus 1pt,
54   autospacing, autoxspacing, jacharrange={-1},
55   yalbaselineshift=\z@, yjabaselineshift=\z@,
56   jcharwidowpenalty=500, differentjfm=paverage
57 }
58
59 \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
60
61 %%% patch for packages
62 \ltj@pkgpatch@im{listings}
63 \ltj@pkgpatch{xunicode}  %% at \begin{document}
64 \ltj@pkgpatch@im{fontspec}
65 \ltj@pkgpatch{footmisc}  %% at \begin{document}
66 \ltj@pkgpatch{tascmac}
67 \ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{%
68   \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}%
69   \makeatletter\input{lltjp-tascmac.sty}%
70   \ltj@asc@temp\let\ltj@asc@temp=\relax
71 }{}}% ascmac
72 \ltj@pkgpatch@im{stfloats}
73 \ltj@pkgpatch{preview}  %% at \begin{document}
74   % (preview package has delayed option)
75 \ltj@pkgpatch{array}    %% at \begin{document}
76 \ltj@pkgpatch@im{unicode-math}
77 \ltj@pkgpatch@im{siunitx}
78
79 \RequirePackage{lltjp-geometry}
80
81 %%------------------ all done
82 \ltj@latex@AtEnd
83 \endinput
84 %% EOF