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.
\begin{document}
and\end{document}
are missing, the backslash of thebegin{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.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 bothOverleaft
andVS Code
which seems to not explaining why this is happening...nicematrix
version used byOverleaf
: 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?nicematrix
andarydshln
introduced in version 6.25 ofnicematrix
. I will write a new version ofnicematrix
that solves that bug...