Overleaf 与 VS Code 表不兼容

Overleaf 与 VS Code 表不兼容

大家好,我对 LaTeX 还不太熟悉;因此,我的代码可能不是最高效的,但它可以完成工作。到目前为止,我一直在工作和试验,但Overleaft我将本地环境(VS Code + MikTeX)放在一边以保留我的项目副本。
一切似乎都运行良好,但我有一个用构建的表格,\usepackage{nicematrix}它可以打印/构建,Overleaf但不能VS Code。特别是,我收到以下消息:

额外的对齐标签已更改为 \cr

这是我正在使用的代码:

\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}

现在,我了解了问题的根源,但无法调试它,因为在 中Overleaf,我认为它更具弹性,脚本运行良好。如果有人更有经验并且对这些问题有更好的洞察力,那就太好了!
提前谢谢。

答案1

的最新版本(2023-11-22 的 v. 6.26)解决了和nicematrix之间的不兼容性(但是,提供了绘制虚线规则的工具,因此不建议与一起使用)。nicematrixarydshlnnicematrixnicematrixarydshln

相关内容