![如何删除 longtable 中重复的 Hline?](https://linux22.com/image/425568/%E5%A6%82%E4%BD%95%E5%88%A0%E9%99%A4%20longtable%20%E4%B8%AD%E9%87%8D%E5%A4%8D%E7%9A%84%20Hline%EF%BC%9F.png)
代码是:
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}[htb]{p{0.22\linewidth}p{0.5\textwidth}p{.2\textwidth}}
\caption{my table}\\ \hline
\multicolumn{1}{c}{\textbf{Starting material}} &
\multicolumn{1}{c}{\textbf{Finding}} & \multicolumn{1}{c}{\textbf{Author}}\\ \hline
\endfirsthead
%\vspace{-0.5\baselineskip}
\caption[]{Continue}
\endhead \\ \hline
Silver nitrate (AgNO3) polyvinylpyrrolidone & \vspace{-0.6\baselineskip}
\begin{itemize}[noitemsep,labelsep=1ex,leftmargin=*,topsep=0pt,partopsep=0pt]%itemsep=-1ex, label
\item The structural analysis showed that synthesized material is face-centered cubic (fcc) and monodispersed within the PVP matrix with an average size of 22 nm.
\item The UV–vis spectrum of AgNPs in visible light region revealed that the peak at 406 nm is very broad, and significant absorption exists at >500 nm, all consistent with an aggregated silver solution.
\item The AgNPs film has good sensitivity in the range of 50–1200 ppm at room temperature accompanying increase of gas concentration and temperature.
\end{itemize} \vspace{-\baselineskip}& Kumar \\ \hline
e &r&s\\
\end{longtable}
\end{document}
答案1
您的代码片段有很多问题。正如@David Carlisle 指出的那样,您的问题是由行终止符的错误位置引起的\endfirsthead
(请参阅下面的 MWE)。其他问题主要是题外话,因为您没有提供 MWE(最小工作示例)一个我们可以测试的小而完整的文档文档。因此,我根据我编写表格的方式在您的代码片段中添加了序言:
\documentclass{article}
\usepackage{array, booktabs, % new
longtable,
makecell} % new
\renewcommand\theadfont{\normalsize\bfseries} % new
\renewcommand\theadgape{} % new
\usepackage[skip=1ex]{caption} % new
\usepackage[version=4]{mhchem} % new
\usepackage{siunitx} % new
\sisetup{range-phrase = -- ,
range-units = single}
\usepackage{enumitem} % new
\usepackage{etoolbox} % new
\AtBeginEnvironment{longtable}{% new
\setlist[itemize]{nosep,
leftmargin=*,
label=\textbullet,
before=\begin{minipage}[t]{\linewidth},
after=\end{minipage}}
\setlength\tabcolsep{3pt}
\usepackage{lipsum}% for generating dummy text in table
\begin{document}
\begin{longtable}{@{}
>{\raggedright\arraybackslash}p{\dimexpr 0.30\linewidth-\tabcolsep} % changed
>{\raggedright\arraybackslash}p{\dimexpr 0.50\textwidth-2\tabcolsep} % changed
>{\raggedright\arraybackslash}p{\dimexpr 0.20\textwidth-\tabcolsep} % changed
@{}}
\caption{My table}
\label{tab:longtable} \\
\toprule % changed
\thead{Starting\\ material} % changed
& \thead{Finding}
& \thead{Author} \\
\midrule
\endfirsthead
\caption[]{My table -- Continue} \\ % error was here
\toprule
\thead{Starting\\ material}
& \thead{Finding}
& \thead{Author} \\
\midrule
\addlinespace[-3pt]
\endhead
\multicolumn{3}{r}{\footnotesize\textit{Continue on the next page}} % new
\endfoot % new
\bottomrule % new
\endlastfoot % new
% table body
Silver nitrate (\ce{AgNO3}) polyvinylpyrrolidone
& \begin{itemize}
\item The structural analysis showed that synthesized material is face-centered cubic (fcc) and monodispersed within the PVP matrix with an average size of 22 nm.
\item The UV–vis spectrum of \ce{AgNPs} in visible light region revealed that the peak at \SI{406}{nm} is very broad, and significant absorption exists at \SI{>500}{nm}, all consistent with an aggregated silver solution.
\item The \ce{AgNPs} film has good sensitivity in the range of \SIrange{50}{1200}{ppm} at room temperature accompanying increase of gas concentration and temperature.
\end{itemize}
& Kumar \\
e & r & s \\
\addlinespace
e & \lipsum[11] & s \\
\end{longtable}
\end{document}
(红线表示页面布局)