27

I ran into an issue with the following code

\begin{document}


    \begin{frame}[fragile] % Start of frame

        \begin{columns}[t]

            \begin{column}{.02\textwidth}\end{column} % Empty spacer column

            \begin{column}{.465\textwidth} % The first column


                \begin{block}

                    \begin{minted}{c}
                        int main() {
                            return 0;
                        }
                    \end{minted}

                \end{block}
            \end{column}

        \end{columns}
    \end{frame} % End of frame
\end{document}

With the following error

Runaway argument?
! File ended while scanning use of \next.
<inserted text> 
            \par 

I'm putting my solution here because I wasted hours trying to figure out what went wrong with such a cryptic error message

glitchyme
  • 741

2 Answers2

37

The fix was 2-part

  • \end{frame} can NOT be indented
  • \end{frame} cannot have any comments directly after it

Changing this line fixed the error.

Torbjørn T.
  • 206,688
glitchyme
  • 741
  • 8
    So we can neither properly indent our code nor comment why the particular line is poorly indented :-). – user87690 Aug 17 '17 at 14:30
  • 3
    Totally arbitrary "errors" like this is certainly the worst of Latex. You waste so much time looking for an invisible space, something you would never imagine could breaks the whole compilation up. – luchonacho Sep 25 '21 at 15:11
3

I got the same error message and the problem was a [fragile] in

\begin{frame}[fragile]{Title}
 ...
\end{frame}

that I use for frames that contain LaTeX Listings code. I put it there before actually using Listings in that frame.

Stefan Pinnow
  • 29,535
Eric
  • 31
  • 1