cmhughes / latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
GNU General Public License v3.0
867 stars 84 forks source link

Comment after \item affects its alignment #467

Closed dpo closed 1 year ago

dpo commented 1 year ago

Please provide the following when posting an issue:

original .tex code

\begin{enumerate}
  \item One
  \item
    Two.
\end{enumerate}

\begin{enumerate}
  \item One
  \item%
    Two.
\end{enumerate}

yaml settings

All defaults.

actual/given output

\begin{enumerate}
        \item One
        \item
              Two.
\end{enumerate}

\begin{enumerate}
        \item One
              \item%
              Two.
\end{enumerate}

desired or expected output

\begin{enumerate}
        \item One
        \item
              Two.
\end{enumerate}

\begin{enumerate}
        \item One
        \item%
        Two.
\end{enumerate}

anything else

Why does the comment after \item affect its alignment? It looks as though the second \item is being mistaken as part of the contents of the first.

cmhughes commented 1 year ago

Many thanks, this is a bug. I hope to get to it soon.

cmhughes commented 1 year ago

Fixed as of https://github.com/cmhughes/latexindent.pl/commit/682d46494cc35144c123d51ec57f55c5c3e29771, a release to follow soon, hopefully.

cmhughes commented 1 year ago

Implemented at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.23

dpo commented 1 year ago

Thank you!