代码之家  ›  专栏  ›  技术社区  ›  Paddie

乳胶:使用薄荷包装-如何使它包装文本(linebreaks=true)

  •  23
  • Paddie  · 技术社区  · 15 年前

    我正在使用 Pygments 对于很多事情,我也希望在我的乳胶报告中使用这个。我找到包裹了 Minted 它与Pygments交互,但是一些注释和一些代码溢出了右边距。我用过lstlistings' breaklines=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}
    
    3 回复  |  直到 9 年前
        1
  •  18
  •   Konrad Rudolph    9 年前

    不幸的是,在 minted 目前或可预见的将来,对不起。实施 breaklines 功能相当困难。使用 listings 相反,这可能是你最好的解决方案。

    现在铸造有一个 断线 选择权。

        2
  •  10
  •   jolson    10 年前

    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节 minted 文档。

        3
  •  2
  •   Mica    15 年前

    你应该看看 texments 因为它是用于在乳胶中使用比重计的荧光笔。 http://www.ctan.org/tex-archive/macros/latex/contrib/texments/