--- /dev/null
+*.log
+*.aux
+*.toc
+*.out
+*.tmp
+*~
\usepackage[margin=20mm,footskip=5mm]{geometry}
\usepackage{amsmath,amssymb,xcolor,pict2e,multienum,amsthm,float}
-\usepackage{booktabs,listings,lltjlisting,showexpl,multicol}
+\usepackage{booktabs,listings,showexpl,multicol}
\usepackage{luatexja-otf}
\usepackage{luatexja-fontspec}
\usepackage[unicode]{hyperref}
\CID{7652}飾区の\CID{13706}野家,
葛飾区の吉野家
\end{LTXexample}
-%lltjlisting.sty要修正?:↑「森」の直後で改行.
+%lltjp-listings.sty要修正?:↑「森」の直後で改行.
%<en>\subsection{Changing Fonts}
\item[\Param{yjabaselineshift}\,=<dimen>$^\ast$]\
\item[\Param{yalbaselineshift}\,=<dimen>$^\ast$] [\verb+\ybaselineshift+]
-\item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\inhibitxspcode+]
+\item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}]
Setting whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>.
The followings are allowed for <mode>:
\begin{description}
\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character.
-\item[2, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
-\item[1, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
+\item[1, \texttt{preonly}] Insertion of \Param{xkanjiskip} is allowed before the character, but not after.
+\item[2, \texttt{postonly}] Insertion of \Param{xkanjiskip} is allowed after the character, but not before.
\item[3, \texttt{allow}] Insertion of \Param{xkanjiskip} is allowed before the character and after the character.
This is the default value.
\end{description}
+This parameter is similar to the \verb+\inhibitxspcode+ primitive of \pTeX, but not compatible with \verb+\inhibitxspcode+.
+
\item[\Param{alxspmode}\,=\{<chr\_code>,<mode>\}] [\verb+\xspcode+]
before the character and after the character.
This is the default value.
\end{description}
-Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table.
+Note that parameters \Param{jaxspmode} and \Param{alxspmode} use a common table, hence these two parameters are synonyms of each other.
\item[\Param{autospacing}\,=<bool>$^\ast$] [\verb+\autospacing+]
\item[\Param{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-fontspec}[2011/11/16 v0.3]
-
-\def\UTFencname{EU2}\def\XeTeXpicfile{}
-\RequirePackage{xunicode}
-%% Patch for xunicode.sty
-{\catcode`\"=12
-\gdef\check@hexcom@digits@#1#2#3#4#5@!@#6#7#8{%
- \ifx @#4\relax
- \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8}%
- \else
- \ifcat \active\noexpand#8%
- \ifx\add@flag\@ne %
- \expandafter\def\csname\UTFencname\string#8\endcsname{\ltjalchar"#1#2#3#4\relax}%
- \ifx\unDeFiNed@#8%
- \ifx\cf@encoding\UTFencname
- \DeclareTextCommand{#8}{OT1}{\undefined}%
- \else
- \DeclareTextCommand{#8}{\cf@encoding}{\undefined}%
- \fi
- \else {% macro #8 exists already ...
- \let\protect\noexpand
- \edef\UTF@testi{#8}\def\UTF@testii{#8}%
- \ifx\UTF@testi\UTF@testii\aftergroup\UTF@ignore
- \else\aftergroup\UTF@doit\fi
- }%
- \iffalse
- % ... but when it isn't robust, make it so
- \expandafter\let\csname?-\string#8\endcsname#8\relax
- \edef\next@UTF@{{\cf@encoding}%
- {\expandafter\noexpand\csname?-\string#8\endcsname}}%
- \expandafter\DeclareTextCommand\expandafter
- {\expandafter#8\expandafter}\next@UTF@
- \fi
- \fi %
- \else % \add@flag \z@
- \expandafter\global\expandafter
- \let\csname\UTFencname\string#8\endcsname\relax
- \fi % end of \add@flag switch
- \else % not active catcode --- shouldn't happen
- % \typeout{*** did you really mean #8 ? ***}%
- \ifx\add@flag\@ne %
- \edef\tmp@name{\expandafter\string\csname\UTFencname\endcsname
- \expandafter\string\csname#8\endcsname}%
- \expandafter\def\csname\tmp@name\endcsname{\ltjalchar"#1#2#3#4\relax}%
- \ifx\cf@encoding\UTFencname
- \expandafter\DeclareTextCommand\expandafter
- {\csname#8\endcsname}{OT1}{\undefined}%
- \else
- \expandafter\DeclareTextCommand\expandafter
- {\csname#8\endcsname}{\cf@encoding}{\undefined}%
- \fi
- \else % \add@flag \z@
- \expandafter\global\expandafter\let\csname#8\endcsname\relax
- \fi % end of \add@flag switch
- \fi % end of \ifcat
- \fi}
-\gdef\check@hex@digits@#1#2#3#4#5@!@#6#7#8#9{%
- \ifx @#4\relax
- \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8#9}%
- \else
- \def\UTFchar{\ltjalchar"#1#2#3#4\relax}%
- \expandafter\expandafter\expandafter\declare@utf@composite
- \expandafter\expandafter\expandafter
- {\expandafter\csname#6\endcsname}{\UTFchar}{#8}{#9}\relax
- \fi}
-%\gdef\add@UTF@accent#1#2#3{#2\ltjalchar"#1\relax}
-\gdef\add@UTF@accent#1#2#3{\ifx\relax#2\relax\ltjalchar"#3\else
- \ifx\ #2\relax\ltjalchar"#3\else
- \expandafter\ifx\UTF@space#2\relax\ltjalchar"#3\else
- \ifx~#2\ltjalchar"#3\else#2\ltjalchar"#1\fi\fi\fi\fi\relax}
-\gdef\add@UTF@accents#1#2#3{#2\ltjalchar"#1\ltjalchar"#3\relax}
-}
-%% End of patch for xunicode.sty "
+\ProvidesPackage{luatexja-fontspec}[2011/09/23 v0.2]
-\RequirePackage{fontspec}
-\RequirePackage{luatexja}
+\RequirePackage{fontspec,luatexja}
\ExplSyntaxOn
\cs_set_eq:NN \addjfontfeature \addjfontfeatures
-% We reload xunicode package here.
-\ExplSyntaxOff\ReloadXunicode{EU2}
\endinput
-
-%% the following patch is needed to xunicode.sty:
-%%
---- /opt/texlive/2011/texmf-dist/tex/xelatex/xunicode/xunicode.sty 2011-09-12 08:31:47.000000000 +0900
-+++ xunicode.sty 2011-11-16 22:06:17.061413113 +0900
-@@ -1475,7 +1475,11 @@
-
- \newtoks\tipasavetokens
- \newtoks\tipachecktokens
-+
-+\fi
- \newif\iftipaonetoken
-+\expandafter\ifx\csname ReloadXunicode\endcsname\relax
-+
- \def\tipalasttoken{!@! do nothing with this !@!}
- \def\tipacatchonechar#1{\begingroup
- \def\textipa##1{##1}% prevent recursion
function math.two_add(a,b) return a+b end
function math.two_average(a,b) return (a+b)/2 end
----- table: charprop_stack_table [stack_level][chr_code].{pre|post|xsp}
+---- table: charprop_stack_table [stack_level].{pre|post|xsp}[chr_code]
------------------------------------------------------------------------
-- CODE FOR GETTING/SETTING PARAMETERS
\def\zw{\directlua{luatexja.jfont.load_zw()}\ltj@zw}
\def\zh{\directlua{luatexja.jfont.load_zh()}\ltj@zh}
+
%%%%%%%% \inhibitglue
+\protected\def\ltj@reset@globaldefs{%
+ \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}}
+\protected\def\ltj@restore@globaldefs{\directlua{tex.globaldefs = ltj.global_temp}}
\let\new@everypar=\everypar
\protected\def\inhibitglue{\relax%
\ifvmode
- \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}% trick
+ \ltj@reset@globaldefs
\xdef\@@tempa{\the\everypar}%
\xdef\@@tempb{\everypar={\@@tempa}\@@tempa\noexpand\ltj@@ihb}%
\everypar\expandafter{\@@tempb}%
- \directlua{tex.globaldefs = ltj.global_temp}% trick
+ \ltj@restore@globaldefs
\else\ifhmode\ltj@@ihb\fi\fi}
\def\ltj@@ihb{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
\define@key[ltj]{japaram}{jascriptscriptfont}{%
\expandafter\ltj@@set@stackfont#1:{mjss}}
\def\ltj@@set@stackfont#1,#2:#3{%
- \directlua{%
- ltj.global_temp = tex.globaldefs;
- tex.globaldefs = 0}%
+ \ltj@reset@globaldefs
\ltj@tempcnta=\ltj@curjfnt\ltj@curjfnt=-1 #2%
\ifnum\ltj@curjfnt=-1
\@PackageError{luatexja-core}%
\ltj@safe@num@or\ltj@defnum{#1}, \the\ltj@curjfnt)}%
\fi
\ltj@curjfnt=\ltj@tempcnta
- \directlua{tex.globaldefs = ltj.global_temp}%
+ \ltj@restore@globaldefs
}
% yalbaselineshift = <dimen>
% jaxspmode = {<char_code>, <mode>}
% mode: inhibit, preonly, postonly, allow
-% or 0 2 1 3
+% or 0 1 2 3
\define@key[ltj]{japaram}{jaxspmode}{% \inhibitxspcode
\expandafter\ltj@set@jaxspmode#1:\relax}
\def\ltj@set@jaxspmode#1,#2:{%
\lowercase{\edef\ltj@temp{#2}}%
\def\ltj@tempa{inhibit}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{0}\fi
- \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi
- \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi
+ \def\ltj@tempa{preonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{1}\fi
+ \def\ltj@tempa{postonly}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{2}\fi
\def\ltj@tempa{allow}\ifx\ltj@temp\ltj@tempa\def\ltj@temp{3}\fi
\directlua{luatexja.stack.set_stack_table(ltj.isglobal, 'xsp',
\ltj@safe@num@or\ltj@defnum{#1},
\csname ltj@kcat4\endcsname="7FFFFFFF %"
\csname ltj@kcat5\endcsname="7FFFFFFF %"
\csname ltj@kcat6\endcsname="7FFFFFFF }%"
-\protected\def\ltj@backup@kcat{\edef\ltj@restore@kcat{%
- \csname ltj@kcat0\endcsname=\expandafter\the\csname ltj@kcat0\endcsname\relax
- \csname ltj@kcat1\endcsname=\expandafter\the\csname ltj@kcat1\endcsname\relax
- \csname ltj@kcat2\endcsname=\expandafter\the\csname ltj@kcat2\endcsname\relax
- \csname ltj@kcat3\endcsname=\expandafter\the\csname ltj@kcat3\endcsname\relax
- \csname ltj@kcat4\endcsname=\expandafter\the\csname ltj@kcat4\endcsname\relax
- \csname ltj@kcat5\endcsname=\expandafter\the\csname ltj@kcat5\endcsname\relax
- \csname ltj@kcat6\endcsname=\expandafter\the\csname ltj@kcat6\endcsname\relax}}
-\let\ltj@restore@kcat=\relax
-
-\protected\def\ltjjachar{\afterassignment\ltj@@kchar\ltj@tempcnta}
-\def\ltj@@kchar{{\directlua{tex.globaldefs = 0}\ltj@alljachar\ltj@@origchar\ltj@tempcnta}}
-\protected\def\ltjalchar{\afterassignment\ltj@@achar\ltj@tempcnta}
-\def\ltj@@achar{{\directlua{tex.globaldefs = 0}\ltj@allalchar\ltj@@origchar\ltj@tempcnta}}
+\protected\def\ltjjachar{\afterassignment\ltj@@jachar\ltj@tempcnta}
+\def\ltj@@jachar{{\directlua{tex.globaldefs = 0}\ltj@alljachar\ltj@@origchar\ltj@tempcnta}}
+\protected\def\ltjalchar{\afterassignment\ltj@@alchar\ltj@tempcnta}
+\def\ltj@@alchar{{\directlua{tex.globaldefs = 0}\ltj@allalchar\ltj@@origchar\ltj@tempcnta}}
+%%%%%%%% \ltjsetmathletter<number>, \ltjunsetmathletter<number>
+\def\ltjsetmathletter#1{\directlua{luatexja.math.is_math_letters[#1]=true}}
+\def\ltjunsetmathletter#1{\directlua{luatexja.math.is_math_letters[#1]=false}}
%%------------------ Load module for the format
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-latex}[2011/08/01 v0.1]
+\ProvidesPackage{luatexja-latex}[2011/11/22 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
+}
\endlinechar=13
+%%% patch for LaTeX
+\usepackage{lltjfont}
+\usepackage{lltjdefs}
+\usepackage{lltjcore}
-%%% patch for LaTeX (similar to plfonts.dtx)
-\input{lltjfont.sty}
-\input{lltjdefs.sty}
-\input{lltjcore.sty}
-
-%%% parameter
-
+%%% default parameters
\ltjsetparameter{kanjiskip=0pt plus 0.4pt minus 0.4pt,
xkanjiskip=.25\zw plus 1pt minus 1pt,
autospacing, autoxspacing, jacharrange={-1},
}
\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{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}%
+}
%%------------------ all done
\ltj@latex@AtEnd
\ltjdefcharrange{8}{"B4, "A8, "B1, "D7, "F7, "B0, "A7, "B6}
\ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
+\directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end}
+
%%------------------ all done
\ltj@plain@AtEnd
\endinput
local ltjs_get_penalty_table = ltjs.get_penalty_table
local ltjs_get_skip_table = ltjs.get_skip_table
+local ltjf_find_char_class = ltjf.find_char_class
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_metrics = ltjf.metrics
local box_stack_level
-------------------- Helper functions
-- This function is called only for acquiring `special' characters.
-local function find_char_class(c,m)
+local function fast_find_char_class(c,m)
return m.chars[c] or 0
end
check_next_ickern()
end
+local calc_np_auxtable = {
+ [id_glyph] = function()
+ Np.first = lp
+ if lp.font == has_attr(lp, attr_curjfnt) then
+ Np.id = id_jglyph
+ else
+ Np.id = id_glyph
+ end
+ Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp)
+ lp = node_next(lp); check_next_ickern(); return true
+ end,
+ [id_hlist] = function()
+ Np.first = lp; Np.last = lp; Np.nuc = lp;
+ set_attr_icflag_processed(lp)
+ if lp.shift~=0 then
+ Np.id = id_box_like
+ else
+ Np.id = id_hlist
+ end
+ lp = node_next(lp); return true
+ end,
+ [id_vlist] = function()
+ Np.first = lp; Np.nuc = lp; Np.last = lp;
+ Np.id = id_box_like; set_attr_icflag_processed(lp);
+ lp = node_next(lp); return true
+ end,
+ [id_rule] = function()
+ Np.first = lp; Np.nuc = lp; Np.last = lp;
+ Np.id = id_box_like; set_attr_icflag_processed(lp);
+ lp = node_next(lp); return true
+ end,
+ [id_ins] = function()
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ return false
+ end,
+ [id_mark] = function()
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ return false
+ end,
+ [id_adjust] = function()
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ return false
+ end,
+ [id_disc] = function()
+ Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp);
+ Np.last = lp; Np.id = id_disc; lp = node_next(lp); return true
+ end,
+ [id_whatsit] = function()
+ if lp.subtype==sid_user and lp.user_id==30111 then
+ local lq = node_next(lp)
+ head = node_remove(head, lp); node_free(lp); lp = lq; ihb_flag = true
+ else
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ end
+ return false
+ end,
+ [id_math] = function()
+ Np.first = lp; Np.nuc = lp;
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ while lp.id~=id_math do
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ end
+ set_attr_icflag_processed(lp);
+ Np.last = lp; Np.id = id_math; lp = node_next(lp);
+ return true
+ end,
+ [id_glue] = function()
+ Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp);
+ Np.last = lp; Np.id = id_glue; lp = node_next(lp); return true
+ end,
+ [id_kern] = function()
+ Np.first = lp
+ if lp.subtype==2 then
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ set_attr_icflag_processed(lp); lp = node_next(lp)
+ set_attr_icflag_processed(lp); Np.nuc = lp
+ if lp.font == has_attr(lp, attr_curjfnt) then
+ Np.id = id_jglyph
+ else
+ Np.id = id_glyph
+ end
+ lp = node_next(lp); check_next_ickern();
+ else
+ Np.id = id_kern; set_attr_icflag_processed(lp);
+ Np.last = lp; lp = node_next(lp)
+ end
+ return true
+ end,
+ [id_penalty] = function()
+ Bp[#Bp+1] = lp; set_attr_icflag_processed(lp);
+ lp = node_next(lp); return false
+ end,
+ [13] = function()
+ Np.first = lp; Np.nuc = lp; Np.last = lp;
+ Np.id = id_box_like; set_attr_icflag_processed(lp);
+ lp = node_next(lp); return true
+ end,
+}
+
local function calc_np()
-- We assume lp = node_next(Np.last)
local lpi, lpa, Nr
Nq = Np; Np = Nr
for k in pairs(Bp) do Bp[k] = nil end
ihb_flag = false
- while true do
- lpi = lp.id; lpa = has_attr(lp, attr_icflag) or 0
- if lp==last then Np = nil; return
- elseif lpa>=PACKED then
+ while lp ~= last do
+ lpa = has_attr(lp, attr_icflag) or 0
+ if lpa>=PACKED then
if lpa == BOXBDD then
local lq = node_next(lp)
head = node_remove(head, lp); node_free(lp); lp = lq
else calc_np_pbox(); return end -- id_pbox
- elseif lpi == id_ins or lpi == id_mark or lpi == id_adjust then
- set_attr_icflag_processed(lp); lp = node_next(lp)
- elseif lpi == id_penalty then
- table_insert(Bp, lp); set_attr_icflag_processed(lp); lp = node_next(lp)
- elseif lpi == id_whatsit then
- if lp.subtype==sid_user and lp.user_id==30111 then
- local lq = node_next(lp)
- head = node_remove(head, lp); node_free(lp); lp = lq; ihb_flag = true
- else
- set_attr_icflag_processed(lp); lp = node_next(lp)
- end
- else -- a `cluster' is found
- Np.first = lp
- if lpi == id_glyph then -- id_[j]glyph
- if lp.font == has_attr(lp, attr_curjfnt) then Np.id = id_jglyph
- else Np.id = id_glyph end
- Np.nuc = lp; set_attr_icflag_processed(lp)
- lp = node_next(lp); check_next_ickern(); return
- elseif lpi == id_hlist then -- hlist
- Np.last = lp; Np.nuc = lp; set_attr_icflag_processed(lp)
- if lp.shift~=0 then Np.id = id_box_like
- else Np.id = lpi end
- lp = node_next(lp); return
- elseif lpi == id_vlist or lpi == id_rule then -- id_box_like
- Np.nuc = lp; Np.last = lp; Np.id = id_box_like; break
- elseif lpi == id_math then -- id_math
- Np.nuc = lp; lp = node_next(lp)
- while lp.id~=id_math do
- set_attr_icflag_processed(lp); lp = node_next(lp)
- end; break
- elseif lpi == id_kern and lp.subtype==2 then -- id_kern
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); Np.nuc = lp
- if lp.font == has_attr(lp, attr_curjfnt) then Np.id = id_jglyph
- else Np.id = id_glyph end
- lp = node_next(lp); check_next_ickern(); return
- else -- id_disc, id_glue, id_kern
- Np.nuc = lp; break
- end
- end
+ elseif calc_np_auxtable[lp.id]() then return end
end
- set_attr_icflag_processed(lp); Np.last = lp; Np.id = lpi; lp = node_next(lp)
+ Np = nil; return
end
-- extract informations from Np
-- "Np is not a character" otherwise.
-- 和文文字のデータを取得
-local function set_np_xspc_jachar(c,x)
- Np.class = has_attr(x, attr_jchar_class)
- Np.char = c
+local function set_np_xspc_jachar(x)
local z = ltjf_font_metric_table[x.font]
+ local c = x.char
+ local cls = ltjf_find_char_class(c, z)
+ local m = ltjf_metrics[z.jfm]
+ set_attr(x, attr_jchar_class, cls)
+ Np.class = cls
+ Np.char = c
Np.size= z.size
- Np.met = ltjf_metrics[z.jfm]
+ Np.met = m
Np.var = z.var
Np.pre = ltjs_get_penalty_table('pre', c, 0, box_stack_level)
Np.post = ltjs_get_penalty_table('post', c, 0, box_stack_level)
- z = find_char_class('lineend', Np.met)
- local y = Np.met.size_cache[Np.size].char_type[Np.class]
+ z = fast_find_char_class('lineend', m)
+ local y = m.size_cache[Np.size].char_type[Np.class]
if y.kern and y.kern[z] then
Np.lend = y.kern[z]
else
Np.lend = 0
end
y = ltjs_get_penalty_table('xsp', c, 3, box_stack_level)
- Np.xspc_before = (y>=2)
- Np.xspc_after = (y%2==1)
+ Np.xspc_before = (y%2==1)
+ Np.xspc_after = (y>=2)
Np.auto_kspc = (has_attr(x, attr_autospc)==1)
Np.auto_xspc = (has_attr(x, attr_autoxspc)==1)
end
local function extract_np()
local x = Np.nuc
if Np.id == id_jglyph then
- set_np_xspc_jachar(x.char, x)
+ set_np_xspc_jachar(x)
elseif Np.id == id_glyph then
set_np_xspc_alchar(x.char, x, ligature_head)
elseif Np.id == id_hlist then
if check_box(x.head, nil) then
if first_char then
if first_char.font == has_attr(first_char, attr_curjfnt) then
- set_np_xspc_jachar(first_char.char,first_char)
+ set_np_xspc_jachar(first_char)
else
set_np_xspc_alchar(first_char.char,first_char, ligature_head)
end
if check_box(Np.first, node_next(Np.last)) then
if first_char then
if first_char.font == has_attr(first_char, attr_curjfnt) then
- set_np_xspc_jachar(first_char.char,first_char)
+ set_np_xspc_jachar(first_char)
else
set_np_xspc_alchar(first_char.char,first_char, ligature_head)
end
if check_box(x.replace, nil) then
if first_char then
if first_char.font == has_attr(first_char, attr_curjfnt) then
- set_np_xspc_jachar(first_char.char,first_char)
+ set_np_xspc_jachar(first_char)
else
set_np_xspc_alchar(first_char.char,first_char, ligature_head)
end
local function after_hlist()
if last_char then
if last_char.font == has_attr(last_char, attr_curjfnt) then
- set_np_xspc_jachar(last_char.char,last_char, ligature_after)
+ set_np_xspc_jachar(last_char, ligature_after)
else
set_np_xspc_alchar(last_char.char,last_char, ligature_after)
end
if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end
p.penalty = a
head = node_insert_before(head, Np.first, p)
- Bp[1] = p; set_attr(p, attr_icflag, KINSOKU)
+ table_insert(Bp, p); set_attr(p, attr_icflag, KINSOKU)
end
else for i, v in pairs(Bp) do add_penalty(v,a) end
end
if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end
p.penalty = a
head = node_insert_before(head, Np.first, p)
- Bp[1] = p; set_attr(p, attr_icflag, KINSOKU)
+ table_insert(Bp, p); set_attr(p, attr_icflag, KINSOKU)
end
else for i, v in pairs(Bp) do add_penalty(v,a) end
end
if g and g.id==id_glue then
local p = node_new(id_penalty)
p.penalty = 10000; head = node_insert_before(head, Np.first, p)
- Bp[1] = p; set_attr(p, attr_icflag, KINSOKU)
+ table_insert(Bp, p); set_attr(p, attr_icflag, KINSOKU)
end
else for i, v in pairs(Bp) do add_penalty(v,a) end
end
return new_jfm_glue(Nq, Nq.class, Np.class)
else
local g = new_jfm_glue(Nq, Nq.class,
- find_char_class('diffmet',Nq.met))
- local h = new_jfm_glue(Np, find_char_class('diffmet',Np.met),
+ fast_find_char_class('diffmet',Nq.met))
+ local h = new_jfm_glue(Np, fast_find_char_class('diffmet',Np.met),
Np.class)
return calc_ja_ja_aux(g,h)
end
if not ihb_flag then
local c
if Nq.id == id_math then c = -1 else c = 'jcharbdd' end
- return new_jfm_glue(Np, find_char_class(c,Np.met), Np.class)
+ return new_jfm_glue(Np, fast_find_char_class(c,Np.met), Np.class)
else return nil
end
end
if not ihb_flag then
local c
if Np.id == id_math then c = -1 else c = 'jcharbdd' end
- return new_jfm_glue(Nq, Nq.class, find_char_class(c,Nq.met))
+ return new_jfm_glue(Nq, Nq.class, fast_find_char_class(c,Nq.met))
else return nil
end
end
else
-- the current list is the contents of a hbox
if Np.id == id_jglyph or (Np.id==id_pbox and Np.met) then
- local g = new_jfm_glue(Np, Np.class, find_char_class('boxbdd',Np.met))
+ local g = new_jfm_glue(Np, Np.class, fast_find_char_class('boxbdd',Np.met))
if g then
set_attr(g, attr_icflag, BOXBDD)
head = node_insert_after(head, Np.last, g)
if not ihb_flag then
local g
if par_indented then
- g = new_jfm_glue(Np, find_char_class('parbdd',Np.met), Np.class)
+ g = new_jfm_glue(Np, fast_find_char_class('parbdd',Np.met), Np.class)
else
- g = new_jfm_glue(Np, find_char_class('boxbdd',Np.met), Np.class)
+ g = new_jfm_glue(Np, fast_find_char_class('boxbdd',Np.met), Np.class)
end
if g then
set_attr(g, attr_icflag, BOXBDD)
last=node.tail(head)
else
-- the current list is the contents of a hbox:
- -- insert a sentinel
+ -- insert a sentinelEG
last=node.tail(head); local g = node_new(id_kern)
node_insert_after(head, last, g); last = g
end
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_find_char_class = ltjf.find_char_class
+-- table of mathematical characters
+is_math_letters = {}
+
local conv_jchar_to_hbox_A
-- sty : 0 (display or text), 1 (script), >=2 (scriptscript)
p.sub = conv_jchar_to_hbox_A(p.sub, sty + 1)
p.sup = conv_jchar_to_hbox_A(p.sup, sty + 1)
elseif p.id == id_choice then
+ p.display = conv_jchar_to_hbox(p.display, 0)
p.text = conv_jchar_to_hbox(p.text, 0)
p.script = conv_jchar_to_hbox(p.script, 1)
p.scriptscript = conv_jchar_to_hbox(p.scriptscript, 2)
end
elseif p.id == id_mchar then
local fam = has_attr(p, attr_jfam) or -1
- if ltjc.is_ucs_in_japanese_char(p) and fam>=0 then
+ if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then
local mode = 'mjss'
if sty == 0 then mode = 'mjtext'
elseif sty == 1 then mode = 'mjscr'
local head = conv_jchar_to_hbox(n, 0);
head = node.mlist_to_hlist(head, display_type, penalties)
return head
- end,'ltj.mlist_to_hlist', 1)
\ No newline at end of file
+ end,'ltj.mlist_to_hlist', 1)
local has_attr = node.has_attribute
local set_attr = node.set_attribute
local unset_attr = node.unset_attribute
+local node_type = node.type
local node_remove = node.remove
local node_next = node.next
local node_free = node.free
local id_glyph = node.id('glyph')
+local id_math = node.id('math')
local id_whatsit = node.id('whatsit')
local sid_user = node.subtype('user_defined')
-local attr_jchar_class = luatexbase.attributes['ltj@charclass']
local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
local attr_icflag = luatexbase.attributes['ltj@icflag']
local attr_yablshift = luatexbase.attributes['ltj@yablshift']
local attr_ykblshift = luatexbase.attributes['ltj@ykblshift']
local ltjf_font_metric_table = ltjf.font_metric_table
-local ltjf_find_char_class = ltjf.find_char_class
------------------------------------------------------------------------
-- MAIN PROCESS STEP 1: replace fonts
-- This is used in jfmglue.lua.
local function suppress_hyphenate_ja(head)
- for p in node.traverse_id(id_glyph, head) do
- local i = has_attr(p, attr_icflag) or 0
- if i==0 and ltjc.is_ucs_in_japanese_char(p) then
- local v = has_attr(p, attr_curjfnt)
- if v then
- p.font = v
- set_attr(p, attr_jchar_class,
- ltjf_find_char_class(p.char, ltjf_font_metric_table[v]))
+ local non_math = true
+ for p in node.traverse(head) do
+ if p.id == id_glyph and non_math then
+ local i = has_attr(p, attr_icflag) or 0
+ if i==0 and ltjc.is_ucs_in_japanese_char(p) then
+ local v = has_attr(p, attr_curjfnt)
+ if v then
+ p.font = v
+ end
+ v = has_attr(p, attr_ykblshift)
+ if v then
+ set_attr(p, attr_yablshift, v)
+ else
+ unset_attr(p, attr_yablshift)
+ end
+ if p.subtype%2==1 then p.subtype = p.subtype - 1 end
+ -- p.lang=lang_ja
end
- v = has_attr(p, attr_ykblshift)
- if v then
- set_attr(p, attr_yablshift, v)
- else
- unset_attr(p, attr_yablshift)
- end
- if p.subtype%2==1 then p.subtype = p.subtype - 1 end
- -- p.lang=lang_ja
+ elseif p.id == id_math then
+ non_math = (p.subtype ~= 0)
end
end
lang.hyphenate(head)
while p do
if p.id==id_glyph then
if is_japanese_glyph_node(p) then
- local met = ltjf.font_metric_table[p.font]
+ local met = ltjf_font_metric_table[p.font]
local class = has_attr(p, attr_jchar_class)
char_data = ltjf.metrics[met.jfm].size_cache[met.size].char_type[class]
- p = capsule_glyph(p, dir, false, met, class)
+ if char_data then
+ p = capsule_glyph(p, dir, false, met, class)
+ else
+ p = node_next(p)
+ end
else
p.yoffset = p.yoffset - (has_attr(p,attr_yablshift) or 0); p = node_next(p)
end
local charprop_stack_table={}; charprop_stack_table[0]={}
+-- modified from table.fastcopy
+local next = next
+local function stack_table_copy_aux(old)
+ local new = {}
+ for i,v in next, old do
+ new[i] = v
+ end
+ return new
+end
+local function stack_table_copy(old)
+ if old then
+ local new = {}
+ for i,v in next, old do
+ new[i] = stack_table_copy_aux(v)
+ end
+ return new
+ else
+ return {}
+ end
+end
+
function get_stack_level()
local i = tex.getcount('ltj@@stack')
local j = tex.currentgrouplevel
for k,v in pairs(charprop_stack_table) do -- clear the stack above i
if k>=i then charprop_stack_table[k]=nil end
end
- charprop_stack_table[i] = table.fastcopy(charprop_stack_table[i-1])
+ charprop_stack_table[i] = stack_table_copy(charprop_stack_table[i-1])
tex.setcount('ltj@@stack', i)
if gd>0 then tex.globaldefs = gd end
if tex.nest[tex.nest.ptr].mode == hmode or
return i
end
+-- local function table_to_str(v)
+-- local s = ''
+-- for i, a in pairs(v) do
+-- s = s .. i .. "=" .. tostring(a) .. ', '
+-- end
+-- return s
+-- end
+-- function print_stack_table(i)
+-- print('\n>>> get_stack_level:')
+-- for k, v in pairs(charprop_stack_table[i]) do
+-- print(" " , k, type(k), table_to_str(v));
+-- end
+-- end
+
+
-- EXT
function set_stack_table(g,m,c,p,lb,ub)
local i = get_stack_level()
"(-1 is used for denoting `math boundary')",
'So I changed this one to zero.'})
c=0
- elseif not charprop_stack_table[i][c] then
- charprop_stack_table[i][c] = {}
+ elseif not charprop_stack_table[i][m] then
+ charprop_stack_table[i][m] = {}
end
- charprop_stack_table[i][c][m] = p
+ charprop_stack_table[i][m][c] = p
if g=='global' then
for j,v in pairs(charprop_stack_table) do
- if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end
- charprop_stack_table[j][c][m] = p
+ if not charprop_stack_table[j][m] then charprop_stack_table[j][m] = {} end
+ charprop_stack_table[j][m][c] = p
end
end
end
{"The family number should in the range 0 .. 255.",
"I'm going to use 0 instead of that illegal family number."})
c=0
- elseif not charprop_stack_table[i][c] then
- charprop_stack_table[i][c] = {}
+ elseif not charprop_stack_table[i][m] then
+ charprop_stack_table[i][m] = {}
end
- charprop_stack_table[i][c][m] = p
+ charprop_stack_table[i][m][c] = p
if g=='global' then
for j,v in pairs(charprop_stack_table) do
- if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end
- charprop_stack_table[j][c][m] = p
+ if not charprop_stack_table[j][m] then charprop_stack_table[j][m] = {} end
+ charprop_stack_table[j][m][c] = p
end
end
end
-- EXT: store \ltj@tempskipa
-function set_stack_skip(g,c,sp)
+function set_stack_skip(g,m,sp)
local i = get_stack_level()
if not sp then return end
- if not charprop_stack_table[i][c] then
- charprop_stack_table[i][c] = {}
+ if not charprop_stack_table[i][m] then
+ charprop_stack_table[i][m] = {}
end
- charprop_stack_table[i][c].width = sp.width
- charprop_stack_table[i][c].stretch = sp.stretch
- charprop_stack_table[i][c].shrink = sp.shrink
- charprop_stack_table[i][c].stretch_order = sp.stretch_order
- charprop_stack_table[i][c].shrink_order = sp.shrink_order
+ charprop_stack_table[i][m].width = sp.width
+ charprop_stack_table[i][m].stretch = sp.stretch
+ charprop_stack_table[i][m].shrink = sp.shrink
+ charprop_stack_table[i][m].stretch_order = sp.stretch_order
+ charprop_stack_table[i][m].shrink_order = sp.shrink_order
if g=='global' then
for j,v in pairs(charprop_stack_table) do
- if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end
- charprop_stack_table[j][c].width = sp.width
- charprop_stack_table[j][c].stretch = sp.stretch
- charprop_stack_table[j][c].shrink = sp.shrink
- charprop_stack_table[j][c].stretch_order = sp.stretch_order
- charprop_stack_table[j][c].shrink_order = sp.shrink_order
+ if not charprop_stack_table[j][m] then charprop_stack_table[j][m] = {} end
+ charprop_stack_table[j][m].width = sp.width
+ charprop_stack_table[j][m].stretch = sp.stretch
+ charprop_stack_table[j][m].shrink = sp.shrink
+ charprop_stack_table[j][m].stretch_order = sp.stretch_order
+ charprop_stack_table[j][m].shrink_order = sp.shrink_order
end
end
end
end
function get_penalty_table(m,c,d, idx)
- local i = charprop_stack_table[idx][c]
- if i then i=i[m] end
+ local i = charprop_stack_table[idx][m]
+ if i then i=i[c] end
return i or d
end
-%%
-%% lltjcore.sty: derived from plcore.dtx in pLaTeX.
-%% This file does not include the code relating to "tategaki".
-%%
+%
+% lltjcore.sty: derived from plcore.dtx in pLaTeX.
+% This file does not include the code relating to "tategaki".
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjcore}[2011/11/22 Patch to LaTeX2e Kernel for LuaLaTeX-ja]
+
\makeatletter
\newif\iftombow \tombowfalse
\newif\iftombowdate \tombowdatetrue
+%
+% lltjdefs.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjdefs}[2011/11/22 Default font settings for LuaLaTeX-ja]
+
\DeclareKanjiEncodingDefaults{}{}
\DeclareErrorKanjiFont{JY3}{mc}{m}{n}{10}
\DeclareYokoKanjiEncoding{JY3}{}{}
\ltjdefcharrange{8}{"A7, "A8, "B0, "B1, "B4, "B6, "D7, "F7}
\ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, +8}}
+\directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end}
+
% END OF FILE
\endinput
-%%
-%% lltjfont.sty: derived from plfonts.dtx in pLaTeX.
-%%
-\makeatletter
+%
+% lltjfont.sty: derived from plfonts.dtx in pLaTeX.
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjfont}[2011/11/22 Patch to NFSS2 for LuaLaTeX-ja]
+
\let\k@encoding\@empty
\let\ck@encoding\@empty
% LuaTeX-ja uses JY3 and JT3 encodings.
-% lltjlisting.sty: modified from jlisting.sty (by Thor) for
-% LuaTeX-ja.
+%
+% lltjp-listings.sty
+%
+% Modified from jlisting.sty (by Thor) for LuaTeX-ja.
+%
\NeedsTeXFormat{LaTeX2e}
\def\filedate{2006/02/20}
\def\fileversion{0.2}
-\ProvidesPackage{lltjlisting}[\filedate\space\fileversion\space(Thor)]
-%
+\ProvidesPackage{lltjp-listings}[\filedate\space\fileversion\space(Thor)]
+\RequirePackage{listings}
\newcount\lst@nextchar
\let\lst@@ProcessSpace\lst@ProcessSpace
\def\lst@ProcessSpace#1{%
--- /dev/null
+%
+% lltjp-unicode-math.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjp-unicode-math}[2011/11/22 Patch to unicode-math for LuaLaTeX-ja]
+
+\RequirePackage{unicode-math,luatexja}
+
+\ExplSyntaxOn
+
+%%%%%% 以下の3命令の再定義はもはや不要と思われる(北川)
+% \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:
+% \ltjsetmathletter{\int_eval:n {#4}}
+% }
+% \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:
+% \ltjsetmathletter{\int_eval:n {#1}}
+% }
+% \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:
+% \ltjsetmathletter{\int_eval:n {#4}}
+% }
+%%%%%%
+\group_begin:
+ \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil {%"
+ \group_begin:
+ %\typeout {um: \string#1, \int_from_hexadecimal:n {#2}} <- for debug
+ \char_set_lccode:nn { `! } { "#2 }
+ \tex_lowercase:D {
+ \tl_set:Nn \l_tmpa_tl {\ifmmode!\else{\directlua{tex.globaldefs = 0}\ltj@allalchar!}\fi}
+ \cs_gset_eq:NN #1 \l_tmpa_tl
+ }
+ \ltjsetmathletter{ \int_from_hexadecimal:n {#2} }
+ \group_end:
+ }
+\group_end:
+
+\ExplSyntaxOff
+\endinput
--- /dev/null
+%
+% lltjp-xunicode.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjp-xunicode}[2011/11/22 Patch to xunicode for LuaLaTeX-ja]
+
+\def\UTFencname{EU2}\def\XeTeXpicfile{}
+\RequirePackage{xunicode,luatexja}
+{\catcode`\"=12
+\gdef\check@hexcom@digits@#1#2#3#4#5@!@#6#7#8{%
+ \ifx @#4\relax
+ \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8}%
+ \else
+ \ifcat \active\noexpand#8%
+ \ifx\add@flag\@ne %
+ \expandafter\def\csname\UTFencname\string#8\endcsname{\ltjalchar"#1#2#3#4\relax}%
+ \ifx\unDeFiNed@#8%
+ \ifx\cf@encoding\UTFencname
+ \DeclareTextCommand{#8}{OT1}{\undefined}%
+ \else
+ \DeclareTextCommand{#8}{\cf@encoding}{\undefined}%
+ \fi
+ \else {% macro #8 exists already ...
+ \let\protect\noexpand
+ \edef\UTF@testi{#8}\def\UTF@testii{#8}%
+ \ifx\UTF@testi\UTF@testii\aftergroup\UTF@ignore
+ \else\aftergroup\UTF@doit\fi
+ }%
+ \iffalse
+ % ... but when it isn't robust, make it so
+ \expandafter\let\csname?-\string#8\endcsname#8\relax
+ \edef\next@UTF@{{\cf@encoding}%
+ {\expandafter\noexpand\csname?-\string#8\endcsname}}%
+ \expandafter\DeclareTextCommand\expandafter
+ {\expandafter#8\expandafter}\next@UTF@
+ \fi
+ \fi %
+ \else % \add@flag \z@
+ \expandafter\global\expandafter
+ \let\csname\UTFencname\string#8\endcsname\relax
+ \fi % end of \add@flag switch
+ \else % not active catcode --- shouldn't happen
+ % \typeout{*** did you really mean #8 ? ***}%
+ \ifx\add@flag\@ne %
+ \edef\tmp@name{\expandafter\string\csname\UTFencname\endcsname
+ \expandafter\string\csname#8\endcsname}%
+ \expandafter\def\csname\tmp@name\endcsname{\ltjalchar"#1#2#3#4\relax}%
+ \ifx\cf@encoding\UTFencname
+ \expandafter\DeclareTextCommand\expandafter
+ {\csname#8\endcsname}{OT1}{\undefined}%
+ \else
+ \expandafter\DeclareTextCommand\expandafter
+ {\csname#8\endcsname}{\cf@encoding}{\undefined}%
+ \fi
+ \else % \add@flag \z@
+ \expandafter\global\expandafter\let\csname#8\endcsname\relax
+ \fi % end of \add@flag switch
+ \fi % end of \ifcat
+ \fi}
+\gdef\check@hex@digits@#1#2#3#4#5@!@#6#7#8#9{%
+ \ifx @#4\relax
+ \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8#9}%
+ \else
+ \def\UTFchar{\ltjalchar"#1#2#3#4\relax}%
+ \expandafter\expandafter\expandafter\declare@utf@composite
+ \expandafter\expandafter\expandafter
+ {\expandafter\csname#6\endcsname}{\UTFchar}{#8}{#9}\relax
+ \fi}
+\gdef\add@UTF@accent#1#2#3{\ifx\relax#2\relax\ltjalchar"#3\else
+ \ifx\ #2\relax\ltjalchar"#3\else
+ \expandafter\ifx\UTF@space#2\relax\ltjalchar"#3\else
+ \ifx~#2\ltjalchar"#3\else#2\ltjalchar"#1\fi\fi\fi\fi\relax}
+\gdef\add@UTF@accents#1#2#3{#2\ltjalchar"#1\ltjalchar"#3\relax}
+}
+% If unicode-math is already loaded, the following error occurs:
+% ! Undefined control sequence.
+% \hbar ->\hslash
+% Therefore temporarily set \hbar=\relax.
+\let\ltj@tmpa\hbar
+\let\hbar\relax
+\ReloadXunicode{EU2}
+\makeatletter
+\let\hbar\ltj@tmpa
+\endinput
+
+%% the following patch is needed to xunicode.sty:
+%%
+--- /opt/texlive/2011/texmf-dist/tex/xelatex/xunicode/xunicode.sty 2011-09-12 08:31:47.000000000 +0900
++++ xunicode.sty 2011-11-16 22:06:17.061413113 +0900
+@@ -1475,7 +1475,11 @@
+
+ \newtoks\tipasavetokens
+ \newtoks\tipachecktokens
++
++\fi
+ \newif\iftipaonetoken
++\expandafter\ifx\csname ReloadXunicode\endcsname\relax
++
+ \def\tipalasttoken{!@! do nothing with this !@!}
+ \def\tipacatchonechar#1{\begingroup
+ \def\textipa##1{##1}% prevent recursion
{\tentt jp78} feature: 辻→{\jisse 辻}
{\tentt hwid} feature: アイウエ→{\jishwid アイウエ}\hfil\break
-↑文字クラスが変わらないので幅も変わらない.
{\tentt nalt} feature: 男→{\jisnalt 男}
{\tentt trad} feature: 医学→{\jistrad 医学}
{\tentt sups} feature: 注1注1→{\jissups 注1注1}\hfil\break
-↑文字クラスが変わらないので幅も変わらない.
+↑まだ上付き文字用の文字クラスを作ってない.
{\tentt liga} feature: か゚き゚く゚け゚こ゚→{\jisliga か゚き゚く゚け゚こ゚}\hfil\break
↑合字用の半濁点({\tentt U+309A})を用いれば成功する.単体用({\tentt U+309C})では失敗する.%比較:{\tmiliga か゜き゜く゜け゜こ゜}
{\tentt jp04} feature: 辻→{\jisfour 辻}
{\tentt hwid} feature: アイウエ→{\jishwid アイウエ}\hfil\break
-↑文字クラスが変わらないので幅も変わらない.
{\tentt nalt} feature: 男→{\jisnalt 男}
{\tentt trad} feature: 医学→{\jistrad 医学}
{\tentt sups} feature: 注1注1→{\jissups 注1注1}\hfil\break
-↑文字クラスが変わらないので幅も変わらない.
+↑まだ上付き文字用の文字クラスを作ってない.
{\tentt liga} feature: か゚き゚く゚け゚こ゚→{\jisliga か゚き゚く゚け゚こ゚}\hfil\break
↑合字用の半濁点({\tentt U+309A})を用いれば成功する.単体用({\tentt U+309C})では失敗する.%比較:{\tmiliga か゜き゜く゜け゜こ゜}
--- /dev/null
+%#!lualatex
+\documentclass{article}
+\usepackage[a4paper]{geometry}
+
+\usepackage{luatexja-fontspec}
+
+\usepackage{luatexja}
+\makeatletter\ltj@alljachar %←全部の(>=U+0080な)文字を和文文字扱いに!
+
+\usepackage{unicode-math}
+\setmathfont{XITSMath}
+\setmainjfont{IPAGothic}
+
+\begin{document}\makeatletter
+
+\[
+ \frac1{1^2}+\frac1{2^2}+\cdots=
+\sum_{n=1}^\infty \frac1{n^s}=\zeta(2)=\frac{\pi^2}{6}
+=\frac16\cdot \pi\times\pi,\qquad a_1,\dots,a_n.
+\]
+
+$
+ \frac1{1^2}+\frac1{2^2}+\cdots=
+\sum_{n=1}^\infty \frac1{n^s\zeta}=\zeta(2)=\frac{\pi^2}{6}
+=\frac16\cdot \pi\times\pi,\qquad a_1,\dots,a_n. \hbar
+$
+
+{\tt\meaning\sum}
+
+
+○×○漢\ltjjachar`\×漢\ltjalchar`\×漢\times 漢
+え\ltjjachar`\“え\ltjalchar`\“え\textquotedblleft え“え
+←数式外では和文文字扱いのままになっている.
+\end{document}
\LaTeX では数式ファミリ番号は欧文と共用→$\the\jfam$
+\def\s{\mathchoice{Dあ}{Tあ}{Sあ}{SSあ}}
+\[
+\s {\textstyle \s} {\scriptstyle \s} {\scriptscriptstyle \s}
+\]
\end{document}
-