简短问题:
是否存在某种字体编码或其他技巧可以让²
LaTeX 正确解释 unicode 字符(指数 2),特别是在数学模式下(即将其自动转换为^{2}
)?
(对于 ³、⁴、... 也同样如此)
详细理由:
通常,要在数学模式下引入指数,可以使用 ^ 符号,如x^2
或e^{i\pi}
。我已经使用 LaTeX 几十年了,这感觉很自然。但是,使用我当前的设置,当我x
^
2
在键盘上输入字符时,结果会是两个 unicode 字符x²
。
\RequirePackage[utf8]{inputenc}
我的个人风格文件开头确实有一个,并且 Unicode 字符通常被正确解释(重音字符等)。
通常我会考虑这个问题并输入x
^
^
2
结果x^2
,但我经常输入得很快,然后不得不返回到产生错误的每行代码LaTeX Error: Command \texttwosuperior unavailable in en
。这很烦人。
我可以在编辑器级别实现一种解决方法(我使用 vim,因此添加一个映射将 ² 转换为 ^2 很简单),但我想知道是否有更好的独立于编辑器的方法来处理这个问题。
答案1
ConTeXt 做得对。
\starttext
x²³ and $x²³$
\stoptext
使用 LaTeX 和 可以实现同样的效果unicode-math
。
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
x²³ and $x²³$
\end{document}
在 pdfLaTeX 中,您必须使用newunicodechar
重新定义²
并³
使其具有数学模式感知。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % for \text...superior
\usepackage{newunicodechar}
\newunicodechar{²}{\ifmmode{}^2\else\texttwosuperior\fi}
\newunicodechar{³}{\ifmmode{}^3\else\textthreesuperior\fi}
\begin{document}
x²³ and $x²³$
\end{document}
答案2
笔记:这个答案大部分是多余的。你可以unicode-math
按照其他答案,如果不适用,请使用我的包unicode-math-input
。
以下是原始答案。
如果你想在不导入 Unicode-math 的情况下使用 XeTeX 或 LuaTeX 中的符号(因为它改变输出),可以复制部分 Unicode-math 源代码,并将其放在序言中。
基本思想是将字符定义为活动字符,当反复展开时(“扫描”字符向前,使用\__um_scan_sscript:
及其辅助功能)
- 偷看其右侧的字符(
\peek_N_type:TF
) - 检查它是否是另一个上标/下标字符 (
\prop_get:cxNTF
) - 如果是,将其推到某处(
\l__um_ss_chain_tl
)并重复。
请参阅 unicode-math 源代码文档中的“19. Unicode 子标和上标”部分(加拿大运输安全局) 以获得更详细的解释。
另一种方法是做类似下面的事情,其灵感来自于数学模式下宏的实现中的一个想法(例如参见附录 B 第 6 部分“数学宏”→ TeXbook 中的'
“一组有趣的转换f'''
为的宏”):f^{\prime\prime\prime}
- make
²
扩展为^{2\continuesuperscript}
, - 然后
²³
扩展为^{2\continuesuperscript}^{3\continuesuperscript}
, - 该
\continuesuperscript
宏使得 ^{2\continuesuperscript}^{3} 等同于^{23}
, - 此类宏的工作原理是:
- 吸收以下内容
}
, f
然后对以下标记进行无限扩展(为了根据³
需要扩展任何^{3...}
标记,请注意,在数学模式下可能丢失空格并不重要),- 然后检查以下字符是否是
^
,- 如果是,则删除
^
,和另一个参数#2
,并放回#2\egroup
(因此^{2\continuesuperscript}^{34}
变成^{234\egroup
),- 有趣的是,这样做
^{2\continuesuperscript}^\bgroup34\egroup
会^{2\bgroup\egroup34\egroup
变成#2
\bgroup
如预期,
- 有趣的是,这样做
- 否则,放回并执行
}
。
- 如果是,则删除
- 吸收以下内容
检查以下字符是否^
需要不可扩张在非LuaTeX引擎中的实现(使用\futurelet
)。
看https://gist.github.com/user202729/9b599cdaec827a0bdf6478fb5729b157 用于概念验证实施。(答案太长了,我无法将其包括在内)
PDFTeX 中也可以使用类似的算法,但需要进行一些调整,因为每个 Unicode 字符(UTF-8 编码)在 PDFTeX 中对应多个标记。(一直向下滚动到下方即可查看概念验证实现)
Unicode 引擎的演示:(回想起来,这是一个丑陋的实现,但我并不特别想重写它)
%! TEX program = xelatex
\documentclass{article}
\usepackage{amssymb}
\ExplSyntaxOn
\prop_new:N \g__um_supers_prop
\prop_new:N \g__um_subs_prop
\cs_generate_variant:Nn \prop_gput:Nnn {Nxn}
\cs_generate_variant:Nn \prop_get:NnNTF {cxNTF}
\cs_new:Nn \__um_char_gmake_mathactive:n
{
\tex_global:D \tex_mathcode:D \int_eval:n {#1} = "8000 \scan_stop:
}
\cs_new:Nn \__um_mathactive_remap:nn
{
\group_begin:
\cs_set_protected:Npn \__um_tmp: {#2}
\__um_char_gmake_mathactive:n {#1}
\char_gset_active_eq:nN {#1} \__um_tmp:
\group_end:
}
\cs_new:Nn \__um_setup_active_superscript:nn
{
\prop_gput:Nxn \g__um_supers_prop { \int_eval:n {#1} } {#2}
\__um_mathactive_remap:nn {#1}
{
\tl_set:Nn \l__um_ss_chain_tl {#2}
\cs_set_eq:NN \__um_sub_or_super:n \sp
\tl_set:Nn \l__um_tmpa_tl {supers}
\__um_scan_sscript:
}
}
\cs_new:Nn \__um_setup_active_subscript:nn
{
\prop_gput:Nxn \g__um_subs_prop { \int_eval:n {#1} } {#2}
\__um_mathactive_remap:nn {#1}
{
\tl_set:Nn \l__um_ss_chain_tl {#2}
\cs_set_eq:NN \__um_sub_or_super:n \sb
\tl_set:Nn \l__um_tmpa_tl {subs}
\__um_scan_sscript:
}
}
\cs_new_protected:Nn \__um_scan_sscript:
{
\__um_scan_sscript:TF
{ \__um_scan_sscript: }
{ \__um_sub_or_super:n {\l__um_ss_chain_tl} }
}
\cs_new_protected:Nn \__um_scan_sscript:TF
{
\peek_N_type:TF
{
\group_align_safe_begin:
\__um_scan_sscript_aux:nnN {#1} {#2}
}
{#2}
}
\cs_new_protected:Nn \__um_scan_sscript_aux:nnN
{
\tl_set:Nx \l__um_tmpa_key_tl { \tl_to_str:n {#3} }
\prop_get:cxNTF {g__um_\l__um_tmpa_tl _prop}
{ \int_eval:n { \exp_after:wN ` \l__um_tmpa_key_tl } }
\l__um_tmpb_tl
{
\tl_put_right:NV \l__um_ss_chain_tl \l__um_tmpb_tl
\group_align_safe_end:
#1
}
{ \group_align_safe_end: #2 #3 }
}
\__um_setup_active_superscript:nn {"2070} {0}
\__um_setup_active_superscript:nn {"00B9} {1}
\__um_setup_active_superscript:nn {"00B2} {2}
\__um_setup_active_superscript:nn {"00B3} {3}
\__um_setup_active_superscript:nn {"2074} {4}
\__um_setup_active_superscript:nn {"2075} {5}
\__um_setup_active_superscript:nn {"2076} {6}
\__um_setup_active_superscript:nn {"2077} {7}
\__um_setup_active_superscript:nn {"2078} {8}
\__um_setup_active_superscript:nn {"2079} {9}
\__um_setup_active_superscript:nn {"207A} {+}
\__um_setup_active_superscript:nn {"207B} {-}
\__um_setup_active_superscript:nn {"207C} {=}
\__um_setup_active_superscript:nn {"207D} {(}
\__um_setup_active_superscript:nn {"207E} {)}
\__um_setup_active_superscript:nn {"1D2C} {A}
\__um_setup_active_superscript:nn {"1D2E} {B}
\__um_setup_active_superscript:nn {"1D30} {D}
\__um_setup_active_superscript:nn {"1D31} {E}
\__um_setup_active_superscript:nn {"1D33} {G}
\__um_setup_active_superscript:nn {"1D34} {H}
\__um_setup_active_superscript:nn {"1D35} {I}
\__um_setup_active_superscript:nn {"1D36} {J}
\__um_setup_active_superscript:nn {"1D37} {K}
\__um_setup_active_superscript:nn {"1D38} {L}
\__um_setup_active_superscript:nn {"1D39} {M}
\__um_setup_active_superscript:nn {"1D3A} {N}
\__um_setup_active_superscript:nn {"1D3C} {O}
\__um_setup_active_superscript:nn {"1D3E} {P}
\__um_setup_active_superscript:nn {"1D3F} {R}
\__um_setup_active_superscript:nn {"1D40} {T}
\__um_setup_active_superscript:nn {"1D41} {U}
\__um_setup_active_superscript:nn {"2C7D} {V}
\__um_setup_active_superscript:nn {"1D42} {W}
\__um_setup_active_superscript:nn {"1D43} {a}
\__um_setup_active_superscript:nn {"1D47} {b}
\__um_setup_active_superscript:nn {"1D9C} {c}
\__um_setup_active_superscript:nn {"1D48} {d}
\__um_setup_active_superscript:nn {"1D49} {e}
\__um_setup_active_superscript:nn {"1DA0} {f}
\__um_setup_active_superscript:nn {"1D4D} {g}
\__um_setup_active_superscript:nn {"02B0} {h}
\__um_setup_active_superscript:nn {"2071} {i}
\__um_setup_active_superscript:nn {"02B2} {j}
\__um_setup_active_superscript:nn {"1D4F} {k}
\__um_setup_active_superscript:nn {"02E1} {l}
\__um_setup_active_superscript:nn {"1D50} {m}
\__um_setup_active_superscript:nn {"207F} {n}
\__um_setup_active_superscript:nn {"1D52} {o}
\__um_setup_active_superscript:nn {"1D56} {p}
\__um_setup_active_superscript:nn {"02B3} {r}
\__um_setup_active_superscript:nn {"02E2} {s}
\__um_setup_active_superscript:nn {"1D57} {t}
\__um_setup_active_superscript:nn {"1D58} {u}
\__um_setup_active_superscript:nn {"1D5B} {v}
\__um_setup_active_superscript:nn {"02B7} {w}
\__um_setup_active_superscript:nn {"02E3} {x}
\__um_setup_active_superscript:nn {"02B8} {y}
\__um_setup_active_superscript:nn {"1DBB} {z}
\__um_setup_active_superscript:nn {"1D5D} {\beta}
\__um_setup_active_superscript:nn {"1D5E} {\gamma}
\__um_setup_active_superscript:nn {"1D5F} {\delta}
\__um_setup_active_superscript:nn {"1D60} {\phi}
\__um_setup_active_superscript:nn {"1D61} {\chi}
\__um_setup_active_superscript:nn {"1DBF} {\theta}
\__um_setup_active_subscript:nn {"2080} {0}
\__um_setup_active_subscript:nn {"2081} {1}
\__um_setup_active_subscript:nn {"2082} {2}
\__um_setup_active_subscript:nn {"2083} {3}
\__um_setup_active_subscript:nn {"2084} {4}
\__um_setup_active_subscript:nn {"2085} {5}
\__um_setup_active_subscript:nn {"2086} {6}
\__um_setup_active_subscript:nn {"2087} {7}
\__um_setup_active_subscript:nn {"2088} {8}
\__um_setup_active_subscript:nn {"2089} {9}
\__um_setup_active_subscript:nn {"208A} {+}
\__um_setup_active_subscript:nn {"208B} {-}
\__um_setup_active_subscript:nn {"208C} {=}
\__um_setup_active_subscript:nn {"208D} {(}
\__um_setup_active_subscript:nn {"208E} {)}
\__um_setup_active_subscript:nn {"2090} {a}
\__um_setup_active_subscript:nn {"2091} {e}
\__um_setup_active_subscript:nn {"2095} {h}
\__um_setup_active_subscript:nn {"1D62} {i}
\__um_setup_active_subscript:nn {"2C7C} {j}
\__um_setup_active_subscript:nn {"2096} {k}
\__um_setup_active_subscript:nn {"2097} {l}
\__um_setup_active_subscript:nn {"2098} {m}
\__um_setup_active_subscript:nn {"2099} {n}
\__um_setup_active_subscript:nn {"2092} {o}
\__um_setup_active_subscript:nn {"209A} {p}
\__um_setup_active_subscript:nn {"1D63} {r}
\__um_setup_active_subscript:nn {"209B} {s}
\__um_setup_active_subscript:nn {"209C} {t}
\__um_setup_active_subscript:nn {"1D64} {u}
\__um_setup_active_subscript:nn {"1D65} {v}
\__um_setup_active_subscript:nn {"2093} {x}
\__um_setup_active_subscript:nn {"1D66} {\beta}
\__um_setup_active_subscript:nn {"1D67} {\gamma}
\__um_setup_active_subscript:nn {"1D68} {\rho}
\__um_setup_active_subscript:nn {"1D69} {\phi}
\__um_setup_active_subscript:nn {"1D6A} {\chi}
\ExplSyntaxOff
\begin{document}
$x²³₄₅ + \mathbb{R} + \varnothing$
\end{document}
输出:
如你所见,ℝ 和 ∅ 不受影响。(这是可能的,但要恢复旧符号很复杂,请参阅1 2。另外unicode-math编译起来比较慢)
(警告:该实现极其脆弱,可能会在下一个 UCS 版本中崩溃)
阅读评论以了解更多详细信息。
不建议使用。
这是标准(推荐)编码的版本utf8
。
%! TEX program = pdflatex
% vim: ts=2 sw=2 et:
\documentclass[12pt]{article}
%\usepackage[mathletters]{ucs}
%\usepackage[utf8x]{inputenc}
\usepackage[utf8]{inputenc}
\ExplSyntaxOn
% (originally) key: int value (Unicode code point), value: the corresponding (non-sscript) character
% (modified) key: sequence of UTF8,
% value: either \__um_partial:n or \__um_complete {non-sscript character}
\prop_new:N \g__um_supers_prop
\prop_new:N \g__um_subs_prop
\cs_generate_variant:Nn \prop_gput:Nnn {Nxn}
\cs_generate_variant:Nn \prop_get:NnNTF {cxNTF}
\cs_generate_variant:Nn \exp_args:Nx {c}
\cs_new:Nn \__um_mathactive_remap:nn
{
\group_begin:
% for [utf8]
\exp_args:Nx \DeclareUnicodeCharacter {\tl_tail:n {#1}} {#2}
% for [utf8x] (require decimal, briefly mentioned in https://github.com/latex3/latex2e/issues/24)
%\exp_args:Nx \DeclareUnicodeCharacter {\int_eval:n {#1}} {#2}
% for [utf8x] with clash (see https://tex.stackexchange.com/a/620231/250119)
%\exp_args:cx {uc@dclc} {\int_eval:n {#1}} {mathletters} {#2}
\group_end:
}
\cs_generate_variant:Nn \int_step_inline:nn {xn}
% #1: property list
% #2: the code point as "AAAA
% #3: the non-sscript corresponding character
\cs_new:Nn \__um_put_prefixes:Nnn
{
\tl_set:Nx \l__um_utfviii_bytes {\char_to_utfviii_bytes:n {#2}}
% drop the trailing empty groups (nonexistent bytes)
\tl_set:Nx \l__um_last_byte {\tl_item:Nn \l__um_utfviii_bytes {-1}}
\bool_while_do:nn {
\tl_if_empty_p:N \l__um_last_byte
} {
\tl_set:Nx \l__um_utfviii_bytes {\tl_range:Nnn \l__um_utfviii_bytes {1} {-2}}
\tl_set:Nx \l__um_last_byte {\tl_item:Nn \l__um_utfviii_bytes {-1}}
}
\cs_set:Nn \__um_char_generate_as_other:n {
\char_generate:nn {##1} {12} % 12: other, same as output of \tl_to_str:n
}
% convert hex to bytes
\tl_set:Nx \l__um_utfviii_bytes {
\tl_map_function:NN \l__um_utfviii_bytes \__um_char_generate_as_other:n
}
% iterate through incomplete prefixes and define
\int_step_inline:xn {\tl_count:N \l__um_utfviii_bytes - 1}
{
\prop_gput:Nxn #1 { \tl_range:Nnn \l__um_utfviii_bytes {1} {##1} } {\__um_partial:nnnn}
}
% define for the only complete prefix
\prop_gput:Nxn #1 \l__um_utfviii_bytes {\__um_complete:nnnnn {#3}}
}
\cs_new:Nn \__um_setup_active_superscript:nn
{
\__um_put_prefixes:Nnn \g__um_supers_prop {#1} {#2}
\__um_mathactive_remap:nn {#1}
{
\tl_set:Nn \l__um_ss_chain_tl {#2}
\cs_set_eq:NN \__um_sub_or_super:n \sp
\tl_set:Nn \l__um_tmpa_tl {supers}
\__um_scan_sscript:
}
}
\cs_new:Nn \__um_setup_active_subscript:nn
{
\__um_put_prefixes:Nnn \g__um_subs_prop {#1} {#2}
\__um_mathactive_remap:nn {#1}
{
\tl_set:Nn \l__um_ss_chain_tl {#2}
\cs_set_eq:NN \__um_sub_or_super:n \sb
\tl_set:Nn \l__um_tmpa_tl {subs}
\__um_scan_sscript:
}
}
\cs_new_protected:Nn \__um_scan_sscript:
{
\__um_scan_sscript:nnn
{ \__um_scan_sscript: } % true (got a new character), keep scanning
{ \__um_sub_or_super:n {\l__um_ss_chain_tl} } % "typesets what it has collected"
{}
}
% #1, #2, #3: same as below
\cs_new_protected:Nn \__um_scan_sscript:nnn
{
\peek_N_type:TF
{
\group_align_safe_begin:
\__um_scan_sscript_aux:nnnN {#1} {#2} {#3}
}
{
#2 % execute false code
#3 % return the partial token
}
}
%\cs_generate_variant:Nn \__um_scan_sscript:nnn {nnx}
% #1: true code (if the new token continues the chain, then \tl_put_right:NV it to the chain and execute this)
% #2: false code
% #3: the partial token (must **not** be stringified, in case it's returned later)
% #4: the new token (also not stringified)
\cs_new_protected:Nn \__um_scan_sscript_aux:nnnN
{
\tl_set:Nx \l__um_tmpa_key_tl { \tl_to_str:n {#4} }
\prop_get:cxNTF {g__um_\l__um_tmpa_tl _prop}
%{ \int_eval:n { \exp_after:wN ` \l__um_tmpa_key_tl } }
{ \tl_to_str:n {#3} \l__um_tmpa_key_tl }
\l__um_tmpb_tl
{
% if there is, do something depends on the result
\group_align_safe_end:
\l__um_tmpb_tl {#1} {#2} {#3} {#4}
}
{ \group_align_safe_end: #2 #3 #4 } % execute the false code, then return the non-matching part back
}
% #1: corresponding non-sscript character
% rest: as above
\cs_new:Nn \__um_complete:nnnnn
{
\tl_put_right:Nn \l__um_ss_chain_tl #1
#2
}
% 1-4: as __um_scan_sscript_aux:nnnN
\cs_new:Nn \__um_partial:nnnn
{
\__um_scan_sscript:nnn {#1} {#2} {#3 #4}
}
\__um_setup_active_superscript:nn {"2070} {0}
\__um_setup_active_superscript:nn {"00B9} {1}
\__um_setup_active_superscript:nn {"00B2} {2}
\__um_setup_active_superscript:nn {"00B3} {3}
\__um_setup_active_superscript:nn {"2074} {4}
\__um_setup_active_superscript:nn {"2075} {5}
\__um_setup_active_superscript:nn {"2076} {6}
\__um_setup_active_superscript:nn {"2077} {7}
\__um_setup_active_superscript:nn {"2078} {8}
\__um_setup_active_superscript:nn {"2079} {9}
\__um_setup_active_superscript:nn {"207A} {+}
\__um_setup_active_superscript:nn {"207B} {-}
\__um_setup_active_superscript:nn {"207C} {=}
\__um_setup_active_superscript:nn {"207D} {(}
\__um_setup_active_superscript:nn {"207E} {)}
\__um_setup_active_superscript:nn {"1D2C} {A}
\__um_setup_active_superscript:nn {"1D2E} {B}
\__um_setup_active_superscript:nn {"1D30} {D}
\__um_setup_active_superscript:nn {"1D31} {E}
\__um_setup_active_superscript:nn {"1D33} {G}
\__um_setup_active_superscript:nn {"1D34} {H}
\__um_setup_active_superscript:nn {"1D35} {I}
\__um_setup_active_superscript:nn {"1D36} {J}
\__um_setup_active_superscript:nn {"1D37} {K}
\__um_setup_active_superscript:nn {"1D38} {L}
\__um_setup_active_superscript:nn {"1D39} {M}
\__um_setup_active_superscript:nn {"1D3A} {N}
\__um_setup_active_superscript:nn {"1D3C} {O}
\__um_setup_active_superscript:nn {"1D3E} {P}
\__um_setup_active_superscript:nn {"1D3F} {R}
\__um_setup_active_superscript:nn {"1D40} {T}
\__um_setup_active_superscript:nn {"1D41} {U}
\__um_setup_active_superscript:nn {"2C7D} {V}
\__um_setup_active_superscript:nn {"1D42} {W}
\__um_setup_active_superscript:nn {"1D43} {a}
\__um_setup_active_superscript:nn {"1D47} {b}
\__um_setup_active_superscript:nn {"1D9C} {c}
\__um_setup_active_superscript:nn {"1D48} {d}
\__um_setup_active_superscript:nn {"1D49} {e}
\__um_setup_active_superscript:nn {"1DA0} {f}
\__um_setup_active_superscript:nn {"1D4D} {g}
\__um_setup_active_superscript:nn {"02B0} {h}
\__um_setup_active_superscript:nn {"2071} {i}
\__um_setup_active_superscript:nn {"02B2} {j}
\__um_setup_active_superscript:nn {"1D4F} {k}
\__um_setup_active_superscript:nn {"02E1} {l}
\__um_setup_active_superscript:nn {"1D50} {m}
\__um_setup_active_superscript:nn {"207F} {n}
\__um_setup_active_superscript:nn {"1D52} {o}
\__um_setup_active_superscript:nn {"1D56} {p}
\__um_setup_active_superscript:nn {"02B3} {r}
\__um_setup_active_superscript:nn {"02E2} {s}
\__um_setup_active_superscript:nn {"1D57} {t}
\__um_setup_active_superscript:nn {"1D58} {u}
\__um_setup_active_superscript:nn {"1D5B} {v}
\__um_setup_active_superscript:nn {"02B7} {w}
\__um_setup_active_superscript:nn {"02E3} {x}
\__um_setup_active_superscript:nn {"02B8} {y}
\__um_setup_active_superscript:nn {"1DBB} {z}
\__um_setup_active_superscript:nn {"1D5D} {\beta}
\__um_setup_active_superscript:nn {"1D5E} {\gamma}
\__um_setup_active_superscript:nn {"1D5F} {\delta}
\__um_setup_active_superscript:nn {"1D60} {\phi}
\__um_setup_active_superscript:nn {"1D61} {\chi}
\__um_setup_active_superscript:nn {"1DBF} {\theta}
\__um_setup_active_subscript:nn {"2080} {0}
\__um_setup_active_subscript:nn {"2081} {1}
\__um_setup_active_subscript:nn {"2082} {2}
\__um_setup_active_subscript:nn {"2083} {3}
\__um_setup_active_subscript:nn {"2084} {4}
\__um_setup_active_subscript:nn {"2085} {5}
\__um_setup_active_subscript:nn {"2086} {6}
\__um_setup_active_subscript:nn {"2087} {7}
\__um_setup_active_subscript:nn {"2088} {8}
\__um_setup_active_subscript:nn {"2089} {9}
\__um_setup_active_subscript:nn {"208A} {+}
\__um_setup_active_subscript:nn {"208B} {-}
\__um_setup_active_subscript:nn {"208C} {=}
\__um_setup_active_subscript:nn {"208D} {(}
\__um_setup_active_subscript:nn {"208E} {)}
\__um_setup_active_subscript:nn {"2090} {a}
\__um_setup_active_subscript:nn {"2091} {e}
\__um_setup_active_subscript:nn {"2095} {h}
\__um_setup_active_subscript:nn {"1D62} {i}
\__um_setup_active_subscript:nn {"2C7C} {j}
\__um_setup_active_subscript:nn {"2096} {k}
\__um_setup_active_subscript:nn {"2097} {l}
\__um_setup_active_subscript:nn {"2098} {m}
\__um_setup_active_subscript:nn {"2099} {n}
\__um_setup_active_subscript:nn {"2092} {o}
\__um_setup_active_subscript:nn {"209A} {p}
\__um_setup_active_subscript:nn {"1D63} {r}
\__um_setup_active_subscript:nn {"209B} {s}
\__um_setup_active_subscript:nn {"209C} {t}
\__um_setup_active_subscript:nn {"1D64} {u}
\__um_setup_active_subscript:nn {"1D65} {v}
\__um_setup_active_subscript:nn {"2093} {x}
\__um_setup_active_subscript:nn {"1D66} {\beta}
\__um_setup_active_subscript:nn {"1D67} {\gamma}
\__um_setup_active_subscript:nn {"1D68} {\rho}
\__um_setup_active_subscript:nn {"1D69} {\phi}
\__um_setup_active_subscript:nn {"1D6A} {\chi}
\ExplSyntaxOff
\begin{document}
\[ x²³₄₅ + \left( \frac{1}{2} \right) ⁶⁷₈₉ + \int ₁² x \, dx\]
\end{document}
这可能不是实现它的最佳方法,但我想不出更好的方法。