I'm trying to solve a problem that seems to be identical to Automatic line breaking in minted (though that question title is less specific)... the issue is pertaining to the "wrapped" (or 'broken'? text, the text which is continued on subsequent lines) text, trying to get that appropriately indented to match the line it came from.

This picture shows the wrapped/broken lines which I want to be indented to the depth shown:
enter image description here

The solution in that other question seems to recommend hacking the pygments library which minted uses... !

Is there a solution more appropriate than hacking the pygments library?

My code:


\usepackage [T1]{fontenc}


  • One particular unexplained challenge with the solution from the other question (hack the Pygments library) is: where to place the modified file? I can see Pygments installed via pip3 and various python programs which rely on it... but given package management in Linux I see no reason to assume that pdflatex is even using that version of pyments and not a different one stored somewhere else.
    – alec
    Jun 3, 2022 at 13:33
  • 1
    The pygmentize that comes first in the default PATH will be used. What you want seems quite difficult: you want to take care of how many initial spaces are in a line, which is not currently done.
    – egreg
    Jun 3, 2022 at 14:47
  • my line of thinking: vim can do this, why not latex?
    – alec
    Jun 3, 2022 at 14:48
  • Somebody found such a feature useful for vim and programmed it. You're apparently the first to ask for this feature, so somebody has to program Pygments to do it.
    – egreg
    Jun 3, 2022 at 14:53
  • I understand the behavior needs to be programmed... I'm surprised that hasn't been done already though, as what I'm describing seems to me like obviously desirable behavior... like what about autogobble? I found that in tug.ctan.org/macros/latex/contrib/minted/minted.pdf but haven't been able to get that option or any others that appear to be associated with breaklines to have any visible effect.
    – alec
    Jun 3, 2022 at 15:22


You must log in to answer this question.

Browse other questions tagged .