I want to create a new environment the make my TeX works easier:

    In [1]: x = 1

    In [2]: x
    Out[2]: 1

I know listings has some problem for making new environment so it has its own \newlstenvironment, I tried to make new environment using this methods which I find in StackOverflow and on listings documentation but I get same error.

method 1:

    \begin{latin} \begin{lstlisting}}{%
        \end{lstlisting} \end{latin}}

method 2:

\lstset{language=python}} { \end{latin}}

Is it possible to create a new environment? How can I do that?

  • 1
    What is the latin environment?
    – user31729
    Dec 18 '17 at 14:37
  • When customizing lstlisting, or any other package that typesets stuff verbatim such as fancyvrb, you should strictly adhere to the package documentation. Dec 18 '17 at 14:46
  • latin is an environment from xepersian package that let you write English( left to right direction) in a Persian (right to left direction) Document.
    – Mehdi
    Dec 18 '17 at 14:48
  • The second method is the one that I wrote using package documentation.
    – Mehdi
    Dec 18 '17 at 14:51

You need the “internal” form:





سلام این یک آزمون است.

In [1]: x = 1

In [2]: x
Out[2]: 1

سلام این یک آزمون است.


enter image description here

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.