moreverb 与 spverbatim、texlive 2016 冲突

moreverb 与 spverbatim、texlive 2016 冲突

我总是会遇到包冲突;)因为我有一个很大的公共输入文件,我需要在其中一次加载许多包(因为我有 1,000 个 Latex 文件,所以懒得为每个文件每次只输入真正需要的包)。

我刚刚发现,如果将包\usepackage{moreverb}\usepackage{spverbatim}加载到同一个文件中,就会发生错误。我查看了https://www.ctan.org/pkg/spverbatim并没有注意到那里提到了这一点。所以这里有一个 MWE 来展示这个问题

\documentclass[11pt]{article}
\usepackage{moreverb}
\usepackage{spverbatim}

\begin{document}

\begin{spverbatim}
{{y[x] -> C[1] + Integrate[a*f[K[1]], {K[1], 1, x}]}}
\end{spverbatim}

\end{document}

使用以下方式编译lualatex foo.tex

This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2016/03/31> patch level 2
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/moreverb/moreverb.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/tools/verbatim.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/spverbatim/spverbatim.sty)
(./foo.aux)

! LaTeX Error: \begin{spverbatim} on input line 7 ended by \end{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.11 \end{document}

删除\usepackage{moreverb}后编译成功。

这是已知问题吗?解决方法是删除,moreverb但要问一下,以防这是未知的,或者以防这不应该发生,并且可能在某个地方有错误。

Linux 上的 Tex 2016。

答案1

这两个包不兼容,moreverb重新定义\verbatim(添加了额外的分组层),这与 所做的重新定义不一致spverbatim

当然,如果有一个特定的用例需要这两个包的功能,那么可以写一些东西,但如果这似乎只是加载多个包的自然结果,那么最好只是加载其中一个,而不是维护第三个变体包。

相关内容