2

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.

2

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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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