I use minted for Python code, but with the long lines, instead of adapting to the document text width, it expands to the right without any kind of margin, and the code that doesn't fit, just does not appear.

I wouldn't like to write a linebreak for every long line because that would be a tedious task, I want all the code wrapped by minted to follow a margin.

How to work this out¿? Thank you in advance.

closed as unclear what you're asking by TeXnician, CarLaTeX, Zarko, Mensch, Stefan Pinnow Apr 8 '17 at 19:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Welcome to TeX.SX! Version 2 of minted has the breaklines option. – egreg Aug 24 '15 at 9:35
  • Thank you! You mean, it is necessary to use a breakline always¿? Not a field like "Text width" or something like that for the whole code¿? – aDoN Aug 24 '15 at 9:43
  • The problem is that the document geometry, doesn't apply to the code wrapped in the minted tag, so the margins are different, I have tried it: \begin{minted} [breaklines=true] and it makes the code not to drift away, but It doesn't apply the margin, I need something like this: \begin{minted} [breaklines=true,margins=5cm] But it doesn't seem to exist, does it¿? – aDoN Aug 24 '15 at 12:37
  • 1
    Can you please add a small compilable example? – egreg Aug 24 '15 at 13:11
  • minted uses fancyvrb internally, so fancyvrb's options xleftmargin, xrightmargin, and resetmargins are available for working with margins. – G. Poore Aug 24 '15 at 15:23

Browse other questions tagged or ask your own question.