我自动生成了文档,但出现了错误。! Extra alignment tab has been changed to \cr.
我知道这个错误,但我不明白我的情况是为什么。下面是最简单的例子:
\documentclass{report}
\usepackage{fancybox,fancyhdr}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{fixltx2e}
\usepackage[normalem]{ulem}
\usepackage[left=72pt,right=72pt, top=72pt,bottom=72pt,bindingoffset=0cm]{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage[export]{adjustbox}
\newcolumntype{R}[2]{>{\raggedleft \arraybackslash \hspace{0pt}}{#2}{#1}}
\newcolumntype{L}[2]{>{\raggedright\arraybackslash}{#2}{#1}}
\newcolumntype{C}[2]{>{\center\arraybackslash}{#2}{#1}}
\fancyhead[C]{\noindent\sbox{0}{\parbox{\textwidth}{\noindent\begin{longtable}{c}Text\end{longtable}}}
\ifdim\dimexpr\ht0+\dp0<14pt
\dp0\dimexpr14pt-\ht0\fi
\makebox{\usebox{0}}\\}\begin{document}
\pagestyle{fancy}
\noindent\sbox{0}{\parbox{\textwidth}{
\noindent\begin{longtable}{L{\textwidth}{p}}list
\begin{itemize}
\item item
\end{itemize}
\end{longtable}}}
\ifdim\dimexpr\ht0+\dp0<240.44036697248pt
\dp0\dimexpr240.44036697248pt-\ht0\fi
\makebox{\usebox{0}}\\
\noindent\begin{longtable}{L{450mm}{p}}Love\\\end{longtable}
\begin{longtable}{p{90mm}R{40mm}{p}rc}
Own party & & Unscored \\ [10pt]
Own parties & & & \\ [10pt]
Entity that is contracting on our behalf \\{Which of our own parties is contracting on our behalf?}&{Unknown}&Unscored& \\ [10pt]
Reference name \\ {Reference name used to refer to the own party}&{Unknown}&Unscored& \\ [10pt]
\end{longtable}
\begin{longtable}{p{90mm}R{40mm}{p}rc}
Counterparties & & Unscored \\ [10pt]
Counterparty & & & \\ [10pt]
Reference name \\{Reference name used to refer to the counterparty}&{Unknown}&Unscored& \\ [10pt]
Counterparty identity\\{None provided}&{Unknown}&Unscored& \\[10pt]
Whether we are contracting with a company, branch, individual or some other kind of entity? \\ {The type of entity you are planning to contract with is really important when deciding whether the deal is appropriate. For example, you can hold a company to account for most contract terms it agrees to. But the same is not true when you are dealing with an individual - they might be able to get out of these terms even if they had signed up to them. }&{Unknown}&Unscored& \\[10pt]
Name of counterparty \\ {None provided}&{Unknown}&Unscored& \\[10pt]
\end{longtable}
\end{document}
当我删除部分文本(For example, you can hold a company
...)或从标题中删除 parbox 时,或从第一个 longtable 中删除 parbox 时,错误消失.....我不明白为什么会发生这种情况???如何在不删除文档部分内容的情况下修复错误?
你能向我解释一下这个案例中出了什么问题吗?
更新(由于评论):如果最后一张表看起来如此(没有最后\\
)在小的文本更改后它仍然不起作用:
\begin{longtable}{p{90mm}R{40mm}{p}rc}
Counterparties & & Unscored \\ \\
Counterparty & & & \\ \\
Reference name \\{Reference name used to refer to the counterparty}&{Unknown}&Unscored& \\ \\
Counterparty identity\\{None provided}&{Unknown}&Unscored& \\ \\
Whether we are contracting with a company, branch, individual or some other kind of entity? \\ {The type of entity you are planning to contract with is really important when deciding whether the deal is appropriate. For example, you can hold a company to account for most contract terms it agrees to. But the same is not true when you are dealing with an individual - they might be able to get out of these terms even if they had signed up to them. }&{Unknown}&Unscored& \\ \\
Name of counterparty \\ {None provided}&{Unknown}&Unscored& \\
\end{longtable}
\end{document}
答案1
不要使用\\ \\
。如果您需要更多空间,请使用类似\\[10pt]
在行后添加 10pt 的命令。当然,在标题定义中\fancyhead
使用tabular
和 _ 而不是longtable
。