texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.85k stars 346 forks source link

Tabularray tables are not parsed correctly #3831

Closed jcasale closed 1 month ago

jcasale commented 1 month ago

Environment

Expected behavior

Tabularray tables are parsed correctly without reporting erroneous missing columns, and they can be aligned automatically.

Actual behavior

The following code triggers a missing column inspection on the newline marks and adds an invalid empty column when aligned.

Adding a linebreak after the colspec definition fixes the automatic alignment, but the inspection is not resolved.

\documentclass[letterpaper]{article}

\usepackage[sfdefault]{roboto}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=0.5in,right=0.5in,top=0.5in,bottom=0.65in]{geometry}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{colspec = {Q[1,r,m]Q[1,l,m]},width = 0.4\linewidth,column{1} = {font=\bfseries}}
  Row 1 & Value 1 \\
  Row 2 & Value 2 \\
  Row 3 & Value 3 \\
  Row 4 & Value 4 \\
  Row 5 & Value 5 \\
  Row 6 & Value 6
\end{tblr}

\end{document}

How to reproduce

Open the above code in TexStudio:

  1. Notice the invalid columns inspection is triggered
  2. Automatically align it, and notice the extra column added
  3. Undo the above and add a line break after the colspec:
    \begin{tblr}{colspec = {Q[1,r,m]Q[1,l,m]},
        width = 0.4\linewidth,column{1} = {font=\bfseries}}
      Row 1 & Value 1 \\
      Row 2 & Value 2 \\
      Row 3 & Value 3 \\
      Row 4 & Value 4 \\
      Row 5 & Value 5 \\
      Row 6 & Value 6
    \end{tblr}
  4. Automatically align it, and notice no extra column is added
  5. The inspection is still triggered Screenshot 2024-10-05 100307