# \verb not working in beamer even though I use [fragile]

Just trying to display a command like \section{} in the presentation, but \verb doesn't work. It works without the \uncover{}, but is there anyway to get around that?

\documentclass[t,xcolor=dvipsnames,table,ignorenonframetext]{beamer}
\usepackage{verbatim}
\begin{document}

\begin{frame}[fragile]
\frametitle{Why does this not work?}

\uncover<+->{\begin{block}{Zum Beispiel...}
\begin{itemize}
\uncover<+->{\item Just trying to show something like \verb|\section{}|}
\end{itemize}
\end{block}}

\end{frame}
\end{document}


\verb does not work as argument to another command.

But in beamer both \begin{block} and \item accept a <+-> argument, so you can use that instead of \uncover:

\documentclass[t,xcolor=dvipsnames,table,ignorenonframetext]{beamer}
\usepackage{verbatim}
\begin{document}

\begin{frame}[fragile]
\frametitle{Why does this not work?}

\begin{block}<+->{Zum Beispiel...}
\begin{itemize}
\item<+-> Just trying to show something like \verb|\section{}|
\end{itemize}
\end{block}

\end{frame}
\end{document}


And the output:

• Thanks, that's perfect! – user9974638 Apr 14 at 12:25
• @user9974638 You're welcome :-) You can mark the question as “solved” by clicking the ✔ to the left of the answer. – Phelype Oleinik Apr 14 at 14:46
• @user9974638 No problem :) Marking the question as “accepted” serves to show other people who read this post what answer solved your problem. You can also vote up or down if you liked or disliked a question or answer, like a kind of quality control of the site. – Phelype Oleinik Apr 15 at 16:30