Skip to content

Wrong indentation with bytefields and the optional length argument #2031

@lkfbr

Description

@lkfbr

Hello,
thank you for the great plugin!

I think I hit an edge case with automatic indentation (triggered on gg=G). When I use bytefield with \\ and the optional length argument (\\[1.5ex]) and there is an ampersand in the group before \\, then the indentation is not decreased. Removing either the length argument ([1.5ex]) or an ampersand from the leftwordgroup environment solves the problem.

minimal.vim

set nocompatible
let &runtimepath  = '~/.vim/plugged/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/plugged/vimtex/after'
filetype plugin indent on
syntax enable

minimal.tex

\documentclass{beamer}
\usepackage{bytefield}

\begin{document}

\begin{frame}[fragile]{Test}
\begin{center}
\begin{bytefield}{2}
\begin{leftwordgroup}{Test}
\bitbox{1}{Test}  & \bitbox{1}{Test}
\end{leftwordgroup} \\[1.5ex]
\end{bytefield}
\end{center}
\end{frame}

\begin{frame}{Next frame}
\end{frame}

\end{document}

Commands/Input
From the minimal.tex, indent it using gg=G.

Observed Behaviour

\documentclass{beamer}
\usepackage{bytefield}

\begin{document}

\begin{frame}[fragile]{Test}
	\begin{center}
		\begin{bytefield}{2}
			\begin{leftwordgroup}{Test}
				\bitbox{1}{Test}  & \bitbox{1}{Test}
			\end{leftwordgroup} \\[1.5ex]
			\end{bytefield}
		\end{center}
	\end{frame}

	\begin{frame}{Next frame}
	\end{frame}

	\end{document}

Expected Behaviour

\documentclass{beamer}
\usepackage{bytefield}

\begin{document}

\begin{frame}[fragile]{Test}
	\begin{center}
		\begin{bytefield}{2}
			\begin{leftwordgroup}{Test}
				\bitbox{1}{Test}  & \bitbox{1}{Test}
			\end{leftwordgroup} \\[1.5ex]
		\end{bytefield}
	\end{center}
\end{frame}

\begin{frame}{Next frame}
\end{frame}

\end{document}

Output from VimtexInfo

System info
  OS: Linux 5.11.11-200.fc33.x86_64
  Vim version: VIM 8.2 (1-2637)
  Has clientserver: true
  Servername: VIM

VimTeX project: test
  base: test.tex
  root: /tmp
  tex: /tmp/test.tex
  out: /tmp/test.pdf
  log: /tmp/test.log
  aux: /tmp/test.aux
  fls: /tmp/test.fls
  main parser: current file verified
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
  viewer: General
  qf: LaTeX logfile
    addqflist: 51
    fix_paths: 52
    set_errorformat: 50
  document class: beamer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions