GeneralVerbatim Problem

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
hector
Posts: 2
Joined: Wed Nov 09, 2011 4:34 pm

Verbatim Problem

Post by hector »

Hello, I am trying to define an environment like this:

Code: Select all

\newenvironment{example}
{
Example\\
\begin{enumerate}
}
{
\end{enumerate}
}

\newcommand{\something}[2]
{
\item #1.
\begin{flushright}(#2)\end{flushright}
}
Now, when I use it without including any verbatim or verb I get the expected result:

Code: Select all

\begin{example}
\something{This is a test}{56.b}
\end{example}
The problem arises when I try to include a verbatim or verb inside the environment:

Code: Select all

\begin{example}
\something{This is a test with \verb_\verb_}{56.b}
\end{example}
I am gettting the error: "\verb ended by end of line", and when I try to use a \begin{verbatim}...\end{verbatim} I get another error: "Missing $ inserted".

What am I doing wrong? how can I put a verbatim inside of my environment?

Thanks in advance,

Héctor

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

hector
Posts: 2
Joined: Wed Nov 09, 2011 4:34 pm

Re: Verbatim Problem

Post by hector »

Hello, topic solved. I used \cprotect, thanks.

Héctor
Post Reply