1

Hi there I'm fairly new to LaTeX; hence, my code might not be the most efficient and effective but it gets the job done. So far, I've been working and experimenting in Overleaft but I'm setting on the side my local environment (VS Code + MikTeX) to keep a copy of my projects.
Everything seems to be working just fine but I have a table built with \usepackage{nicematrix} that gets printed/built in Overleaf but not in VS Code. In particular, I'm prompted the following message:

Extra alignment tab has been changed to \cr

This is the code I'm using:

\documentclass[11pt]{article}

\usepackage[letterpaper,margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{longtable}
\usepackage{verbatim} %comments multiple lines

\usepackage{nicematrix} %forces v-line contiguity
\usepackage{multirow} %allows for multirow tables
\usepackage{booktabs} %allowas for proper v&h spacing in a table
\usepackage{amsmath} %could be used to set table high and width
\usepackage{diagbox} %single cell diagonal line
\usepackage{array} %set specific tables' rules
\usepackage{float} %object to the right place

\usepackage{hyperref}
\usepackage{xurl} % Line breaks for urls

\usepackage{caption}
\usepackage{subcaption}
\captionsetup[table]{font=small}
\captionsetup[table]{name=Supplementary Table}
\captionsetup[figure]{font=small}
\captionsetup[figure]{name=Supplementary Figure}

%%line editing package and function
\usepackage{arydshln}

\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline
}

\usepackage{xcolor}

\usepackage{graphicx} % Required for inserting images
\usepackage[inkscapearea=page]{svg} 
\usepackage{pdflscape}

\usepackage[nottoc]{tocbibind}

\newcommand{\set}[1]{\{ #1 \}}

\begin{document}

\begin{table}[H]
\centering
\caption{\textbf{Item's description}. Caption}
\label{table:label}
\resizebox{\textwidth}{!}{\begin{NiceTabular}{l|ccc|ccc}
\thickhline
\hline
\multicolumn{7}{c}{\textbf{graph 1}} \\
\thickhline
\Block[fill=white]{2-1}{\diagbox{GRAPH}{METRIC}} 
& \multicolumn{3}{c}{tool1} & \multicolumn{3}{c}{tool2} \\
\cdashline{2-7}[.4pt/1pt]
& \textit{recall} & \textit{precision} & \textit{F1} & \textit{recall} & \textit{precision} & \textit{F1} \\
\hline
a & 1 & 1 & 1 & 1 & 1 & 1 \\
b & 2 & 2 & 2 & 2 & 2 & 2 \\
c & 3 & 3 & 3 & 3 & 3 & 3 \\
\hdashline
d & 4 & 4 & 4 & 4 & 4 & 4 \\
e & 5 & 5 & 5 & 5 & 5 & 5 \\
f & 6 & 6 & 6 & 6 & 6 & 6 \\
g & 7 & 7 & 7 & 7 & 7 & 7 \\
\hdashline
h & 8 & 8 & 8 & 8 & 8 & 8 \\\hline
\hline
\thickhline
\hline
\multicolumn{7}{c}{\textbf{graph 2}} \\
\thickhline
\Block[fill=white]{2-1}{\diagbox{GRAPH}{METRIC}} 
& \multicolumn{3}{c}{tool1} & \multicolumn{3}{c}{tool2} \\
\cdashline{2-7}[.4pt/1pt]
& \textit{recall} & \textit{precision} & \textit{F1} & \textit{recall} & \textit{precision} & \textit{F1} \\
\hline
a & 1 & 1 & 1 & 1 & 1 & 1 \\
b & 2 & 2 & 2 & 2 & 2 & 2 \\
c & 3 & 3 & 3 & 3 & 3 & 3 \\
\hdashline
d & 4 & 4 & 4 & 4 & 4 & 4 \\
e & 5 & 5 & 5 & 5 & 5 & 5 \\
f & 6 & 6 & 6 & 6 & 6 & 6 \\
g & 7 & 7 & 7 & 7 & 7 & 7 \\
\hdashline
h & 8 & 8 & 8 & 8 & 8 & 8 \\\hline
\thickhline
\end{NiceTabular}}
\end{table}

\end{document}

Now, I understand the source of the problem but cannot debug it since in Overleaf, which I assume is more resilient, the script works just fine. If someone with more experience and a better eye for these issues could help will be great!
Thanks in advance.

11
  • 1
    I don't think, that the shown code compiles at Overleaf without errors, because \begin{document} and \end{document} are missing, the backslash of the begin{table} is missing, several \Block do not end (missing }) etc. So you first should correct all these errors. Note: Even if Overleaf shows a PDF, which seems to be correct, you should always correct all errors, because otherwise you will never be sure, that the PDF is really correct.
    – cabohah
    Commented Nov 20, 2023 at 11:17
  • Thanks @cabohah, I fixed what you mentioned and tried in Overleaf and works as expected. Apologies, I copy pasted without double-checking everything was correct and missed out on those, sorry again. However, the documents are exactly the same in both Overleaft and VS Code which seems to not explaining why this is happening...
    – Matteo
    Commented Nov 20, 2023 at 11:43
  • vscode is just the editor what matters is the version of packages in use. show the nicematrix version number as printed in the logs at overleaf and your local machine, your example gives an error in texlive 2023 but not texlive 2022 Commented Nov 20, 2023 at 11:53
  • @DavidCarlisle, thanks for pointing me in the right direction. If I'm not wrong this is the nicematrix version used by Overleaf: Package: nicematrix 2023/06/30 v6.20a Enhanced arrays with the help of PGF/TikZ. I assume I need to have the exact same one in MikTeX?
    – Matteo
    Commented Nov 20, 2023 at 11:57
  • 1
    This is an incompatibility between nicematrix and arydshln introduced in version 6.25 of nicematrix. I will write a new version of nicematrix that solves that bug... Commented Nov 20, 2023 at 14:45

1 Answer 1

2

The last version of nicematrix (v. 6.26 of 2023-11-22) solves that incompatibility between nicematrix and arydshln (however, nicematrix provides tools to draw dashed rules and, therefore, it is not recommended to use nicematrix in conjunction with arydshln).

1
  • Much appreciated @F. Pantigny. I saw your update was uploaded yesterday on CTAN. Once available on MikTex I will download it for sure! In the meantime, I also looked at the options provided by nicematrix itself. Thanks again!
    – Matteo
    Commented Nov 23, 2023 at 12:44

You must log in to answer this question.

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