我希望codepy
下面定义的框可以启动:
- 换行,
- 或者减小它的宽度以使其不与数字重叠
1.1]
如何做到这一点?
当 tcolorbox 包含一个verbatim
环境时,该框会覆盖数字。
平均能量损失
\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}