我在许多事情上都使用Pygments
,我也想在 latex 报告中使用它。我找到了与Pygments交互的Minted
包,但是其中一些注释和某些代码溢出了正确的边距。我过去曾使用过lSTListings的breaklines=true
,但是我看不到使用Minted包获得该功能的方法,有什么想法吗?
\documentclass[10pt]{article}
\usepackage{fancyvrb}
\usepackage{minted}
\begin{document}
\begin{minted}[mathescape,
linenos,
numbersep=5pt,
frame=single,
numbersep=5pt,
xleftmargin=0,
]{python}
class Run(BaseModel):
"""
Run: unique Tool and multiple Inputs
Status:
Running => jobs are pending or runing and not all jobs have been completed
Paused => workers querying for 'Running' Runs won't get this Run until we change status again
Done => all jobs have completed and have a result_status = 'Done'
Incomplete => No results (inputs) have been associated with the Run
"""
name = models.CharField(max_length = 150,
unique=True)
tool = models.ForeignKey('Tool')
tags = models.ManyToManyField(RunTag, related_name="model_set")
\end{minted}
\end{document}
最佳答案
不幸的是,抱歉,暂时或在可预见的将来minted
中都没有解决方案。实现breaklines
功能非常困难。在这里,使用listings
可能是最好的解决方案。
Minted现在具有breaklines
选项。
关于syntax - Latex:使用Minted包-如何包装文本(linebreaks = true),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2051383/