我正在使用 Excel2Latex 创建表格,但出现以下错误:!未定义的控制序列。
我已经安装了 multirow 和 multicol 包,非常感谢您的帮助。
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{|r|l|c|}
\hline
\multicolumn{1}{|c|}{\textbf{Artículo}} & \multicolumn{1}{c|}{\textbf{Autor}} & \textbf{Año} \bigstrut\\
\hline
1 & \cite{Croxton2003} & \checkmark \bigstrut\\
\hline
2 & Ballou & \checkmark \bigstrut\\
\hline
3 & Kalkowski & \checkmark \bigstrut\\
\hline
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
答案1
bigstrut
只要您使用包(用于同名命令)和amssymb
(用于命令),您的示例代码就可以完美运行。\checkmark
除了表 1(基本上是问题中的表)之外,我还添加了两个替代方案。在表 2 中,我使用了包makecell
以避免重复\bigstrut
命令以及\multicolumn{1}{|c|}{\textbf...}
。在表 3 中,我删除了所有垂直线,并用包中的线替换了水平线booktabs
。
\documentclass{article}
%% Used for all tables %%
\usepackage{amssymb}
%% only for table 1 %%
\usepackage{bigstrut}
%% only for table 2 and 3 %%
\usepackage{makecell}
\renewcommand{\theadfont}{\bfseries\normalsize}
\setcellgapes{3pt}
%% only for table 3 %%
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{|r|l|c|}
\hline
\multicolumn{1}{|c|}{\textbf{Artículo}} & \multicolumn{1}{c|}{\textbf{Autor}} & \textbf{Año} \bigstrut\\
\hline
1 & \cite{Croxton2003} & \checkmark \bigstrut\\
\hline
2 & Ballou & \checkmark \bigstrut\\
\hline
3 & Kalkowski & \checkmark \bigstrut\\
\hline
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\begin{table}[htbp]
\makegapedcells
\centering
\caption{with the help of the makecell package}
\begin{tabular}{|r|l|c|}
\hline
\thead{Artículo} & \thead{Autor} & \thead{Año} \\
\hline
1 & \cite{Croxton2003} & \checkmark \\
\hline
2 & Ballou & \checkmark \\
\hline
3 & Kalkowski & \checkmark \\
\hline
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\begin{table}[htbp]
\renewcommand{\theadfont}{\normalsize}
\centering
\caption{with the help of the booktabs package}
\begin{tabular}{llc}
\toprule
\thead{Artículo} & \thead{Autor} & \thead{Año} \\
\midrule
1 & \cite{Croxton2003} & \checkmark \\
2 & Ballou & \checkmark \\
3 & Kalkowski & \checkmark \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\end{document}