TeX - LaTeX Asked by Ayad M. on May 6, 2021
When I write a longtable I get a double horizontal line as shown in pictute:
the code is :
documentclass{article}
usepackage{longtable}
begin{document}
begin{longtable}[htb]{p{0.22linewidth}p{0.5textwidth}p{.2textwidth}}
caption{my table} hline
multicolumn{1}{c}{textbf{Starting material}} &
multicolumn{1}{c}{textbf{Finding}} & multicolumn{1}{c}{textbf{Author}} hline
endfirsthead
%vspace{-0.5baselineskip}
caption[]{Continue}
endhead hline
Silver nitrate (AgNO3) polyvinylpyrrolidone & vspace{-0.6baselineskip}
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}
Your code fragment has many issues. As @David Carlisle noted, your problem is caused by wrong position of the line terminator after endfirsthead
(see MWE below). Other issues are mainly off-topic since you not provide MWE (Minimal Working Example) a small but complete document document, which we can test. Consequently I added preamble to your code fragment according to my way of writing tables:
documentclass{article}
usepackage{array, booktabs, % new
longtable,
makecell} % new
renewcommandtheadfont{normalsizebfseries} % new
renewcommandtheadgape{} % 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}}
setlengthtabcolsep{3pt}
usepackage{lipsum}% for generating dummy text in table
begin{document}
begin{longtable}{@{}
>{raggedrightarraybackslash}p{dimexpr 0.30linewidth-tabcolsep} % changed
>{raggedrightarraybackslash}p{dimexpr 0.50textwidth-2tabcolsep} % changed
>{raggedrightarraybackslash}p{dimexpr 0.20textwidth-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}{footnotesizetextit{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}
(red lines indicate page layout)
Answered by Zarko on May 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP