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
864 stars 84 forks source link

Error when specifiying `lookForAlignDelims` in command line #551

Closed plutonium-94 closed 1 month ago

plutonium-94 commented 1 month ago

There is an error when specifiying lookForAlignDelims in command line:

original .tex code

\documentclass{standalone}

\usepackage{tabularray}

\begin{document}

\begin{tblr}{colspec={*{2}{c}},cell{1}{1}={r=2}{c}}
    {1   \\2}&3\\
     & 4 \\
\end{tblr}

\end{document}

command

latexindent test.tex -y="lookForAlignDelims:tblr:alignFinalDoubleBackSlash:1"

actual/given output

Can't use string ("1") as a HASH ref while "strict refs" in use at C:\Users\User\AppData\Local\Temp\par-55736572\cache-84e8e21fc7334f25e00d5eeab31d6b5c00d22c77\inc\lib/LatexIndent/GetYamlSettings.pm line 753.

desired or expected output

\documentclass{standalone}

\usepackage{tabularray}

\begin{document}

\begin{tblr}{colspec={*{2}{c}},cell{1}{1}={r=2}{c}}
        {1   \\2} & 3 \\
                  & 4 \\
\end{tblr}

\end{document}

anything else

When I change the environment from tblr to tabular or use yaml settings, it works correctly and produces desired output.

cmhughes commented 1 month ago

Many thanks.

So this is specific to the y switch?

plutonium-94 commented 1 month ago

Many thanks.

So this is specific to the y switch?

Yes, at least I think so.

cmhughes commented 1 month ago

Thanks again. This is fixed and released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.24.3