TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Verbatim environment is right-aligned when using XePersian package, so I have to wrap it in latin environment. So I decide to create a new environment:

{‎\end{verbatim}‎‎\end{latin}‎ }

Unfortunately it generates an error.

share|improve this question
up vote 2 down vote accepted

You can't use \begin{verbatim} and \end{verbatim} in arguments to other commands (in this case \newenvironment).

The package \verbatim allows to overcome this limitation:


Notice that the "internal" versions of the commands should be used.

share|improve this answer
Thanks, can you please explain which commands can be used in \newenvironment and which one can't? – PHPst Sep 21 '12 at 11:37
\begin{verbatim} is the exception, in general. However the situation is a bit different when using the verbatim package for defining a new verbatim environment; read the manual for the package: either do texdoc verbatim in a terminal window or click here – egreg Sep 21 '12 at 12:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.