Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected indent of curly braces block #501

Closed
MrConnorKenway opened this issue Dec 14, 2023 · 8 comments
Closed

Unexpected indent of curly braces block #501

MrConnorKenway opened this issue Dec 14, 2023 · 8 comments
Labels
answered question has been answered question user-centred question about behaviour of latexindent.pl

Comments

@MrConnorKenway
Copy link

MrConnorKenway commented Dec 14, 2023

original .tex code

\section { hi }
abc
{ xyz }

actual/given output

\section { hi }
abc
    { xyz }

desired or expected output

\section { hi }
abc
{ xyz }

anything else

I'm sorry I didn't use a template. Could you help me understand why latexindent adds a tab before { xyz }?

@cmhughes
Copy link
Owner

cmhughes commented Dec 14, 2023 via email

@MrConnorKenway
Copy link
Author

Hi, I've updated the issue. Sorry for the trouble : (

@cmhughes
Copy link
Owner

Thanks, that's great.

If we use

noAdditionalIndentGlobal:
  namedGroupingBracesBrackets: 1    # 0/1

then we receive

\section { hi }
abc
{ xyz }

@cmhughes cmhughes added question user-centred question about behaviour of latexindent.pl answered question has been answered labels Dec 16, 2023
cmhughes added a commit that referenced this issue Dec 16, 2023
@MrConnorKenway
Copy link
Author

Thank you for your help! It indeed works, but when combining with other configs, it doesn't work again.

The original tex

\section { hi }
abc abc abc abc abc abc
{ xyz }

The command

latexindent -m -y "modifyLineBreaks:textWrapOptions:columns:25,modifyLineBreaks:textWrapOptions:blocksBeginWith:other:\\\\,noAdditionalIndentGlobal:namedGroupingBracesBrackets:1"

Actual output

\section { hi }
abc abc abc abc abc abc
        { xyz }

@cmhughes
Copy link
Owner

I'll happily look at this again, but before I do, can you provide your complete configuration.

@MrConnorKenway
Copy link
Author

That's all the config, I'm using the command line and I don't have any local config.
image

cmhughes added a commit that referenced this issue Dec 16, 2023
@cmhughes
Copy link
Owner

You need to use non-capturing parenthesis (?:\\\\) in your call, as in the following:

latexindent -m -y "modifyLineBreaks:textWrapOptions:columns:25,modifyLineBreaks:textWrapOptions:blocksBeginWith:other:(?:\\\\),noAdditionalIndentGlobal:namedGroupingBracesBrackets:1" issue-501a.tex

@MrConnorKenway
Copy link
Author

Thank you so much for answering my dumb question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered question has been answered question user-centred question about behaviour of latexindent.pl
Projects
None yet
Development

No branches or pull requests

2 participants