我尝试用 Python 生成盒装的 Minted 代码,它不会破坏 Python 文档字符串。我尝试了不同的break...
选项,但都没有成功。
MVE如下:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{minted,skins,breakable}
\newtcblisting{pythoncode}{
listing engine=minted,
breakable,
listing only,
nobeforeafter,
minted style=colorful,
minted language=python,
enhanced,
minted options = {
breaklines=true,
%breakanywhere=true,
%breakbytoken=true,
%breakbytokenanywhere=true,
%breakbefore=.
},
}
\begin{document}
\begin{pythoncode}
def make_segments(sig, segment_size=100, buffer=10):
"""
The function takes in a 1-dimensional array and splits it into segments of a specified size. The segments are created with a constant step between them, determined by the buffer parameter.
"""
pass
\end{pythoncode}
\end{document}