[英]Latex: Using Minted package - how do I make it wrap the text (linebreaks=true)
我使用Pygments
做了很多事情,我也希望在我的乳膠報告中使用它。 我找到了與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
可能是您最好的解決方案。
現在鑄造有一個breaklines
選項。
如果你給它提供breaklines
選項,Minted 2.0(剛發布)確實會破breaklines
:
\documentclass[10pt]{article}
\usepackage{fancyvrb}
\usepackage{minted}
\begin{document}
\begin{minted}[%
breaklines,
mathescape,
linenos,
numbersep=5pt,
frame=single,
numbersep=5pt,
xleftmargin=0pt,
]{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}
還有各種相關選項來控制如何在輸出中指示換行符的存在。 參見鑄造文檔中的第6.3節。
您應該看看在LaTeX中使用Pygments熒光筆的texments
。 http://www.ctan.org/tex-archive/macros/latex/contrib/texments/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.