lualatex
这是一个使用 texlive-2013 编译成功的文件的简单示例:
\documentclass[11pt]{article}
\usepackage{fontspec}
\begin{document}
X\textsubscript{Y}
\end{document}
如果我尝试用lualatex
如果我尝试使用texlive-2014由 Debian 8“Jessie”打包,出现以下错误:
This is LuaTeX, Version beta-0.79.1 (TeX Live 2015/dev/Debian) (rev 4971)
restricted \write18 enabled.
(./test.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 13 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex
(/usr/share/texlive/texmf-dist/tex/latex/etex-pkg/etex.sty))
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3unicode-data.def)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/luatex.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
(/usr/share/texlive/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty)
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/modutils.lua))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty)
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/attr.lua))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/cctb.lua))
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty
(/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/mcb.lua)))
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-log.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-fontloader.lua)(
using write cache: /home/david/.texmf-var/luatex-cache/generic)(using read cache
: /var/lib/texmf/luatex-cache/generic /home/david/.texmf-var/luatex-cache/generi
c)
luaotfload | main : fontloader loaded in 0.030 seconds
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-override.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-parsers.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-configuration.lu
a)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-status.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-loaders.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua)
(/usr/share/texlive/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.lua)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-patches.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu2enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu2lmr.fd)(compiling luc: /var/li
b/texmf/luatex-cache/generic/fonts/otf/lmroman10-regular.luc)(load luc: /home/da
vid/.texmf-var/luatex-cache/generic/fonts/otf/lmroman10-regular.luc))
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texmf/tex/latex/tipa/t3enc.def(compiling luc: /var/lib/texmf/luatex-
cache/generic/fonts/otf/lmromanslant10-regular.luc)(load luc: /home/david/.texmf
-var/luatex-cache/generic/fonts/otf/lmromanslant10-regular.luc)(compiling luc: /
var/lib/texmf/luatex-cache/generic/fonts/otf/lmroman10-italic.luc)(load luc: /ho
me/david/.texmf-var/luatex-cache/generic/fonts/otf/lmroman10-italic.luc)(compili
ng luc: /var/lib/texmf/luatex-cache/generic/fonts/otf/lmroman10-bold.luc)(load l
uc: /home/david/.texmf-var/luatex-cache/generic/fonts/otf/lmroman10-bold.luc)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu2lmss.fd)(compiling luc: /var/l
ib/texmf/luatex-cache/generic/fonts/otf/lmsans10-regular.luc)(load luc: /home/da
vid/.texmf-var/luatex-cache/generic/fonts/otf/lmsans10-regular.luc))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texlive/texmf-dist/scripts/oberdiek/pdftexcmds.lua))))))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
No file test.aux.
(/usr/share/texmf/tex/latex/tipa/t3cmr.fd)
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! LaTeX Error: Command \textsubscript unavailable in encoding EU2.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.4 X\textsubscript
{Y}
? x
296 words of node memory still in use:
3 hlist, 1 rule, 1 kern, 1 glyph, 3 attribute, 41 glue_spec, 3 attribute_list
, 1 temp, 1 write, 1 local_par, 1 dir nodes
avail lists: 2:9,3:1,4:2,7:1,9:1
No pages of output.
Transcript written on test.log.
我确实找到了此相关 tex.stackexchange 线程,但我的解决方案并不适用于这里,因为我仅有的加载字体规范。
以下是我的问题:
这是一个错误,还是我做错了什么?
如果它是一个错误,是否值得在某个地方报告错误?如果是,在哪里?(Debian、texlive、luatex、latex 或上述的某个子集?)
有没有不太丑陋的方法来解决这个错误?假设出于各种原因,我确实需要使用这个特定版本的 lualatex/texlive(不幸的是,鉴于 Debian 的强硬政策,除非它们是安全漏洞,否则不会修复错误,这种情况将一直持续到下一个版本的 Debian 发布,大约一万亿年后)。我可以写一些东西让 \textsubscript “在 EU2 编码下可用”,如果它已经可以工作,就不会中断?
谢谢你的帮助!
澄清:这个问题已由下面的 David Carlisle 令人满意地回答。然而,我不明白它如何能被视为另一个问题:在我的最小示例中,\textsubscript
它适用luatex
于 texlive-2013,所以我的问题不是“如何生成下标?”而是“2013 年和 2014 年之间的行为如何/为什么发生变化?(这是一个错误吗?)”。此外,我强调我收到的错误消息(在标题中重现),不是“未定义的控制序列”(如果是,那么这个问题确实会重复)。事实上,我很想知道这个错误信息的解释:有人怎么会编码出一个特定的错误信息,说它\textsubscript
“不可用”(这是什么意思?意思是?)当修复几乎和错误消息本身一样短时——这似乎毫无意义。
答案1
在 2015/01/01 latex 版本中,它不是必需的,但对于 2014,最简单的定义方法\textsubscript
是
\RequirePackage{fixltx2e}
\documentclass[11pt]{article}
\usepackage{fontspec}
\begin{document}
X\textsubscript{Y}
\end{document}
旧版本已自动fontspec
包含fixltx2e
,但在某个时候已被删除,而在 Latex 2015 版本中则fixltx2e
根本不需要。
如果您不想要全部,fixltx2e
只需窃取一个定义:
\makeatletter
\DeclareRobustCommand*\textsubscript[1]{%
\@textsubscript{\selectfont#1}}
\def\@textsubscript#1{%
{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
\makeatother