TransWikia.com

How can I make minted in newfloat mode work with dot2texi?

TeX - LaTeX Asked on January 21, 2021

The following gives a compilation error:

documentclass{report}
usepackage{dot2texi}
usepackage[newfloat]{minted}
begin{document}
Content
end{document}

with output

...
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.

It seems that moreverb and minted are both trying to define listing

One Answer

Unfortunately, moreverb defines listing and listing* environments that conflict with the environment with the same names defined by minted.

You can remove the useless environments defined by moreverb.

documentclass{report}

usepackage{dot2texi}
% remove the definitions of listing and listing*
newcommandzzzzzz[1]{expandafterletcsname#1endcsnamerelax}
zzzzzz{listing}zzzzzz{endlisting}
zzzzzz{listing*}zzzzzz{endlisting*}

usepackage[newfloat]{minted}

begin{document}
Content
end{document}

Note: I used a fairly large number of z's in order to make David happy.

With no 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}

Correct answer by egreg on January 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP