OSDN Git Service

Merge branch 'kmaeda-manual' into kitagawa_test
[luatex-ja/luatexja.git] / src / luatexja-latex.sty
index 3091eeb..bc8be82 100644 (file)
 \def\luatexjalatexLoaded{\endinput}
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-latex}[2011/11/20 v0.2]
+\ProvidesPackage{luatexja-latex}[2011/11/22 LuaLaTeX-ja]
 
-\endlinechar=13
+\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
+}
 
+% 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
+}
+
+\endlinechar=13
 
 %%% patch for LaTeX
-\input{lltjfont.sty}
-\input{lltjdefs.sty}
-\input{lltjcore.sty}
+\usepackage{lltjfont}
+\usepackage{lltjdefs}
+\usepackage{lltjcore}
 
 %%% default parameters
-\ltjsetparameter{kanjiskip=0pt plus 0.4pt minus 0.4pt, 
+\ltjsetparameter{kanjiskip=0pt plus 0.4pt minus 0.4pt,
   xkanjiskip=.25\zw plus 1pt minus 1pt,
-  autospacing, autoxspacing, jacharrange={-1}, 
+  autospacing, autoxspacing, jacharrange={-1},
   yalbaselineshift=0pt, yjabaselineshift=0pt,
   jcharwidowpenalty=500, differentjfm=average
 }
 \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
 
 %%% patch for packages
-\RequirePackage{expl3}
-\ExplSyntaxOn
-\def\ltj@pkgpatch#1#2#3#4{\@ifpackageloaded{#1}{\typeout{#1: TRUE}#3#2}{\typeout{#1: FALSE}%
-  \@ifpackageloaded{filehook}{\bool_set_true:N \l_tmpa_bool} {\bool_set_false:N \l_tmpa_bool} %
-  \file_if_exist:nTF {filehook.sty} 
-    { \usepackage{filehook} \bool_set_true:N \l_tmpa_bool } 
-    {}%
-  \bool_if:NTF \l_tmpa_bool 
-    {\AtEndOfPackageFile*{#1}{#4#2}} 
-    {}
-  }%
+\IfFileExists{filehook.sty}{\usepackage{filehook}}{}
+\ltj@pkgpatch{listings}
+\ltj@pkgpatch{unicode-math}
+\ltj@pkgpatch{xunicode}
+\@ifpackageloaded{filehook}{}{%
+  \@PackageWarningNoLine{luatexja-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}{\usepackage{luatexja-fontspec}}{}{}
-\ltj@pkgpatch{unicode-math}{%
-  \cs_set:Npn \um_set_mathcode:nnnn #1#2#3#4 {
-    \Umathcode \int_eval:n {#1} =
-      \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
-    \directlua{luatexja.math.is_math_letters[\int_eval:n {#4}]=true}
-  }
-  \cs_set:Npn \um_set_mathcode:nnn #1#2#3 {
-    \Umathcode \int_eval:n {#1} =
-      \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop:
-    \directlua{luatexja.math.is_math_letters[\int_eval:n {#1}]=true}
-  }
-  \cs_set:Npn \um_set_mathchar:NNnn #1#2#3#4 {
-    \Umathchardef #1 =
-      \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
-    \directlua{luatexja.math.is_math_letters[\int_eval:n {#4}]=true}
-  }
-}{}{}
-\ExplSyntaxOff
-
 %%------------------ all done
 \ltj@latex@AtEnd
 \endinput