4

The following example with a minted enviroment fails with the error message

_minted-test/7587C145B52367AE51CACC4AFB0EC13D2F785CCAC2A2CC760CA216BD1781DF79.pygtex:3: Extra }, or forgotten \endgroup. [  b]
_minted-test/7587C145B52367AE51CACC4AFB0EC13D2F785CCAC2A2CC760CA216BD1781DF79.pygtex:3: Missing } inserted. [   b]

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{minted}
\setminted{obeytabs}

\begin{document}
\begin{minted}[breaklines=true]{text}
a
    b
\end{minted}
\end{document}

It works fine after removing one of the following:

  • the tab in front of the b
  • the breaklines=true
  • the \setminted{obeytabs}

Is there an explanation for this behaviour or can this be considered as a bug?


The .pygtex file looks like this, intention is also a tab:

\begin{Verbatim}[commandchars=\\\{\}]
a
    b
\end{Verbatim}


  • If you copy/paste the code, it will contain spaces infront of b instead of a tab. In order to reproduce this you have to replace it again. Unfortunately, SE seems to auto-replace tabs with spaces(https://meta.stackexchange.com/a/22189/293906). If you know how to use tabs in code blocks, please leave a comment.
  • 2
    This looks like a bug. I'm working on fixing some other bugs for the next minted release, and will see if I can also fix this. – G. Poore Dec 20 '15 at 14:30
3

Update from July 2016: obeytabs is compatible with breaklines starting with minted 2.3. This release of minted requires the fvextra package, which resolves many longstanding issues related to tabs in general and obeytabs in particular.


The obeytabs and breaklines options are incompatible due to the way that obeytabs is implemented. obeytabs is implemented so that no breaks are possible.

The next version of minted will give an error message when these two options are used together. I have also opened an issue at GitHub to track this in the future. Additional technical details are there.

This could be fixed, but a fix from the minted side of things is unlikely. minted uses fancyvrb internally to do the code typesetting. fancyvrb is responsible for obeytabs. fancyvrb has been largely unchanged since 1998, with minor modifications in 2008. minted is doing things that fancyvrb was not designed for, and already contains a number of patches to fancyvrb. This patching approach is becoming unsustainable. At some point, adding additional features to minted, or fixing these kinds of incompatibilities, will require a major overhaul of fancyvrb or a new verbatim package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.