I'm trying to use one longtable
in my thesis while all others are created with table
and tabular
environment.
I tried to find help visiting this link. But there only one type of table (longtable
) is used.
The first lines (between %
and %
) in my preamble are copied from the link above. If I don't use them the code works but at the same time there's no space between the \hline\hline
anymore. If I only use the longtable
or put the longtable
first, the code can be compiled.
But the order represented in this extract represents the order in my thesis.
If I don't use the colortbl
respectively xcolor
with the option table it works fine. But I don't know how I can color my rows without using this package. But I need the space between the two lines to separate different categories.
Thanks for your help.
\documentclass{article}
%
\usepackage{color}
\makeatletter
\let\xx@begindocumenthook\@begindocumenthook
\let\xxhline\hline
\let\xx@xhline\@xhline
\usepackage{colortbl}
\let\hline\xxhline
\let\@xhline\xx@xhline
\let\@begindocumenthook\xx@begindocumenthook
\makeatother
\usepackage{longtable}
%
\usepackage[table]{xcolor}
%
\usepackage{subcaption}
%
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{listings,color}
%
\begin{document}\color{black}
%
\begin{table}[H]
\centering
\begin{tabular}{|l|r|r|}
\hline
\rowcolor{lightgray}
\textbf{Component} & \multicolumn{1}{c|}{\textbf{Flight segment [\%]}} & \multicolumn{1}{c|}{\textbf{Passenger segment [\%]}} \\ \hline
1 & 20 & 80 \\ \hline \hline
2 & 10 & 90 \\ \hline
\end{tabular}
\caption{Caption 2}
\end{table}
%
\begin{center}
\begin{longtable}{|p{5cm}|c|p{4cm}|}
\hline
\rowcolor{lightgray}
\textbf{Mass component} & \multicolumn{1}{c|}{\textbf{Techfactor}} & \multicolumn{1}{c|}{\textbf{Reason}} \\ \hline
A lot of text & a lot of text & a lot of text \\ \hline
A lot of text & a lot of text & a lot of text \\ \hline
A lot of text & a lot of text & a lot of text \\ \hline \hline
A lot of text & a lot of text & a lot of text \\ \hline
A lot of text & a lot of text & a lot of text \\ \hline \hline
A lot of text & a lot of text & a lot of text \\ \hline
\caption{Caption 1}
\end{longtable}
\end{center}
%
Text text text.
%
%
\end{document}
Best Answer
\hline\hline
in a long table, then a simple solution would behhline{===}
(in the case of the table with three columns) from packagehhline
xcolor
paclage exclusively, which is supersede ofcolor
package and its optiontable
callscolortbl
;\begin{center} ... \end{center}
is superfluous;