1

It's currently hitting the standard list-like environments and comments but I can't quite figure when exactly it happens, as it looks non-deterministic: sometimes in a big document I actually get a reasonable 2-space indentation inside those environments. Currently, this is what I get when I start a new document:

\documentclass{article}

\begin{document}

\section{Introduction}

\begin{enumerate}
        \item asdasdsadsad     asdasdsadsad     asdasdsadsad     asdasdsadsad
        asdsa asdasd asadasdsadas asdasdsaasdasdsadsad     asdasdsadsad     asd
        asd asd asdasdsad
\end{enumerate}

\begin{itemize}
        \item asdsdas   asdsdas   asdsdas   asdsdas   asdsdas   asdsdas   asd
        asd asdasdsa
\end{itemize}

\end{document}

So, when I insert an environment using yas-insert-snippet. I enter the name of the environment, hit Tab, and I start an \item, write a text till the end of line as set by fill-column and the text auto-wraps (as it should), but it also auto-indents with 8 spaces. This makes it completely unusable on narrow screens!

I tried explicitly calling LaTeX-fill-environment, and it does something similarly bad but a little different, so for the enumerate from the example above is does:

\begin{enumerate}
  \item asdasdsadsad asdasdsadsad asdasdsadsad asdasdsadsad asdsa asdasd
        asadasdsadas asdasdsaasdasdsadsad asdasdsadsad asd asd asd asdasdsad
\end{enumerate}

So, still 8 spaces but starting from the second line of an item.

I checked related variables that I know of (most likely, there are others), they're pretty much the reasonable defaults that make perfect sense:

  • LaTeX-item-indent value is 0
  • LaTeX-indent-level value is 2

I'm using Doom Emacs and my Doom config: https://github.com/ulysses4ever/dotfiles/tree/main/doom.d It's very minimally tuned from the default one. I use Emacs 29.0.92 (pgtk edition).

1 Answer 1

1

I don't use Doom Emacs, but I think what you describe is more a feature of Doom Emacs and not AUCTeX. IIUC, you have to adjust the variable +latex-indent-item-continuation-offset:

(defconst +latex-indent-item-continuation-offset 'align
  "Level to indent continuation of enumeration-type environments.

I.e., this affects \\item, \\enumerate, and \\description.

Set this to `align' for:

  \\item lines aligned
         like this.

Set to `auto' for continuation lines to be offset by `LaTeX-indent-line':

  \\item lines aligned
    like this, assuming `LaTeX-indent-line' == 2

Any other fixed integer will be added to `LaTeX-item-indent' and the current
indentation level.

Set this to `nil' to disable all this behavior.

You'll need to adjust `LaTeX-item-indent' to control indentation of \\item
itself.")
1
  • This looks to be it, thank you so much!!! Sep 3, 2023 at 16:13

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.