使用分段命令,例如部分,小节在里面长桌产生以下错误:
! LaTeX Error: Something's wrong--perhaps a missing \item.
这是正常的吗?
以下是代码(使用 LyX 创建):
% Preview source code
%% LyX 1.6.7 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{longtable}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\usepackage{babel}
\begin{document}
\begin{longtable}{|>{\centering}p{0.3\textwidth}|>{\raggedright}p{0.4\textwidth}|}
\hline
\section*{Name} & \section*{Description}\tabularnewline
\hline
\hline
a & b
\tabularnewline
\hline
a & b
\tabularnewline
\hline
a & b
\tabularnewline
\hline
\end{longtable}
\end{document}
答案1
保护他们:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{0.3\textwidth}|p{0.4\textwidth}|}
\protect\section*{Name} & \protect\section*{Description}
\end{longtable}
\end{document}