etoc 因 tableofcontent 错误而暂停

etoc 因 tableofcontent 错误而暂停

\tableofcontents当我在加载了包的文档中使用宏时etoc,latex 会暂停并报告错误。如果我让编译继续,则会生成格式正确的 pdf。

可以在我的机器上重现错误的最小示例。

\listfiles
\documentclass{article}
\usepackage{etoc}

\begin{document}
\tableofcontents‎‎
\end{document}

来自 pdflatex 的最小示例的输出。

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./mwe.tex
LaTeX2e <2018-04-01> patch level 4
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/etoc/etoc.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/tools/multicol.sty)) (./mwe.aux)

! Package inputenc Error: Unicode character ‎ (U+200E)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.6 \tableofcontents‎
? R
OK, entering \nonstopmode...

! Package inputenc Error: Unicode character ‎ (U+200E)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.6 \tableofcontents‎‎

[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./mwe.aux)

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
    etoc.sty    2018/02/23 v1.08n Completely customisable TOCs (JFB)
multicol.sty    2018/04/20 v1.8s multicolumn formatting (FMi)
 ***********

 )
(see the transcript file for additional information)</usr/local/texlive/2018/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/local/texlive/2018/tex
mf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on mwe.pdf (1 page, 16281 bytes).
SyncTeX written on mwe.synctex.gz.
Transcript written on mwe.log.

答案1

您的命令后面有两个不可见的 unicode 字符(图片来自我的编辑器):

在此处输入图片描述

您可以赋予它们定义以使它们可见:

\documentclass{article}
%\usepackage{etoc}
\DeclareUnicodeCharacter{200E}{HALLO}
\begin{document}
\tableofcontents‎‎
\end{document}

答案2

在您的后面\tableofontents有 2 个,left to right marks即 U+200E。删除它们后应该就没问题了。

相关内容