奇怪的错误“缺失数字被视为零”

奇怪的错误“缺失数字被视为零”

我正在使用报告文档类准备博士论文。我正在使用 TexMaker。我不断收到此表的错误消息:

\documentclass[12pt,a4paper,onesided]{report}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage{amsfonts}
\usepackage{fixltx2e}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{tabu}
\usepackage{sectsty}
\sectionfont{\large}
    \subsectionfont{\normalsize}
\usepackage{caption}
    \captionsetup[figure]{labelfont=bf, textfont=bf}
    \captionsetup[table]{labelfont=bf, textfont=bf}
\setlength{\footnotesep}{\baselineskip}
\usepackage{textcomp}\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{float}
\usepackage{array}
    \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
    \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
    \makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 2pt
    \futurelet \reserved@a \@xhline}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother

\begin{document}

\begin{table}[ht!]
        \renewcommand{\arraystretch}{3.5}
        \small
        \begin{center}
        \caption{Alternate Wordings of the Survey, Fielded on Mechanical Turk.}
        \begin{tabulary}{1.1\textwidth}{|C|L|}
            \hline
            Alternate Version I & ``Would you support or oppose removing trade restrictions which would allow firms such as [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell their goods in the United States? (Note that all firms affected by such a policy would be highly similar to [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] in terms of their workforce characteristics.)''\\ \hline
        Alternate Version II & ``Would you support or oppose removing trade restrictions which would allow [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell its goods in the United States?''\\ \hline
        \end{tabulary}
        \end{center}
        \end{table}

错误消息指的是“\end{tabulary}”这一行,并指出:

! Missing number, treated as zero.
<to be read again>
|
l.346 \end{tabulary}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
|
l.346 \end{tabulary}
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

当我在较小的文档中构建此表格时,它工作正常,但在此文档中却不起作用。不知道该如何更改它。

提前致谢!

答案1

错误出现在以下两行

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

因为tabulary保留了LC列类型以满足其需要,而通过重新定义它们,包会感到困惑。

这是一个最小示例,仅包含所需的包。请注意,选项onesidedreport错误的;它被调用oneside并且是默认的。我不会将标题文本字体设置为粗体。

\documentclass[12pt,a4paper]{report}
\usepackage{tabulary}
\usepackage{caption}

\captionsetup[table]{labelfont=bf, textfont=bf}

\begin{document}

\begin{table}[ht!]
\centering\small

\caption{Alternate Wordings of the Survey, Fielded on Mechanical Turk.}

\begin{tabulary}{\textwidth}{|C|L|}
\hline
Alternate Version I & 
  ``Would you support or oppose removing trade restrictions which would allow 
  firms such as [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely 
  sell their goods in the United States? (Note that all firms affected by such a 
  policy would be highly similar to [\emph{Tuntyakore \& Zideying/Gordon \& 
  Roberts}] in terms of their workforce characteristics.)''\\
\hline
Alternate Version II & 
  ``Would you support or oppose removing trade restrictions which would allow 
  [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell its 
  goods in the United States?''\\
\hline
\end{tabulary}
\end{table}

\end{document}

在此处输入图片描述

相关内容