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

Indentation in tabular* #526

Closed Pberg22 closed 5 months ago

Pberg22 commented 5 months ago

Please provide the following when posting an issue:

original .tex code

Please paste your .tex code here. Please note in answering your issue, I may add the code you provide to the test-cases directory. Please detail explicitly if you would prefer me not to do so..

\documentclass{article}
\begin{document}
\begin{center}
  \begin{tabular*}{\linewidth}{ll}
    1&2\\
    32 &4\\
  \end{tabular*}
\end{center}
\end{document}

yaml settings

Please paste your YAML settings (if any) here

actual/given output

Please paste the output you receive here

\begin{center}
  \begin{tabular*}{\linewidth}{ll}
    1&2\\
    32 &4\\
  \end{tabular*}
\end{center}

desired or expected output

Please paste your desired/expected output here; that is, what do you want the output to look like

\begin{center}
  \begin{tabular*}{\linewidth}{ll}
    1  & 2 \\
    32 & 4 \\
  \end{tabular*}
\end{center}

anything else

Please put any comments or anything else here :)

I'm using the LaTeX Workshop extension for Visual Studio Code. The formatting of my .tex text seem to work fine in all cases, except when I'm using tabular* environment, where nothing happens when I try to format the text. I'm new to both LaTeX and posting issues on GitHub - just tell me if I missed anything.

cmhughes commented 5 months ago

Thanks for this. Can you try the following settings

latexindent.yaml

lookForAlignDelims:
        tabular*: 1

You call it with

latexindent.pl -l my file.tex
Pberg22 commented 5 months ago

Ohh now it works! I was missing the line tabular*: 1 in my defaultSettings.yaml file. Adding it directly after the options of tabular: fixed it when using the workshop short Ctrl K + Ctrl F

cmhughes commented 5 months ago

Many thanks.

I think I'll update defaultSettings to have this for the future.

On Tue, 19 Mar 2024, 11:29 Pberg22, @.***> wrote:

Ohh now it works! I was missing the line tabular*: 1 in my defaultSettings.yaml file. Adding it directly after the options of tabular: fixed it when using the workshop short Ctrl K + Ctrl F

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/526#issuecomment-2006937398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYHYYAF722QMPTBTHG3YZAORVAVCNFSM6AAAAABE3MKZYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWHEZTOMZZHA . You are receiving this because you commented.Message ID: @.***>