9

When I use \verb+...+ within beamer I get

! Missing $ inserted.
<inserted text> 
                $
l.6 \end{frame}

? 

What is going wrong and how do I fix this problem?

A minimal example is

\documentclass{beamer}

\begin{document}
\begin{frame}{Title}
Some text \verb+\int+
\end{frame}
\end{document}
3

1 Answer 1

8

You can fix the problem by adding fragile:

\documentclass{beamer}

\begin{document}
    \begin{frame}[fragile]{Title}
        Some text \verb+\int+
    \end{frame}
\end{document}
3
  • 5
    It's worth expanding the answer with how fragile works maybe? :-) *or a link
    – 1010011010
    Commented Aug 20, 2014 at 17:07
  • @1010011010 I don't know how it works. If you know it, please feel free to add it to the answer. That is one reason why I made my answer "Community wiki". Commented Aug 20, 2014 at 17:12
  • Regarding how fragile works, one possible implementation is to collect the environment content verbatim then scantokens it when needed. (To check if it's correct, consult beamer source code.)
    – user202729
    Commented May 7, 2022 at 4:53

You must log in to answer this question.

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