下面是一个简单的例子,你可以看到代码超出了页面的范围,我怎样才能让它位于文档的行宽和预定边距之内?谢谢。
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
import numpy as np
def incmatrix(genl1,genl2, a, dddfdfd, gdgd, ddfds ,dd, dfdf, enl1,genl2, a, dddfdfd, gdgd, ddfds ,dd, dfdfdfggf, fdfd):
m = len(genl1)
n = len(genl2)
return
\end{minted}
\end{document}
答案1
您可以使用breaklines=true
允许换行符的选项:
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}[breaklines=true]{python}
import numpy as np
def incmatrix(genl1,genl2, a, dddfdfd, gdgd, ddfds ,dd, dfdf, enl1,genl2, a, dddfdfd, gdgd, ddfds ,dd, dfdfdfggf, fdfd):
m = len(genl1)
n = len(genl2)
return
\end{minted}
\end{document}