Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\newenvironment{faverbatim}
{\begin{latin}‎‎\begin{verbatim}‎}
{‎\end{verbatim}‎‎\end{latin}‎ }

Unfortunately it generates an error.

share|improve this question
add comment

1 Answer 1

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:

\usepackage{verbatim}
\newenvironment{faverbatim}
  {\latin\verbatim}
  {\endverbatim\endlatin}

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
add comment

Your Answer

 
discard

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.