2

I'm making a table with threeparttablex and longtable packages.

When I use caption, I get an error with \hline and \thead commands. So, I had to disable the three following lines. But I need these lines, mainly, the \thead command, by my school standards (please, see Vertical alignment in tabular cells with variable height 4).

Could I to use caption, and besides \hline and \thead?

I must to put a footnote in the caption. The table size is of several pages.

This thread explains the solution to a similar issue: bottomrule not working in a self-made environment, but I don't know to adapt it to my trouble.

Please, excuse me by my English.

Thank you very much.

\documentclass[letterpaper,12pt,oneside]{report}

\usepackage{appendix}
\usepackage[american]{babel} 
\usepackage{caption}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{pdflscape} 
\usepackage[para]{threeparttablex}
\usepackage{titletoc}

\renewcommand\theadset{\renewcommand\arraystretch{1}
\setlength\extrarowheight{0pt}}
\renewcommand\theadfont{\normalsize}

\begin{document}
\begin{appendices}
\begin{landscape}
\chapter{Calculos detallados de factibilidad economica de alternativa 2 (SIR)} 

\begingroup
\begin{ThreePartTable}
\begin{longtable} {| r | r | r | r | c | r | l |} 
\caption[table]{Estimacion de costos de desarrollo de SIR \tnote{a}}
%\hline
%\thead{Descripcion} & \thead{Cantidad} & \thead{Unidad} & \thead{Duracion,\\sem.} & \thead{Costo unit.,\\Bs./ud.} & \thead{Costo renglon,\\Bs.} & \thead{Observacion} \\
%\hline
\endhead
\multicolumn{7}{r}{(continua)}
\endfoot
\hline
\endlastfoot

\multicolumn{7}{|l|}{COSTOS DE PERSONAL \tnote{b}}\\ \hline
Analistas         & 2 & empleado & 10  & 8.500/sem & 170.000    & \\ \hline
Disenadores       & 2 & empleado & 11  & 8.500/sem & 187.000    & \\ \hline
Programadores     & 2 & empleado & 6   & 8.500/sem & 102.000    & Codificacion  \\ \hline
Funcionarios      & 2 & empleado & 26  & 8.500/sem & 34.000     & Informacion   \\ \hline
Tecnicos de redes & 6 & empleado & 3   & 7.500/sem & 135.000    & \\ \hline
Viaticos          & 7 & gira     & --- & 35.000    & 245.000    & Para redes \\ \hline
Capacitacion      & 1 & curso    & --- & 0         & 0          & Cuso gratuito  \\ \hline
\multicolumn{7}{|l|}{COSTOS DE \emph{HARDWARE}}\\ \hline
Equipos A           & 100 & maquina & --- & 100.000 & 10.000.000  & Equipo \\ \hline
Equipos B           & 70  & maquina & --- & 30.000  & 2.100.000   & Recuperados \\ \hline
Servidor            & 1   & maquina & --- & 650.000 & 650.000     &  \\ \hline
Impresoras          & 35  & maquina & --- & 40.000  & 1.400.000   &  \\ \hline
Detect. biometricos & 32  & maquina & --- & 90.000  & 2.880.000   &  \\ \hline
\end{longtable}

\begin{tablenotes}
\item[a] Datos obtenidos el 15/12/2015.
\item[b] Se consideran bono de alimentacion y un incremento de 30 \% en el sueldo por prestaciones sociales.
\end{tablenotes}

\end{ThreePartTable}
\endgroup

\end{landscape}
\end{appendices}
\end{document} 

Page 1 Page 2

3
  • 3
    You're missing \\ at the end of the \caption line.
    – egreg
    Commented Dec 22, 2015 at 23:20
  • Dear egreg, thank you very much for your soon and useful help. It's solved. Dear Christian Hupfer, thanks by the edit suggestions. Commented Dec 22, 2015 at 23:38
  • 1
    Also, remove \hline before \endlastfoot
    – egreg
    Commented Dec 22, 2015 at 23:42

1 Answer 1

2

You need \\ at the end of the \caption line. Also \hline should be removed before \endlastfoot.

\documentclass[letterpaper,12pt,oneside]{report}

\usepackage{appendix}
\usepackage[american]{babel} 
\usepackage{caption}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{pdflscape} 
\usepackage[para]{threeparttablex}
\usepackage{titletoc}

\renewcommand\theadset{\renewcommand\arraystretch{1}
\setlength\extrarowheight{0pt}}
\renewcommand\theadfont{\normalsize}

\begin{document}
\begin{appendices}
\begin{landscape}
\chapter{Calculos detallados de factibilidad economica de alternativa 2 (SIR)} 

\begingroup
\begin{ThreePartTable}
\begin{longtable} {| r | r | r | r | c | r | l |} 
\caption[table]{Estimacion de costos de desarrollo de SIR \tnote{a}} \\
\hline
\thead{Descripcion} & \thead{Cantidad} & \thead{Unidad} & \thead{Duracion,\\sem.} & \thead{Costo unit.,\\Bs./ud.} & \thead{Costo renglon,\\Bs.} & \thead{Observacion} \\
\hline
\endhead
\multicolumn{7}{r}{(continua)}
\endfoot
%\hline
\endlastfoot

\multicolumn{7}{|l|}{COSTOS DE PERSONAL \tnote{b}}\\ \hline
Analistas         & 2 & empleado & 10  & 8.500/sem & 170.000    & \\ \hline
Disenadores       & 2 & empleado & 11  & 8.500/sem & 187.000    & \\ \hline
Programadores     & 2 & empleado & 6   & 8.500/sem & 102.000    & Codificacion  \\ \hline
Funcionarios      & 2 & empleado & 26  & 8.500/sem & 34.000     & Informacion   \\ \hline
Tecnicos de redes & 6 & empleado & 3   & 7.500/sem & 135.000    & \\ \hline
Viaticos          & 7 & gira     & --- & 35.000    & 245.000    & Para redes \\ \hline
Capacitacion      & 1 & curso    & --- & 0         & 0          & Cuso gratuito  \\ \hline
\multicolumn{7}{|l|}{COSTOS DE \emph{HARDWARE}}\\ \hline
Equipos A           & 100 & maquina & --- & 100.000 & 10.000.000  & Equipo \\ \hline
Equipos B           & 70  & maquina & --- & 30.000  & 2.100.000   & Recuperados \\ \hline
Servidor            & 1   & maquina & --- & 650.000 & 650.000     &  \\ \hline
Impresoras          & 35  & maquina & --- & 40.000  & 1.400.000   &  \\ \hline
Detect. biometricos & 32  & maquina & --- & 90.000  & 2.880.000   &  \\ \hline
\end{longtable}

\begin{tablenotes}
\item[a] Datos obtenidos el 15/12/2015.
\item[b] Se consideran bono de alimentacion y un incremento de 30 \% en el sueldo por prestaciones sociales.
\end{tablenotes}

\end{ThreePartTable}
\endgroup

\end{landscape}
\end{appendices}
\end{document} 

enter image description here

Here's a different realization with booktabs. The first column should be left aligned, I also set the internal divisions centered and the third column center aligned.

\documentclass[letterpaper,12pt,oneside]{report}

\usepackage{appendix}
\usepackage[american]{babel} 
\usepackage{caption}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{pdflscape} 
\usepackage[para]{threeparttablex}
\usepackage{titletoc}
\usepackage{booktabs}

\renewcommand\theadset{\renewcommand\arraystretch{1}
\setlength\extrarowheight{0pt}}
\renewcommand\theadfont{\normalsize}

\begin{document}
\begin{appendices}
\begin{landscape}
\chapter{Calculos detallados de factibilidad economica de alternativa 2 (SIR)} 

\begingroup
\begin{ThreePartTable}
\begin{longtable} {@{}l r c r c r l@{}} 
\caption[table]{Estimacion de costos de desarrollo de SIR \tnote{a}} \\
\toprule
\thead[l]{Descripcion} & \thead{Cantidad} & \thead{Unidad} & \thead{Duracion,\\sem.} & \thead{Costo unit.,\\Bs./ud.} & \thead{Costo renglon,\\Bs.} & \thead{Observacion} \\
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{7}{r}{(continua)}
\endfoot
\bottomrule
\endlastfoot

\multicolumn{7}{c}{COSTOS DE PERSONAL \tnote{b}}\\ \midrule
Analistas         & 2 & empleado & 10  & 8.500/sem & 170.000    & \\
Disenadores       & 2 & empleado & 11  & 8.500/sem & 187.000    & \\
Programadores     & 2 & empleado & 6   & 8.500/sem & 102.000    & Codificacion  \\
Funcionarios      & 2 & empleado & 26  & 8.500/sem & 34.000     & Informacion   \\
Tecnicos de redes & 6 & empleado & 3   & 7.500/sem & 135.000    & \\
Viaticos          & 7 & gira     & --- & 35.000    & 245.000    & Para redes \\
Capacitacion      & 1 & curso    & --- & 0         & 0          & Cuso gratuito  \\
\midrule
\multicolumn{7}{c}{COSTOS DE \emph{HARDWARE}}\\ \midrule
Equipos A           & 100 & maquina & --- & 100.000 & 10.000.000  & Equipo \\
Equipos B           & 70  & maquina & --- & 30.000  & 2.100.000   & Recuperados \\
Servidor            & 1   & maquina & --- & 650.000 & 650.000     &  \\
Impresoras          & 35  & maquina & --- & 40.000  & 1.400.000   &  \\
Detect. biometricos & 32  & maquina & --- & 90.000  & 2.880.000   &  \\
\end{longtable}

\begin{tablenotes}
\item[a] Datos obtenidos el 15/12/2015.
\item[b] Se consideran bono de alimentacion y un incremento de 30 \% en el sueldo por prestaciones sociales.
\end{tablenotes}

\end{ThreePartTable}
\endgroup

\end{landscape}
\end{appendices}
\end{document} 

enter image description here

4
  • Dear egreg. Your table design is more formal, and easier to read. Thank you again. Commented Dec 23, 2015 at 10:34
  • Dear @egreg, If I supress the three last rows of COSTOS DE PERSONAL section, remaining: the page break matches with section break, and Commented Dec 23, 2015 at 21:01
  • @PabloJ.GonzálezMora Use \\* for line breaks where you don't want a page break.
    – egreg
    Commented Dec 23, 2015 at 21:03
  • Dear @egreg, If I supress the three last rows of COSTOS DE PERSONAL section, the page break matches with the section break, and I get a pair of lines. Must I to disable by hand the \midrule at these cases? Or it's feasible to setting it by latex code? (to avoid the by hand setting; my tables are more or less long; this is not a big trouble, however.) PD. Please, excuse me, because I sent the prior comment before it was ready. Thanks by \\* tip. Commented Dec 23, 2015 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .