TransWikia.com

tcolorbox in a sublevel of enumerate containing verbatim

TeX - LaTeX Asked on July 19, 2021

I would like the codepy box defined below to start either:

  • to a new line,
  • or its width be reduced so that it does not overlap with number 1.1]
    How to do this ?

When tcolorbox contains a verbatim environment, the box covers the number.

MWE

documentclass{article}
usepackage{enumitem,xcolor,pythontex}
usepackage[skins,breakable,xparse,many]{tcolorbox}
%
DeclareTColorBox{codepy}{ o }{
      skin=enhancedmiddle jigsaw, % Rule D/G uniquement
      enlarge top initially by = 2.5mm,
%      parbox=false,
      rightrule=0mm,
      leftrule=2mm,
      arc=0mm,
      outer arc=0mm,
      left=3.4mm,
      coltitle=white,
      titlerule=0mm,
      detach title,
      attach title to upper={ quad  },
      IfValueTF={#1}{title={#1}}{},
}
%
setlist{nolistsep,
         leftmargin = *}
%
setlistdepth{3}
%
newlist{myEnumerate}{enumerate}{3}
setlist[myEnumerate,1]{label=arabic*),ref=arabic*,labelwidth=2em,leftmargin=!,wide}
setlist[myEnumerate,2]{label=arabic{myEnumeratei}.arabic*],ref=themyEnumeratei.arabic*,labelwidth=2em,align=left,leftmargin=!}
%
usepackage{lipsum}
%%%%

begin{document}

begin{myEnumerate}
item 
    begin{myEnumerate}
    item
begin{codepy}
Test
begin{pyverbatim}
x = 1   
end{pyverbatim}
end{codepy}
    end{myEnumerate}
end{myEnumerate}

end{document}

enter image description here

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