我使用 Excel2LaTeX 在 LaTeX 中创建了一个表格,但以下代码却给出了错误。
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{rrrrr}
\toprule
& & Start date & End date & Days spent \\
\midrule
\multicolumn{1}{c}{\multirow{6}[12]{*}{\textbf{Background research}}} & Research which existing technologies exist for recommendation systems & 06/10/2011 & 10/10/2011 & \multicolumn{1}{c}{\multirow{6}[12]{*}{22}} \\
\multicolumn{1}{c}{} & Investigate the problems being face by the current recommender systems & 11/10/2011 & 15/10/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Learn what Semantic Web is and how the it is being implemented to solve problems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Investigate how semantic web is being used for recommendation systems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Read research papers on to find out more on work about music recommendation that has already been done in the past & 21/10/2011 & 27/10/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Deliverable: Write a literature survey to summarize research findings & 21/10/2011 & 28/10/2011 & \multicolumn{1}{c}{} \\
\multicolumn{5}{r}{} & \\
\multicolumn{1}{c}{\multirow{4}[8]{*}{\textbf{Analysis \& Design}}} & Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{6}} \\
\multicolumn{1}{c}{} & Deliverable produced: Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Begin prototyping and experimenting with Semantic Web & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{34}} \\
\multicolumn{1}{c}{} & Deliverable produced: A basic prototype of the recommender system & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{} \\
\multicolumn{5}{r}{} & \\
\multicolumn{1}{c}{\multirow{21}[42]{*}{\textbf{Implementation}}} & \textbf{Iteration 1 - Implementing and testing core functionality of the website} & & & \\
\multicolumn{1}{c}{} & Let users register with the website & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{\multirow{7}[14]{*}{34}} \\
\multicolumn{1}{c}{} & Simulate users listening to songs/albums & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Enable searching for music and playlists in the website & 17/12/2011 & 23/12/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Let users create playlists and add/remove songs to them & 24/12/2011 & 30/12/2011 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Users can integrate with Facebook and find friends that are also registered on the website & 31/12/2011 & 06/01/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Users can comment on a playlist and Like a playlist & 07/01/2012 & 13/01/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Deliverable produced: The first iteration of the website without a recommendation system & 10/12/2011 & 13/01/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & \multicolumn{4}{r}{} & \\
\multicolumn{1}{c}{} & \textbf{Iteration 2 - Implemented and testing core functionality of the algorithm} & & & \\
\multicolumn{1}{c}{} & Integrate Semantic Web so that recommendation algorithm can be implemented & 14/01/2012 & 20/01/2012 & \multicolumn{1}{c}{\multirow{5}[10]{*}{27}} \\
\multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the friend’s taste & 21/01/2012 & 03/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the user’s taste & 21/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Deliverables produced: Algorithm for music recommendation & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Second iteration of the website with core functionality in place & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & \multicolumn{4}{r}{} & \\
\multicolumn{1}{c}{} & \textbf{Iteration 3 - Adding additional features (Could have's and Wont have's in the requirements)} & & & \\
\multicolumn{1}{c}{} & Carry out the finishing touches of the website & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{\multirow{4}[8]{*}{13}} \\
\multicolumn{1}{c}{} & View a feed which lets them find out what their friends are doing on the site through likes and comments & 11/02/2012 & 17/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Allow users to subscribe to a playlist & 18/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{1}{c}{} & Deliverable: Final version of the website with added features & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\
\multicolumn{5}{r}{} & \\
\multicolumn{1}{c}{\multirow{2}[3]{*}{\textbf{Documentation}}} & Begin the final report & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{\multirow{2}[3]{*}{34}} \\
\multicolumn{1}{c}{} & Deliverable: Final report with explaining all stages of the software development cycle & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{} \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
我得到的错误是这样的
! Extra alignment tab has been changed to \cr.
<template> \endtemplate
l.692 \multicolumn{5}{r}{} &
\\
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
有人知道发生了什么事吗?
答案1
您有 5 列
{rrrrr}
但是你有
\multicolumn{5}{r}{} & \\
所以这是 5 列跨度,然后是一个空单元格,所以是 6 列,
最简单的方法是在顶部添加一个额外的 r,这样就声明了 6 列。
答案2
这是一个已知错误excel2latex
,该问题将在 3.2 版本中修复(目前正在开发中)。访问https://code.launchpad.net/excel2latex获取版本更新。