缺少数字,在 longtblr 中视为零?

缺少数字,在 longtblr 中视为零?

我尝试重现我在 中找到的表格tabularray,但它看起来并不像我预期的那样。我使用 Overleaf。

梅威瑟:

    \begin{document}
    
    \usepackage{tabularray}
    \UseTblrLibrary{booktabs, siunitx}
    \usepackage[skip=1ex, 
                font=small,
                labelfont=bf]{caption}
    
    \usepackage{longtable}
    
    \NewTblrTheme{fancy}{
    \SetTblrStyle{firsthead}{font=\bfseries}
    \SetTblrStyle{firstfoot}{fg=blue2}
    \SetTblrStyle{middlefoot}{\itshape}
    \SetTblrStyle{caption-tag}{red2}
    }
    
    %\begin{longtblr}[
    theme = fancy,
    caption = {Comparison between the difference in the computed electrostatic potential contribution ($\Delta \Psi$} and the difference in experimental relative current ($\Delta V_0.5$),
    label = {tblr:deltavalues},
    note{a} = {Both values are in milliVolt.},
    note{$\dag$} = {Both computational and experimental data in free-cAMP state.},
    remark{Note} = {Some general note. Some general note. Some general note.},
    ]{
    colspec = {XXX}, width = 0.75\linewidth,
    rowhead = 1, rowfoot = 1,
    row{odd} = {gray9}, row{even} = {brown9},
    row{2-5} = {blue}, row{Z} = {blue7},
    }
    \hline
    Mutations & Computed $\Delta \Psi$ & Experimental $\Delta V_0.5$ \\
    \hline
    D244A & -6.3 & -5.9 \\
    \hline
    D244K & -12.9 & -6.8 \\
    \hline
    E247A & -15 & -13.4 \\
    \hline
    E247R & -34.8 & -5.7 \\
    \hline
    K464A & 7 & 8.9 \\
    \hline
    K464E & 14.4 & 22.8 \\
    \hline
    K472A & 1.5 & 14.7 \\
    \hline
    K472E & 3.6 & 19.6
    \hline
    M155A & 0.4 & 1.9 \\
    \hline
    M155E & 13.4 & 13.7 \\
    \hline
    M155R & -15.3 & -3 \\
    \hline
    Q539A & 0.3 & -1.8 \\
    \hline
    R470E & 16.6 & 0.3 \\
    \end{longtblr}
    
    end{document}

错误是:

缺失数字,视为零

答案1

  • 您的代码片段编写得非常糟糕。它包含许多错误,例如在之后加载包begin{document}、注释掉代码的重要部分等。
  • longtblr如果你的表只有 14 行,一页可以放得下,那为什么要使用?你应该考虑talltblr环境。
  • Overleaf 仍安装了一个相当老版本的tabularray软件包 (2021L),其中没有定义XYZ数字。要使用它们,您应该向 Overleaf 寻求帮助,了解如何在本地加载最新版本的软件包tabularray(2022A)。

由更正的代码片段组成的 MWE,可以与最近的tabularray软件包配合使用,并且包含一些小的设计更改(字体颜色、两行列标题、垂直居中列标题、S在第二列和第三列中使用列进行数字格式化:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage[skip=1ex,
            font=small,
            labelfont=bf]{caption}

\begin{document}
{
\NewTblrTheme{fancy}{
\SetTblrStyle{firsthead}{font=\bfseries}
\SetTblrStyle{firstfoot}{fg=blue2}
\SetTblrStyle{middlefoot}{\itshape}
\SetTblrStyle{caption-tag}{red2}
                    }
\begin{longtblr}[
  theme = fancy,
caption = {Comparison between the difference in the computed electrostatic potential contribution ($\Delta\Psi$) and the difference in experimental relative current ($\Delta V_{0.5}$)},
  label = {tblr:deltavalues},
note{a} = {Both values are in milliVolt.},
note{$\dag$} = {Both computational and experimental data in free-cAMP state.},
remark{Note} = {Some general note. Some general note. Some general note.},
                ]{
    width = 0.75\linewidth,
    hlines,
    colspec = {X[l] *{2}{X[c, m, si={table-format=-2.1}]}}, 
    rowhead = 1, 
    rowfoot = 1,
     row{odd} = {bg=gray9}, 
    row{even} = {bg=brown9},
     row{2-5} = {bg=blue, fg=white}, 
       row{Z} = {fg=blue},
                }
Mutations   & {{{Computed\\ $\Delta\Psi$}}} 
                        & {{{Experimental\\ $\Delta V_{0.5}$}}} \\
D244A       &  -6.3     &  -5.9     \\
D244K       & -12.9     &  -6.8     \\
E247A       & -15       & -13.4     \\
E247R       & -34.8     &  -5.7     \\
K464A       &   7       &   8.9     \\
K464E       &  14.4     &  22.8     \\
K472A       &   1.5     &  14.7     \\
K472E       &   3.6     &  19.6     \\
M155A       &   0.4     &   1.9     \\
M155E       &  13.4     &  13.7     \\
M155R       & -15.3     &  -3       \\
Q539A       &   0.3     &  -1.8     \\
R470E       &  16.6     &   0.3     \\
\end{longtblr}
}
\end{document}

它给:

在此处输入图片描述

相关内容