Latex: Using Minted package - how do I make it wrap the text (linebreaks=true)

Paddie picture Paddie · Jan 12, 2010 · Viewed 24.1k times · Source

Im using the Pygments for a lot of things, and I'd like to also use this in my latex report. I found the package Minted which interacts with Pygments, but some of the comments and some of the code overflows the right margin. I have used lstlistings' breaklines=true in the past, but I don't see a way to get that functionality using the Minted package, any ideas?


\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}

Answer

Konrad Rudolph picture Konrad Rudolph · Jan 31, 2010

Unfortunately, there’s no solution within minted at the moment or for the foreseeable future, sorry. Implementing the breaklines feature is quite difficult. Using listings instead may be your best solution here.

Minted now has a breaklines option.