以下给出编译错误:
\documentclass{report}
\usepackage{dot2texi}
\usepackage[newfloat]{minted}
\begin{document}
Content
\end{document}
带输出
...
Package: dot2texi 2008/05/07 v3.0p1 Run dot2tex from LaTeX
(/usr/local/texlive/2019/texmf-dist/tex/latex/moreverb/moreverb.sty
Package: moreverb 2008/06/03 v2.3a `more' verbatim facilities
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/verbatim.sty
Package: verbatim 2019/11/10 v1.5r LaTeX2e package for verbatim enhancements
...
Package: minted 2017/07/19 v2.5 Yet another Pygments shim for LaTeX
...
! LaTeX Error: Command \listing already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1151 ...sting}{tbp}{lol}[\minted@float@within]}}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
似乎moreverb
和minted
都在试图定义\listing
答案1
不幸的是,moreverb
定义listing
和listing*
环境与定义的同名环境冲突minted
。
您可以删除 定义的无用环境moreverb
。
\documentclass{report}
\usepackage{dot2texi}
% remove the definitions of listing and listing*
\newcommand\zzzzzz[1]{\expandafter\let\csname#1\endcsname\relax}
\zzzzzz{listing}\zzzzzz{endlisting}
\zzzzzz{listing*}\zzzzzz{endlisting*}
\usepackage[newfloat]{minted}
\begin{document}
Content
\end{document}
z
注意:为了让大卫高兴,我使用了相当多的“”。
没有z
:
\documentclass{report}
\usepackage{etoolbox}
\usepackage{dot2texi}
% remove the definitions of listing and listing*
\csundef{listing}\csundef{endlisting}
\csundef{listing*}\csundef{endlisting*}
\usepackage[newfloat]{minted}
\begin{document}
Content
\end{document}
答案2
如果我改变包声明的顺序,它就会对我有用。首先,moreverb
然后是minted
。
\usepackage{moreverb}
\usepackage{minted}