表格 - 缺失数字 - 视为零

表格 - 缺失数字 - 视为零

我确实明白缺失数字的错误出在哪里:Missing number, treated as zero. \end{tabulary}

\documentclass[a4paper,11pt]{article}
\usepackage{hyperref}
\usepackage{fontspec}
\usepackage[english, ngerman]{babel}
\usepackage{soul} % for strikethrought
\usepackage{xcolor} % for highlighting
\usepackage{booktabs} % for rules within a table
\usepackage{tabulary} % for tables with long lines
\begin{document}
\subsection{Basic HTML Table}
\begin{table}[ht]
\centering
\begin{tabulary}{\linewidth}{ C  C  C }
\toprule
\textbf{Firstname} & \textbf{Lastname} & \textbf{Age} \\
\midrule
Jill & Smith & 50 \\
\midrule
Eve & Jackson & 94 \\
\midrule
John & Doe & 80 \\
\midrule
\bottomrule
\end{tabulary}
\end{table}

%second table
Table with mulitple cols \hl{in the header}: 
\begin{table}[ht]
\centering
\begin{tabulary}{\linewidth}{ C  C  C }
\toprule
\textbf{Name} & \multicolumn{2}{ C }{\textbf{Telephone}} \\
\midrule
Bill Gates & 55577854 & 55577855 \\
\midrule
\bottomrule
\end{tabulary}
\end{table}
\end{document}

有什么想法吗?如果我删除第一个表,整个事情会变得更糟,因为它会报告Undefined control sequence. \end{tabulary}

答案1

在第二个表中,只需\multicolumn{2}{ C }{...}改为\multicolumn{2}{c}{...}

这将给你:

在此处输入图片描述

相关内容