X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-latex.sty;h=0176d446a700eab75f8721401965342cd30fc545;hb=0f0921ced2b53537326ad20ce546020b3cae2670;hp=1c6fa4aa67e9dfafb6cf096050904033e068476e;hpb=784b9d6b79d08fd89eb36b166dbe26bb9d58707a;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-latex.sty b/src/ltj-latex.sty index 1c6fa4a..0176d44 100644 --- a/src/ltj-latex.sty +++ b/src/ltj-latex.sty @@ -8,36 +8,41 @@ \edef\ltj@latex@AtEnd{% \endlinechar=\the\endlinechar \relax} -\endlinechar=-1 % +\endlinechar\m@ne% \def\luatexjalatexLoaded{\endinput} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ltj-latex}[2012/04/21 LuaLaTeX-ja] - -\def\ltj@pkgpatchlist{} -\def\ltj@pkgpatch#1{ - \@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{ - \@ifpackageloaded{filehook}{\AtEndOfPackageFile*{#1}{\usepackage{lltjp-#1}}}{} - } - \ifx\ltj@pkgpatchlist\@empty - \gdef\ltj@pkgpatchlist{#1} - \else - \xdef\ltj@pkgpatchlist{\ltj@pkgpatchlist, #1} - \fi -} +\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 + +% cleanup at end of the document +%\let\ltj@@orig@end=\@@end +%\protected\def\@@end{% +% \directlua{luatexja.ext_cleanup()}\ltj@@orig@end} + +% Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro) +\long\def\ltj@g@addto@macro#1#2{% + \begingroup + \def\ltj@tmpa{#2} + \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1} + \xdef#1{\the\toks@} + \endgroup} + +\def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook} + +\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{ - \@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{ - \@ifpackageloaded{filehook}{\AtEndOfFile{#1.sty}{\input{lltjp-#1.sty}}}{} - } - \ifx\ltj@pkgpatchlist\@empty - \gdef\ltj@pkgpatchlist{#1} - \else - \xdef\ltj@pkgpatchlist{\ltj@pkgpatchlist, #1} - \fi -} +\def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}} \endlinechar=13 @@ -47,29 +52,44 @@ \usepackage{lltjcore} %%% default parameters -\ltjsetparameter{kanjiskip=0pt plus 0.4pt minus 0.4pt, +\directlua{ + local s = kpse.find_file('ltj-kinsoku.lua', 'tex') + luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {} +} + +\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt, xkanjiskip=.25\zw plus 1pt minus 1pt, autospacing, autoxspacing, jacharrange={-1}, - yalbaselineshift=0pt, yjabaselineshift=0pt, - jcharwidowpenalty=500, differentjfm=average + yalbaselineshift=\z@, yjabaselineshift=\z@, + jcharwidowpenalty=500, differentjfm=paverage } -\input luatexja-kinsoku.tex \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax %%% patch for packages -\IfFileExists{filehook.sty}{\usepackage{filehook}}{} \ltj@pkgpatch{listings} \ltj@pkgpatch{unicode-math} \ltj@pkgpatch{xunicode} -\@ifpackageloaded{filehook}{}{% - \@PackageWarningNoLine{ltj-latex}{ - LuaTeX-ja uses filehook package to apply patches to the following packages:\MessageBreak - \ltj@pkgpatchlist.\MessageBreak - But your TeX system does not have the filehook package.\MessageBreak - Therefore problems may occur if you load the above packages after this message}% +\ltj@pkgpatch{fontspec} +\ltj@pkgpatch{footmisc} +\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} + +\RequirePackage{lltjp-geometry} +\RequirePackage{filehook} +\AtEndOfPackageFile*{fontspec}{% + \input{lltjp-fontspec-immediate.sty} + % \RequirePackage だと fontspec にオプション指定したときにエラー出る } + %%------------------ all done \ltj@latex@AtEnd \endinput