I get the error

! Argument of \@item has an extra }.
<inserted text> 
l.135 \emph{class} \bfcode{C}}

when translating a LaTeX file generated by Sphinx documentation system.

I've managed to reduce it to the following self-contained example:




  \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt
                 \rightmargin 0pt \topsep -\parskip \partopsep \parskip
                 \itemsep -\parsep}


\pysigline{\phantomsection\label{index:project0class_c}\item[] template \textless{}typename T\textgreater{}
\emph{class} \bfcode{C}}
Test class. 


As you can see the '{' and '}' are balanced.

What does this error mean and how can I fix it?

  • 2
    Can you post some sort of minimal, compile-able example? For instance, there's no way for us to know (right now) that the \item is indeed inside some sort of list environment (where it would cause an error outside of one). Sep 15, 2014 at 15:32
  • 3
    impossible to be sure without working example but I wpould gues that \pysigline puts its argument in an optional argument so use \pysigline{{...}} to hide the [] Sep 15, 2014 at 15:34
  • You should work a little and try to reduce the code to the minimal necessary to reproduce your error. Then post it here.
    – Manuel
    Sep 15, 2014 at 15:44
  • @SeanAllred OK, now I've reduced it to a self-contained example.
    – vitaut
    Sep 15, 2014 at 16:00
  • 1
    @SeanAllred answer added I was constrained yesterday:-) chat.stackexchange.com/transcript/message/17694997#17694997 Sep 16, 2014 at 11:08

1 Answer 1


A LaTeX optional argument ends at the first ] (unless it is inside a {} group. It does not match [ ] (unless you use the declarations provided by xparse) so in

... \item[...\foo[] ...]  zzz

the argument of \item is not ...\foo[] ... but ...\foo[ and things go wrong.

\pysigline puts its argument in an optional argument so use


to hide the []

Or better (if you have access to the definition in your real case) fix the definition to add the extra {} in all cases:

                                 %  %

now a stray ] in the argument to \pysigline is protected from terminating the optional argument of the inner \item

You must log in to answer this question.

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