2

I'm using pythontex to allow me to embed Python code in LaTeX files. (It's really great, BTW.) I edit my LaTeX with EMACS. Unfortunately, EMACS thinks that any environment should be indented, and if I have indent within \begin{pytex}...\end{pytex}, it generates a Python error.

That is, EMACS thinks this is correct:

\begin{pycode}
   print("Hello World!")
\end{pycode}

But in fact, this is correct:

\begin{pycode}
print("Hello World!")
\end{pycode}

What do I put in Config-File to prevent the pycode environment from being indented?

1 Answer 1

2
(add-to-list 'LaTeX-verbatim-environments "pycode")
(add-to-list 'LaTeX-indent-environment-list
        '("pycode" current-indentation))
7
  • Symbol’s value as variable is void: LaTeX-verbatim-environments
    – vy32
    Nov 11, 2018 at 15:11
  • GNU Emacs 26.1 (build 1, x86_64-apple-darwin18.0.0) of 2018-10-07
    – vy32
    Nov 11, 2018 at 15:12
  • Any thoughts? The variable doesn't seem to be there in my version of the latex mode.
    – vy32
    Nov 11, 2018 at 15:12
  • On my machine, this works just fine (Arch Linux, also Emacs 26.1)! What's the output, when you run emacs with emacs -q and then evaluate the above code?
    – Tim Hilt
    Nov 12, 2018 at 8:34
  • Symbol’s value as variable is void: LaTeX-verbatim-environments is what I get.
    – vy32
    Nov 13, 2018 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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