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?

migrated from tex.stackexchange.com Nov 15 '18 at 7:07

This question came from our site for users of TeX, LaTeX, ConTeXt, and related typesetting systems.

2
(add-to-list 'LaTeX-verbatim-environments "pycode")
(add-to-list 'LaTeX-indent-environment-list
        '("pycode" current-indentation))
  • Symbol’s value as variable is void: LaTeX-verbatim-environments – vy32 Nov 11 '18 at 15:11
  • GNU Emacs 26.1 (build 1, x86_64-apple-darwin18.0.0) of 2018-10-07 – vy32 Nov 11 '18 at 15:12
  • Any thoughts? The variable doesn't seem to be there in my version of the latex mode. – vy32 Nov 11 '18 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 '18 at 8:34
  • Symbol’s value as variable is void: LaTeX-verbatim-environments is what I get. – vy32 Nov 13 '18 at 4:28

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.