Skip to content

Unnecessary reverse indent of \item in nested enumerate environment #2670

@lutalli

Description

@lutalli

Description

The indentation of \item seems to work improperly in a nested enumerate environment (enumerate in another enumerate). When I enter an \item in a nested enumerate and type a space, the \item gets indented backwards unnecessarily.

Steps to reproduce

  1. Begin with the following minimal TeX file:
\begin{document}

\begin{enumerate}
\end{enumerate}

\end{document}
  1. Type \item in the enumerate environment, after that start another enumerate (where | stands for the cursor position):
\begin{document}

\begin{enumerate}
    \item \begin{enumerate}|
\end{enumerate}

\end{document}
  1. Start a newline, type another \item (which belongs to the inner enumerate):
\begin{document}

\begin{enumerate}
    \item \begin{enumerate}
            \item|
\end{enumerate}

\end{document}
  1. Type a space:
\begin{document}

\begin{enumerate}
    \item \begin{enumerate}
        \item |
\end{enumerate}

\end{document}

Expected behavior

The inner \item should stay in place after the space is typed, like this:

image

Actual behavior

The following recording shows the problematic actual behavior - \item gets falsely indented back:

nested_enumerate.mov

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: macOS 12.4 (21F79)
  Vim version: NVIM v0.8.2
  Has clientserver: true
  Servername: /var/folders/zx/08zvm7jx3k70j_1_nyt1lc_80000gn/T/nvim.lutalli/2amYJE/nvim.66614.0

VimTeX project: tmp
  base: tmp.tex
  root: /
  tex: /tmp.tex
  main parser: fallback current file
  document class: 
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 0
    executable: latexmk
  viewer: Skim
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions