NiceTabular中Fatal Package nicematrix Error: Bad column type. Emergency stop.错误修改

发布于 2024-09-27 22:16:49

代码如下

\begin{NiceTabular}[c]{lSSSS}%
[code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
\toprule
\Block{2-1}{产品} \\n\Block{1-3}{维度 (cm)} & & &
\Block{2-1}{\rotate Price} \\n\cmidrule(rl){2-4}
& L & l & h \\n\midrule
小 & 3 & 5.5 & 1 & 30 \\n标准 & 5.5 & 8 & 1.5 & 50.5 \\n中间 & 8.5 & 10.5 & 2 & 80 \\n额外 & 8.5 & 10 & 1.5 & 85.5 \\n特别的 & 12 & 12 & 0.5 & 70 \\n\bottomrule
\end{NiceTabular}

错误Fatal Package nicematrix Error: Bad column type.
Emergency stop.
感觉没有错误?如何修改?

查看更多

关注者
0
被浏览
164
1 个回答
Sagittarius Rover
Sagittarius Rover 2024-09-28
不喜欢LaTeX!!!

虽然MWE还是不太规范,但至少你学会了围栏代码块语法...

似乎找到了你模仿的原文档代码,分析你的报错信息,提示Error: Bad column type,说明是S列格式 不能被识别,文档中写的很清楚,需要加载siunitx宏包...

另外 [code-before = ... ] 似乎是已经过时的接口,请关注最新版的nicematrix文档

image.png

下面才是正常的MWE(需要包含\documentclass\end{docuement}的全部内容啊不然怎么直接复制就能编译...)

\documentclass[12pt]{ctexart}
\usepackage{hyperref}
\usepackage{nicematrix}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}

\section{NiceMatrix}

\begin{NiceTabular}[c]{lSSSS}
  \CodeBefore
  \rowcolor{red!15}{1-2}
  \rowcolors{3}{blue!15}{}
  \Body
  \toprule
  \Block{2-1}{Product} &
  \Block{1-3}{dimensions (cm)} & & &
  \Block{2-1}{\rotate Price} \\
  \cmidrule(rl){2-4}
  & L & l & h \\
  \midrule
  small & 3 & 5.5 & 1 & 30 \\
  standard & 5.5 & 8 & 1.5 & 50.5 \\
  premium & 8.5 & 10.5 & 2 & 80 \\
  extra & 8.5 & 10 & 1.5 & 85.5 \\
  special & 12 & 12 & 0.5 & 70 \\
  \bottomrule
\end{NiceTabular}

\end{document}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览