【问题标题】:LaTeX \usepackage{forest} not working, apparently due to .sty file?LaTeX \usepackage{forest} 不工作,显然是由于 .sty 文件?
【发布时间】:2021-10-30 02:13:02
【问题描述】:

我正在尝试使用 TeX 包森林来绘制一个简单的树形图。但是,由于某种原因不想使用该软件包。我尝试从两个不同的镜像安装,并从 CTAN 网站手动安装,但仍然无法正常工作。导致错误的行是\usepackage{forest},因为没有此行文件编译得很好。根据下面的日志,错误在于 forest.sty 文件本身,但似乎没有其他人遇到此问题 - 除非它是由于新的 TeX 更新引起的?

有人知道这里发生了什么吗?

! Missing \endcsname inserted.
<to be read again>
\unhbox
l.1061 }
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1061 }
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Extra \endcsname.
\pgf@arrow@letter@ ...l@arrow@name@end \endcsname
#1
l.1061 }
I'm ignoring this, since I wasn't doing a \csname.
...
! Missing \endcsname inserted.
<to be read again>
\unhbox
l.1087 \csdef{forestmath@convert@from@n@to@_}
#1{\unexpanded{#1}}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\unhbox
l.1088 \csdef{forestmath@convert@from@d@to@_}
#1{\unexpanded{#1}}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
...

这会持续一段时间,从 1061 到 6309 行。错误列表显示了许多与此类似的行:

C:\...tex/latex/forest/forest.sty | Error line 1087 !Missing \endcsname inserted. <to be read again>\unhbox ...

第 1086-8 行的 forest.sty 文件是

1086: \def\forestmathzero{\forestmath@convert@from\forestmathtype@count{0}}
1087: \csdef{forestmath@convert@from@n@to@_}#1{\unexpanded{#1}}
1088: \csdef{forestmath@convert@from@d@to@_}#1{\unexpanded{#1}}

编辑:如下所述,问题出在包underscore,即\usepackage[strings]{underscore}这一行。因此,一个最小的例子是

\documentclass[a4paper]{article}
\usepackage[strings]{underscore}
\usepackage{forest}

\begin{document}
This won't work
\end{document}

【问题讨论】:

  • 请制作一个可编译的minimal reproducible example 并显示您的完整 .log 文件,以便我们查看您使用的内核和软件包版本。
  • \documentclass{article} \usepackage{forest} \begin{document} test \end{document} 适合我
  • 在尝试做一个最小的例子后,结果发现错误是由包underscoreforest结合引起的。感谢您的帮助

标签: package latex pdflatex miktex


【解决方案1】:

原来冲突的包是underscore,即\usepackage[strings]{underscore}这一行。删除此行即可解决问题。

【讨论】:

  • 你也可以颠倒你加载包的顺序
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-03
  • 2019-03-09
相关资源
最近更新 更多