I try to get line-wrapping to work with \mintinline, like so:




\mintinline[breaklines, bgcolor=lightgray]{java}{test test test test test test test test test test test test test test test test test test test test test test test}


I also tried setting

  • \setmintedinline{breaklines}
  • \newmintinline{java}{breaklines}

But the code won't wrap. I read here (github) and here (docu), that \mintinline should allow for breaklines-option.

Also this

    \csname PYG\minted@get@opt{style}{default}\endcsname

was suggested by Geoffrey Poore (gpoore) as a workaround for \mintinline to allow breakafter-option on github.

I tried it, but it didn't work for me. Maybe breaklines dosn't work in the first place.

How can I check the version of minted and whats the current version?

I checked Pygments instelled version, it's 2.2.0. Seems to be the current version.

Any ideas, why the lines won't wrap?

  • The only supported option for breaklines with mintinline is breakbytoken[anywhere], not breakafter.
    – TeXnician
    Commented Mar 13, 2018 at 9:53
  • @TeXnician Here github.com/gpoore/minted/issues/31#issuecomment-361010857 gpoore claims to have the workaround posted in the question Commented Mar 13, 2018 at 10:07
  • In my experiment, breaklines works; also breakafter=. or breakanywhere. Of course, the line must fit in the case of breakafter=., which could be a problem with a monospaced font.
    – egreg
    Commented Mar 13, 2018 at 11:46
  • @egreg are you using \mintinline? Because I can get it to work with \begin{minted}, but that's not the question. Maybe I have some wrong setting or I miss something. Commented Mar 13, 2018 at 12:00
  • @ArchLinuxTux Can you tell what version of minted you are running?
    – egreg
    Commented Mar 13, 2018 at 12:54

2 Answers 2


It seems like this has been fixed in the minted package. Using the options breaklines and breakafter causes a line break for the source code.

\mintinline[breaklines, breakafter=_]{python}{very_long_class_name}
  • I don't think so. OP's problem still persists. Tested with minted 2023/12/18 v2.9 and fvextra 2023/11/28 v1.6.1. Your example works because it does not use bgcolor=... like OP wanted.
    – Socowi
    Commented Apr 8 at 9:17


This is a well known problem, which is documented (search for bgcolor) (bug report):

bgcolor only works with \begin{minted}, but not with \mintinline. If used with \mintinline, breaklines doesn't work.

Regarding the code, that should allow for breakafter with \mintinline:

It doesn't work, because its "such a long string of text with only a single possible hyphenation point". The solution is to add this code (possibly without the \begingroup):

\setlength{\rightskip}{0pt plus 1 fil}
<paragraph with \mintedinline that won't normally break>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .