[Tex/LaTex] Verbatim inside a command


I have a question about a Verbatim, I want to write a word inside of the subsubsection title. I got an error. How can I fix it?: \subsubsection{The \verb+@interface+ Section}

Best Answer

Use the cprotect package:

\usepackage{cprotect}% http://ctan.org/pkg/cprotect
\cprotect\subsubsection{The \verb+@interface+ Section}

However, consider reading through the informative UK TeX FAQ entry: Why doesn’t verbatim work within …? In particular, other alternatives like \texttt{...} also exist and are far more manageable. Even in your case, using

\subsubsection{The \texttt{@interface} Section}

works as-is.

Related Question