1

I wanted to know if there is a way to let latexindent know that tblr is a tabular environment by the package tabularray which means that the content should be aligned at &.

I could only manage to get the correct indent and alignment by changing the tblr environment to a tabular environment temporarily and then after latexindent ran over the tabular I changed it back to tblr.

Example how it should look like. enter image description here

More examples (with working tabular NOT tblr):

Before: enter image description here

After: enter image description here

Latexindent can do the alignment for tabular and I would like to know how I can configure or add tblr to be aligned at & the same as tabular works.

7
  • 1
    Sorry, your question is quite unclear. Please, provide an MWE, which reproduce your problem. BTW, all what can be done by tabular can be done with tblr too.
    – Zarko
    Commented Feb 23, 2022 at 17:47
  • @Zarko This is not about the tabular or tblr but rather about latexindent which is perl script for indenting your latex document. There is no real MWE because the perl-script works on the .tex-file. Commented Feb 23, 2022 at 19:04
  • Sorry, it seems that your perl script is hard coded for tabular. You need to ask how to change it that be more versatile. What is benefit to use latextindent?
    – Zarko
    Commented Feb 23, 2022 at 19:11
  • @Zarko Well I am using VS Codium as an IDE for LaTeX and I have a shortcut to automatically use latexindent. It just indents the whole document to the standard indentation and is useful for alignment in e.g. align environments or tabulars. It is more of a convenience thing that I can press a shortcut and the document is ‚cleaned up‘ in the source code. Commented Feb 23, 2022 at 19:16
  • 2
    this may be a related question: tex.stackexchange.com/questions/568637/…
    – L.J.R.
    Commented Feb 23, 2022 at 23:23

1 Answer 1

2

As of V3.16 this is default settings, so need for user configuration. You can still use the file below, it won't break anything but isn't necessary.

We need to tell latexindent.pl to look for alignment delimiters in the tblr, as detailed in https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html#lst-aligndelims-advanced

We employ the following YAML file, say martin.yaml:

lookForAlignDelims:
   tblr: 1

and then we run

latexindent.pl -l martin.yaml mwe.tex

All of this, and more including many examples, is detailed in the documentation.

1
  • As of V3.16 this is default settings, so need for user configuration
    – cmhughes
    Commented Mar 14, 2022 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .