2010-01-12 8 views
21

Używam Pygments dla wielu rzeczy i chciałbym również użyć tego w moim raporcie lateksowym. Znalazłem pakiet Minted, który współdziała z Pygments, ale niektóre komentarze i część kodu przepełniają prawy margines. Używałem w przeszłości bibliotek "01l", ale nie widzę sposobu, aby uzyskać tę funkcjonalność za pomocą pakietu Minted, jakichkolwiek pomysłów?Latex: Korzystanie z pakietu Minted - jak zrobić to zawijam tekst (linebreaks = true)


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

Odpowiedz

17

Niestety, nie ma rozwiązania w ciągu minted w momencie lub w dającej się przewidzieć przyszłości, przepraszam. Implementacja funkcji breaklines jest dość trudna. Korzystanie z listings może być tutaj najlepszym rozwiązaniem.

Minted teraz ma opcję breaklines.

+0

Dziękuję za jasną odpowiedź Konrad. Pomimo tego, byłem tak zadowolony z wyników, które otrzymałem w produkcji, że nie musiałem zbytnio przejmować się podwójnym sprawdzaniem wydajności. – Paddie

+1

Czy masz obecnie jakieś działania we wprowadzaniu funkcji 'breaklines' w bite? – eckes

+1

Chcę tylko powtórzyć pytanie @eckesa –

9

Wybite 2.0 (tylko zwolniony) robi linia łamania jeśli dać mu możliwość 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} 

Istnieją również różne pokrewne opcje kontrolujące jak obecność przerwie linii jest sygnalizowany na wyjściu. Zobacz rozdział 6.3 w dokumentacji minted.

Powiązane problemy