In auctex, there is \begin{frame} block in beamer. After this coming text starts with a indent. Is it possible to prevent this?


hello world
|__[TAB] => nothing happens
\begin{frame}{SomeModel}     | \begin{frame}{SomeModel}
hello world                  |   hello world  
^                                ^
|__[TAB]                         |_2 space added, where I want to prevent it.

minimal code that only loads auctex:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(fset 'yes-or-no-p 'y-or-n-p)

(if (not (package-installed-p 'auctex))
      (package-install 'auctex)))
  • What difference does it make? AucTeX is trying to format things readably to reflect the hierarchical structure, and TeX does not care about the extra space. Why do you care?
    – NickD
    Jan 9, 2023 at 17:14
  • In org-mode for the first hierarchical I get used to write without space, so when there is additional extra space its hard to get adapted during typing
    – alper
    Jan 9, 2023 at 18:02
  • 1
    Maybe it helps if you customize the variable LaTeX-document-regexp or write something like this in your init file: (setq LaTeX-document-regexp "document\\|frame\\b"). Jan 10, 2023 at 10:12
  • @ArashEsbati Thanks a lot, (setq LaTeX-document-regexp "document\\|frame\\b") solved it. Please fell free to add it as an answer.
    – alper
    Jan 10, 2023 at 10:32

1 Answer 1


AUCTeX has a variable LaTeX-document-regexp:

LaTeX-document-regexp is a variable defined in latex.el.

Its value is "document"

Regexp matching environments in which the indentation starts at col 0.

If you use the frame environment only top-level in your .tex file, you can add it to this variable. Use the customize interface or add this to your init file:

(setq LaTeX-document-regexp "document\\|frame\\b")
  • What does \\b stands for?
    – alper
    Jan 10, 2023 at 19:40
  • 1
    @alper - Have a look here Jan 11, 2023 at 7:32

Your Answer

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

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