OSDN Git Service

\verb-related patches (sync with platex/b980a9cd) (WIP)
[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}[2017/03/12 LaTeX support of LuaTeX-ja]
16
17 % LaTeX2e 2017/05/01 で行われる対策
18 \ifx\l@nohyphenation \@undefined
19   \newlanguage\l@nohyphenation
20 \fi
21
22 % cleanup at end of the document
23 %\let\ltj@@orig@end=\@@end
24 %\protected\def\@@end{%
25 %  \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
26
27 % Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro)
28 \long\def\ltj@g@addto@macro#1#2{%
29   \begingroup
30     \def\ltj@tmpa{#2}
31     \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1}
32     \xdef#1{\the\toks@}
33   \endgroup}
34
35 \def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook}
36
37 \def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}}
38
39 % similar to \ltj@pkgpatch, but this is used .sty which
40 % can be reloaded inside the document by \input.
41 \def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}}
42
43 \endlinechar=13
44
45 %%% patch for LaTeX
46 \usepackage{lltjfont}
47 \usepackage{lltjdefs}
48 \usepackage{lltjcore}
49
50 %%% default parameters
51 \directlua{
52   local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
53   luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {}
54 }
55
56 \ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt,
57   xkanjiskip=.25\zw plus 1pt minus 1pt,
58   autospacing, autoxspacing, jacharrange={-1},
59   yalbaselineshift=\z@, yjabaselineshift=\z@,
60   jcharwidowpenalty=500, differentjfm=paverage
61 }
62
63 \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
64
65 %%% patch for packages
66 \ltj@pkgpatch{listings}
67 \ltj@pkgpatch{unicode-math}
68 \ltj@pkgpatch{xunicode}
69 \ltj@pkgpatch{fontspec}
70 \ltj@pkgpatch{footmisc}
71 \ltj@pkgpatch{tascmac}
72 \ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{%
73   \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}%
74   \makeatletter\input{lltjp-tascmac.sty}%
75   \ltj@asc@temp\let\ltj@asc@temp=\relax
76 }{}}% ascmac
77 \ltj@pkgpatch{stfloats}
78
79 \RequirePackage{lltjp-geometry}
80 \RequirePackage{filehook}
81 \AtEndOfPackageFile*{fontspec}{%
82   \input{lltjp-fontspec-immediate.sty}
83   % \RequirePackage だと fontspec にオプション指定したときにエラー出る
84 }
85
86
87 %%------------------ all done
88 \ltj@latex@AtEnd
89 \endinput
90 %% EOF