summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/src/ltj-latex.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/luatex/generic/luatexja/src/ltj-latex.sty
Initial commit
Diffstat (limited to 'macros/luatex/generic/luatexja/src/ltj-latex.sty')
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-latex.sty91
1 files changed, 91 insertions, 0 deletions
diff --git a/macros/luatex/generic/luatexja/src/ltj-latex.sty b/macros/luatex/generic/luatexja/src/ltj-latex.sty
new file mode 100644
index 0000000000..446707bd69
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/ltj-latex.sty
@@ -0,0 +1,91 @@
+%
+% ltj-latex.sty
+%
+
+%! これは外から読まれない
+%% Avoid multiple loading.
+\csname luatexjalatexLoaded\endcsname
+\edef\ltj@latex@AtEnd{%
+\endlinechar=\the\endlinechar
+\relax}
+\endlinechar\m@ne%
+\def\luatexjalatexLoaded{\endinput}
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ltj-latex}[2018/08/24 LaTeX support of LuaTeX-ja]
+
+% cleanup at end of the document
+%\let\ltj@@orig@end=\@@end
+%\protected\def\@@end{%
+% \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
+
+\endlinechar=13
+
+%%% patch for LaTeX
+\usepackage{lltjfont}
+\usepackage{lltjdefs}
+\usepackage{lltjcore}
+
+%%% patching commands
+\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}{%
+ \@ifpackageloaded{#2}{}{%
+ \@namedef{ver@#2.\@pkgextension}{0000/00/00}%dummy
+ \if\catcode`@=11\let\ltj@temp\relax\else
+ \edef\ltj@temp{\noexpand\catcode`@=\the\catcode`@\relax}\makeatletter
+ \fi
+ \@@input{#2.\@pkgextension}\ltj@temp
+ }%
+ }%
+}
+
+\def\ltj@pkgpatch#1{%
+ \@ifnextchar[{\ltj@pkgpatch@@{#1}}{\ltj@pkgpatch@@{#1}[lltjp-#1]}}%]
+\def\ltj@pkgpatch@@#1[#2]{%
+ \gpreto\@begindocumenthook{%
+ \@ifpackageloaded{#1}{%
+ \@ifpackageloaded{#2}{}{\RequirePackage{#2}}%
+ }{}%
+ }%
+}
+
+%%% default parameters
+\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=\z@, yjabaselineshift=\z@,
+ jcharwidowpenalty=500, differentjfm=paverage
+}
+
+\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
+
+%%% patch for packages
+\ltj@pkgpatch@im{listings}
+\ltj@pkgpatch{xunicode} %% at \begin{document}
+\ltj@pkgpatch@im{fontspec}
+\ltj@pkgpatch{footmisc} %% at \begin{document}
+\ltj@pkgpatch{tascmac}
+\ltj@pkgpatch{ascmac}[lltjp-tascmac]
+\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}
+\ltj@pkgpatch@im{microtype}
+
+\RequirePackage{lltjp-geometry}
+
+%%------------------ all done
+\ltj@latex@AtEnd
+\endinput
+%% EOF