Automatically restart longtable coloring on new page

I have a zebra-striped longtable such as the following:

documentclass{article}
usepackage[table]{xcolor}
usepackage{longtable}
usepackage{lipsum}

begin{document}

lipsum[9-13]

rowcolors{2}{white}{gray!25}
begin{longtable}{|m{2cm} m{1.5cm} m{1.5cm} m{1.5cm}|}
hline
& Value 1 & Value 2 & Value 3 \ endhead hline endfoot
Item & 0 & 0 & 0 \
Item & 0 & 0 & 0 \
Item & 1 & 0 & 0 \
Item & 2 & 0 & 0 \
Item & 3 & 0 & 0 \
Item & 4 & 0 & 0 \
end{longtable}

end{document}

How do I make the coloring restart automatically when the table wraps to a new page so I avoid cases like this where both the header and first row of the new page are white?

The first two rows are both white

Longtable with repeating headers and horizontal rules

I am trying to make a longtable, that has repeating headers. Also, each row has rules. In the second page, however, the rule repeats twice.It looks unpolished. How do I fix this?

MWE

documentclass[11pt, a4paper, oneside]{memoir}
usepackage{longtable}
usepackage{booktabs}
usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}

begin{document}
begin{longtable}{l} 
    toprule
    Title \ 
    midrule
    endfirsthead
    toprule
    Title \
    midrule
    endhead
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ hdashline
    D \ hdashline
    A \ hdashline
    B \ hdashline
    C \ bottomrule

end{longtable}
end{document}

enter image description here

enter image description here

The Economist too uses rules

Economist

How to control the width of longtable

That’s very strange why the sum of the width of each column does not equal the total width of longtable. I have two tables:

documentclass{article}

usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{amsthm}
usepackage{array}
usepackage{titletoc}
usepackage{verbatim}
usepackage{tikz}
usepackage{longtable}

begin{document}
textwidth 15.95cm
begin{center}
    begin{longtable}{
    |p{0.25cm}
    |p{4.6cm}
    |p{2 cm}
    |p{2.2cm}
    |p{0.8cm}
    |p{2.1cm}
    |p{1.9cm}|
    }
    multicolumn{7}{>{centering}p{textwidth}}{1
    }tabularnewlinehline
    a & a & a & a & a & a & a
    tabularnewlinehline
    end{longtable}
end{center}

begin{center}
    begin{longtable}{
    | >{centering}p{13cm}
    | >{raggedright}p{9.cm}
    | >{raggedright}p{2.42cm}
    | >{raggedright}p{2.42cm} |
    }
    multicolumn{4}{>{centering}p{textwidth}}{
    2
    }tabularnewlinehline
    a & a & a & a
    tabularnewlinehline
    end{longtable}
end{center}


end{docume

Two tables in the PDF exactly have same widths.

As marmot said the total width of a table should be

sum of columns + (n-1)*arraycolsep

And how to know the value of arraycolsep?

More generally, how to make all the tables in the PDF has same widths? And what’s the meaning of width textwidth in multicolumn{7}{>{centering}p{textwidth}}.

Moreover, when I decrease the width of some columns, the width of first line of table will decrease and the second line will not change; when I increase the width of some columns, both first and second lines will increase?

Longtable and tabular caption vertical and horizontal alignment

My problem is similar to this question, the caption alignment of tabular table and longtable is different. I would like to have the caption to be consistent with the tabular form, with some white padding from the top margin and align to the left of the toprule. I have tried to use [singlelinecheck=off] as suggested but it didn
t change anything. Then I want to try redefining the LT@caption as suggested as another way but I have no idea how to redefine it to make it as the tabular one.

I am guessing some of the problem may be related to my preset margin but it didn’t align correctly even when I remove the a4paper setting. Any help or insight would be highly appreciated. Thank you in advance!

documentclass{article}

usepackage{array}
usepackage{changepage}
usepackage[a4paper, vmargin=0.05cm, hmargin=0.1cm, marginparwidth=0.1cm,total={210mm,297mm}]{geometry}
usepackage{rotating}
usepackage[singlelinecheck=off]{caption}
usepackage{booktabs}
usepackage{pdflscape}
usepackage{multirow, makecell, xcolor}
usepackage[separate-uncertainty=true]{siunitx}
usepackage{threeparttable}
usepackage{threeparttablex} 
usepackage{longtable}


newlength{mylength} settowidth{mylength}{$-55.55pm0.55$}
makeatletter
newcommandnotsotiny{@setfontsizenotsotiny{6.5}{7.5}}
makeatother
newcommand{ts}[1]{textsubscript{#1}}

begin{document}    
begin{landscape}
    sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
    begin{ThreePartTable} 
        notsotiny
        setlength{tabcolsep}{2.3pt}
        setlength{extrarowheight}{2.2pt}
        begin{longtable}{>{itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
            caption{Taxon}\
                toprule
        multicolumn{2}{c}{Site} & multicolumn{2}{c}{WI} & multicolumn{2}{c}{WO} & multicolumn{2}{c}{SL} & multicolumn{2}{c}{SE} & multicolumn{2}{c}{EO} & multicolumn{2}{c}{EI} \
        cmidrule(lr){3-4} cmidrule(lr){5-6} cmidrule(lr){7-8} cmidrule(lr){9-10} cmidrule(lr){11-12} cmidrule(lr){13-14}
        multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {makebox[mylength]{Dry}} \
        midrule
        multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ pm$ SD $_{(n)}$} & {Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} \
        midrule
            endfirsthead
    multirow{2}{*}{shortstack[l]{{Genus}\ { Species}}}& $delta{^{15}}$N &       &       &       &       &       & 12.82pm0.36ts{(4)} &       &       & 13.83pm0.99ts{(8)} & 14.25pm0.49ts{(2)} & 14.60pm0.23ts{(4)} &  \
& $delta{^{13}}$C &       &       &       &       &       & -16.73pm0.29ts{(4)} &       &       & -16.62pm0.27ts{(8)} & -17.30pm0.14ts{(2)} & -16.65pm0.31ts{(4)} &  \
            bottomrule
        end{longtable}
        end{ThreePartTable}
    end{landscape}
    begin{landscape}
        sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
        centering
        begin{threeparttable} 
        notsotiny
        setlength{tabcolsep}{2.3pt}
        setlength{extrarowheight}{2.2pt}
        caption{Taxon}
        begin{tabular}{>{itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
        toprule
        multicolumn{2}{c}{Site} & multicolumn{2}{c}{WI} & multicolumn{2}{c}{WO} & multicolumn{2}{c}{SL} & multicolumn{2}{c}{SE} & multicolumn{2}{c}{EO} & multicolumn{2}{c}{EI} \
        cmidrule(lr){3-4} cmidrule(lr){5-6} cmidrule(lr){7-8} cmidrule(lr){9-10} cmidrule(lr){11-12} cmidrule(lr){13-14}
        multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {makebox[mylength]{Dry}} \
        midrule
        multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ pm$ SD $_{(n)}$} & {Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} &{Mean $ pm$ SD $_{(n)}$} \
        midrule
        multirow{2}{*}{shortstack[l]{{Genus}\ { Species}}}& $delta{^{15}}$N &       &       &       &       &       & 12.82pm0.36ts{(4)} &       &       & 13.83pm0.99ts{(8)} & 14.25pm0.49ts{(2)} & 14.60pm0.23ts{(4)} &  \
        & $delta{^{13}}$C &       &       &       &       &       & -16.73pm0.29ts{(4)} &       &       & -16.62pm0.27ts{(8)} & -17.30pm0.14ts{(2)} & -16.65pm0.31ts{(4)} &  \
        bottomrule
    end{tabular}
    end{threeparttable}
end{landscape}

end{document}

Longtable – Custom column width and no white spaces between lines

I used an updated version of the code by Mico (https://tex.stackexchange.com/a/271559/146754) to create a long table.

1) How can I remove the white spaces between the black lines
2) How can I assign custom widths for each column without loosing the vertical alignment

enter image description here

documentclass[final,10pt]{book}
usepackage{booktabs}
usepackage{longtable, array} % "array" is needed for "m" in longtable

usepackage[paperwidth=9in,paperheight=3in,right=0.5in,bottom=0in,left=0.2in]{geometry}

begin{document}
thispagestyle{empty}

begin{longtable}{@{} *{3}{|m{.30paperwidth}}| @{}}

toprule

textbf{Header 1} & textbf{Header 2} & textbf{Header 3} \
midrule[heavyrulewidth] % make this rule as thick as toprule
endhead

bottomrule
endfoot

1. Lorem ipsum dolor sit amet (c1, r1) & This is second column (c2, r1), line onenewline This is second column (c2, r1), line two & This is third column (c3, r1), line onenewline This is third column (c3, r1), line two \
midrule
2. Lorem ipsum dolor sit amet (c1, r2) & This is second column (c2, r2), line onenewline This is second column (c2, r2), line two & This is third column (c3, r2), line onenewline This is third column (c3, r2), line two \
midrule
3. Lorem ipsum dolor sit amet (c1, r3) & c2, r3 & c3, r3 \
midrule
4. Lorem ipsum dolor sit amet (c1, r4) & c2, r4, line one newline c2, r4, line two & c3, r4, line onenewline c3, r4, line two \

end{longtable}
end{document}

How to set longtable width to text width so that the text in cell wraps around automatically?

Hi I usually use tabular to create my table. However I am currently in the process of creating a unavoidable huge multi-page table in landscape more. I am using TeXstudio 2.12.10. However I am having several issues with landscape longtable that after many hours of trying, I can to seem to fix. I was hoping that something can advice me with the following issues I am currently facing:

Prob 2: when I write long sentences on “samples” (column 4) “notes” (column 5), the text just keeps on going outside of the page border rather than wrapping around. Which brings us to problem number 2,

Prob 1: I cannot set the width of the table to textwidth to limit the size of the table

Prob 3: shortstack option that I implemented perfectly on tabular does not appear to work here as it is not dividing up the lines.

I am happy for the first 3 rows to be smalls as they will contain only a few words, but the last 2 columns must be able to wrap text around with the use of something like shortstack so I can write in different lines. Any advice. I have attempted the following 1, 2, 3 advice without a solution. Please do let me know if you have questions. With the codes provided below I get something like this:

enter image description here

%%%%%%%%%%%% latex code %%%%%%%%%%%%

begin{landscape}
begin{center}

begin{longtable}{lcccl}

    caption{A simple longtable example}                                \
    hline
    reference & technique & geometry & suspension   & notes             \
    hline
    endfirsthead
    multicolumn{5}{c}%
    {tablename thetable -- textit{continued from previous page}} \
    hline
    reference & technique & geometry & suspension   & notes \
    hline
    endhead
    hline multicolumn{5}{r}{textit{continued on next page}} \
    endfoot
    hline
    endlastfoot

    citet{AbbottEtAl_Experimental_1991}        & MR    & Couette   
    & shortstack{particles: PMMA // $ bar{phi} = 39, 45, 50, 55, 60% $} 
    & shortstack{sample contained both unimodal and un-sieved particles \ shows migration time scale is independent of $ eta_f $ \ presents transient concentration profiles of $ bar{phi} = 50%$ \ presents steady state migration profiles of $ bar{phi} = 45, 50 , 55%$}\        

end{longtable}
end{center}
end{landscape}

Numering of longtable and normal table

I have two tables: one normal table, and one longtable.
The normal table comes first in my code and referencing, and the longtable comes after. However, the longtable appears first than the table. How can I change this?

I want the normal table to appear smoothly first, and then the longtable.

Compilable code: https://codeshare.io/aVdxY8

   documentclass[12pt]{article}
%usepackage[margin=20mm]{geometry}
usepackage{ragged2e}
usepackage{booktabs, makecell, tabularx}
renewcommandtheadfont{smallbfseries}
renewcommandtheadgape{}
newcolumntype{L}{>{RaggedRight}X}
usepackage{siunitx}
usepackage{enumitem}
usepackage{float}
%% To allow tables collumns auto newline
usepackage{array}
newcolumntype{L}[1]{>{raggedrightletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>{centeringletnewline\arraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>{raggedleftletnewline\arraybackslashhspace{0pt}}m{#1}}
usepackage{multirow, caption}
usepackage{booktabs}    % Beautiful simple tables
usepackage{paralist}    % To enable customizble enumerates
usepackage{ragged2e}
usepackage{hyperref} 
usepackage{booktabs,eqparbox,tabularx}
usepackage{pdflscape}
usepackage{afterpage}
usepackage{capt-of}% or use the larger `caption` package
usepackage{amsmath,calc}
usepackage{bm}
usepackage{cleveref}
%usepackage[table,xcdraw]{xcolor}
usepackage{longtable}

begin{document}



subsubsection{Linear variability}

Significant results obtained when testing the linear variability metrics are presented in Table ref{table:linear_var_POAF_results}. Briefly, the variability in both time and morphological features were significantly different between POAF and controls far away from the arrhythmia (at least 18 hours away), while only variability in P-wave time features were significant as the arrhythmia onset got closer. The POAF group had higher median variability for all the presented timestamps, and showed increasing variability (slope) in all timestamps except 18 hours before the arrhythmia onset. In contrast, controls presented decreasing variability in the majority of variability regression slope results. The PQ interval (duration and level) was the only feature which had metrics significant after correction for multiple comparisons at 6 and 48 hours before the arrhythmia onset.

begin{table}[!htp]
    caption[Significant results obtained when using linear variability metrics to predict postoperative atrial fibrillation.]{Significant results (uncorrected $p<0.01$) obtained when using the linear variability metrics. Results significant after correction for multiple corrections (corrected $p<0.05$) are shaded in grey. The median value (and the first/ third quartiles) of each group are presented.}
    label{table:linear_var_POAF_results}
    small
    centering
    renewcommand{arraystretch}{1.3}
    resizebox{textwidth}{!}{
        begin{tabular}{lcccc}
            hline
            textbf{Metrics}                                                    & textbf{Controls}                 & textbf{POAF}                    & textbf{P-value} & textbf{AUC} \ hline
            multicolumn{5}{c}{textbf{1 hour before POAF} ($S=5$)}                                                                                                                             \ hline
            textbf{textit{m}(PQtextsubscript{on RRnorm})}  begin{footnotesize}[a.u.]end{footnotesize}        & 4.8$times10^{-2}$ (4.0$times10^{-2}$ / 5.7$times10^{-2}$)    & 5.8$times10^{-2}$ (5.0$times10^{-2}$ / 7.6$times10^{-2}$)    & 4.1$times10^{-3}$        & 0.74       \

            textbf{textit{m}(PRtextsubscript{peak RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}       & 1.5$times10^{-2}$ (1.2$times10^{-2}$ / 2.2$times10^{-2}$)    & 2.2$times10^{-2}$ (2.0$times10^{-2}$ / 4.0$times10^{-2}$)    & 3.9$times10^{-3}$        & 0.74       \ hline
            multicolumn{5}{c}{textbf{2 hours before POAF} ($S=10$)}                                                                                                                            \ hline
            textbf{textit{m}(Ptextsubscript{dur. RRnorm})} begin{footnotesize}[a.u.]end{footnotesize} & 5.5$times10^{-2}$ (4.6$times10^{-2}$ / 6.5$times10^{-2}$)    & 7.2$times10^{-2}$ (5.8$times10^{-2}$ / 8.1$times10^{-2}$)    & 2.9$times10^{-3}$        & 0.75       \
            textbf{textit{m}(PQtextsubscript{on RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}        & 5.1$times10^{-2}$ (4.3$times10^{-2}$ / 6.1$times10^{-2}$)    & 7.6$times10^{-2}$ (5.7$times10^{-2}$ / 8.4$times10^{-2}$)    & 1.1$times10^{-3}$        & 0.78       \
            textbf{textit{m}(PRtextsubscript{on RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}       & 4.0$times10^{-2}$ (3.6$times10^{-2}$ / 5.1$times10^{-2}$)    & 6.5$times10^{-2}$ (4.8$times10^{-2}$ / 7.3$times10^{-2}$)    & 4.1$times10^{-3}$        & 0.75       \
            textbf{textit{m}(PRtextsubscript{peak RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}      & 1.7$times10^{-2}$ (1.3$times10^{-2}$ / 3.0$times10^{-2}$)    & 3.5$times10^{-2}$ (2.2$times10^{-2}$ / 4.6$times10^{-2}$)    & 3.9$times10^{-3}$        & 0.75       \ hline
            multicolumn{5}{c}{textbf{4 hours before POAF} ($S=10$)}                                                                                                                            \ hline
            textbf{textit{m}(PRtextsubscript{peak RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}      & 1.7$times10^{-2}$ (1.3$times10^{-2}$ / 2.4$times10^{-2}$)    & 2.8$times10^{-2}$ (1.9$times10^{-2}$ / 4.1$times10^{-2}$)    & 8.2$times10^{-3}$        & 0.73       \ hline
            multicolumn{5}{c}{textbf{6 hours before POAF} ($S=10$)}                                                                                                                            \ hline  
            textbf{textit{m}(Ptextsubscript{fin. dur.})} begin{footnotesize}[ms]end{footnotesize}   & 24.0 (16.0 / 30.0)             & 28.0 (24.0 / 37.0)             & 5.7$times10^{-3}$        & 0.73       \
            textbf{textit{m}(Ptextsubscript{dur. RRnorm})} begin{footnotesize}[a.u.]end{footnotesize} & 5.9$times10^{-2}$ (5.3$times10^{-2}$ / 6.3$times10^{-2}$)    & 7.1$times10^{-2}$ (6.1$times10^{-2}$ / 9.2$times10^{-2}$)    & 2.2$times10^{-3}$        & 0.76       \
            textbf{textit{m}(PQtextsubscript{on})} begin{footnotesize}[ms]end{footnotesize}                & 38.0 (32.0 / 44.0)             & 44.0 (36.0 / 58.0)             & 5.4$times10^{-3}$        & 0.73       \

            textbf{textit{m}(PQtextsubscript{on RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}        & 5.6$times10^{-2}$ (4.4$times10^{-2}$ / 6.2$times10^{-2}$)    & 7.9$times10^{-2}$ (6.0$times10^{-2}$ / 9.0$times10^{-2}$)    & 2.9$times10^{-4}$        & 0.80       \
            textbf{textit{m}(PRtextsubscript{peak})} begin{footnotesize}[ms]end{footnotesize}             & 8.0 (8.0 / 12.0)               & 16.0 (11.0 / 21.0)             & 1.6$times10^{-3}$        & 0.75       \
            textbf{textit{m}(PRtextsubscript{on RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}       & 4.8$times10^{-2}$ (3.7$times10^{-2}$ / 5.4$times10^{-2}$)    & 6.9$times10^{-2}$ (4.8$times10^{-2}$ / 8.7$times10^{-2}$)    & 5.3$times10^{-3}$        & 0.73       \
            textbf{textit{m}(PRtextsubscript{peak RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}     & 1.5$times10^{-2}$ (1.3$times10^{-2}$ / 2.5$times10^{-2}$)    & 3.3$times10^{-2}$ (1.9$times10^{-2}$ / 5.4$times10^{-2}$)    & 4.5$times10^{-3}$        & 0.74       \ hline
            multicolumn{5}{c}{textbf{12 hours before POAF} ($S=5$)}                                                                                                                           \ hline
            textbf{$boldsymbol{alpha}$(Qtextsubscript{on amp.})} begin{footnotesize}[mV]end{footnotesize}                       & -2.0$times10^{-6}$ (-6.1$times10^{-6}$ / -3.0$times10^{-6}$)  & 6.8$times10^{-6}$ (-1.1$times10^{-6}$ / 1.1$times10^{-5}$)    & 5.2$times10^{-3}$        & 0.72       \ hline
            multicolumn{5}{c}{textbf{18 hours before POAF} ($S=10$)}                                                                                                                           \ hline
            textbf{$boldsymbol{alpha}$(PQtextsubscript{on})} begin{footnotesize}[ms]end{footnotesize}      & 9.9$times10^{-4}$ (-8.9$times10^{-3}$ / 6.9$times10^{-3}$)   & -9.5$times10^{-3}$ (-2.4$times10^{-2}$ / -2.0$times10^{-3}$) & 1.4$times10^{-3}$        & 0.76       \
            textbf{$boldsymbol{alpha}$(PQtextsubscript{level, Pnorm})} begin{footnotesize}[mV]end{footnotesize}                     & 2.5$times10^{-4}$ (-7.2$times10^{-5}$ / 1.5$times10^{-3}$)   & -4.1$times10^{-4}$ (-1.1$times10^{-2}$ / 8.1$times10^{-5}$)  & 1.3$times10^{-3}$        & 0.78       \
            textbf{$boldsymbol{alpha}$(PRtextsubscript{on})} begin{footnotesize}[ms]end{footnotesize}                             & -1.7$times10^{-4}$ (-8.5$times10^{-3}$ / 7.0$times10^{-3}$)  & -7.1$times10^{-3}$ (-2.8$times10^{-2}$ / -1.7$times10^{-3}$) & 4.8$times10^{-3}$        & 0.73       \
            textbf{$boldsymbol{alpha}$(PRtextsubscript{peak})} begin{footnotesize}[ms]end{footnotesize}                            & 2.5$times10^{-4}$ (-3.5$times10^{-3}$ / 4.4$times10^{-3}$)   & -5.5$times10^{-3}$ (-1.5$times10^{-2}$ / -1.7$times10^{-4}$) & 8.1$times10^{-3}$        & 0.71       \ hline
            multicolumn{5}{c}{textbf{36 hours before POAF} ($S=30$)}                                                                                                                           \ hline
            textbf{$boldsymbol{alpha}$(Ptextsubscript{min. vel.})}  begin{footnotesize}[mV]end{footnotesize}                     & -7.7$times10^{-7}$ (-5.7$times10^{-6}$ / 9.5$times10^{-6}$)  & 1.9$times10^{-5}$ (7.9$times10^{-7}$ / 4.3$times10^{-5}$)    & 7.7$times10^{-3}$        & 0.72       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{vel. disp.})} begin{footnotesize}[mV]end{footnotesize}                     & -1.1$times10^{-6}$ (-1.1$times10^{-5}$ / 1.6$times10^{-5}$)  & 2.7$times10^{-5}$ (2.4$times10^{-6}$ / 6.2$times10^{-5}$)    & 9.2$times10^{-3}$        & 0.71       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{energy})} begin{footnotesize}[$mu V^2$]end{footnotesize}                        & -7.1$times10^{-10}$ (-6.3$times10^{-9}$ / 7.4$times10^{-9}$)  & 1.1$times10^{-8}$ (3.0$times10^{-9}$ / 2.3$times10^{-8}$)    & 3.4$times10^{-3}$        & 0.74       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{energy norm.})} begin{footnotesize}[V/s]end{footnotesize}                  & -1.1$times10^{-10}$ (-6.9$times10^{-10}$ / 4.7$times10^{-10}$)  & 1.1$times10^{-9}$ (5.1$times10^{-10}$ / 1.8$times10^{-9}$)    & 1.6$times10^{-3}$        & 0.76       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{gauss. error})} begin{footnotesize}[a.u.]end{footnotesize}             & -5.1$times10^{-8}$ (-3.8$times10^{-6}$ / 2.4$times10^{-6}$)  & 4.5$times10^{-6}$ (-7.1$times10^{-8}$ / 7.9$times10^{-6}$)   & 4.9$times10^{-3}$        & 0.73       \
            textbf{textit{m}(Ptextsubscript{fin. dur.})} begin{footnotesize}[ms]end{footnotesize}   & 24.0 (16.0 / 28.0)             & 32.0 (24.0 / 37.0)             & 6.7$times10^{-3}$        & 0.72       \ hline

            multicolumn{5}{c}{textbf{42 hours before POAF} ($S=5$)}                                                                                                                           \ hline
            textbf{textit{m}(Ptextsubscript{fin. dur.})} begin{footnotesize}[ms]end{footnotesize}   & 16.0 (16.0 / 24.0)             & 24.0 (24.0 / 32.0)             & 8.8$times10^{-3}$        & 0.72       \
            textbf{textit{m}(PQtextsubscript{off})} begin{footnotesize}[ms]end{footnotesize}               & 24.0 (16.0 / 24.0)             & 24.0 (24.0 / 32.0)             & 1.0$times10^{-2}$        & 0.72       \
            textbf{textit{m}(PQtextsubscript{on RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}        & 4.1$times10^{-2}$ (3.6$times10^{-2}$ / 5.4$times10^{-2}$)    & 5.6$times10^{-2}$ (4.4$times10^{-2}$ / 6.9$times10^{-2}$)    & 6.9$times10^{-3}$        & 0.74       \
            textbf{textit{m}(PQtextsubscript{off RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}        & 3.1$times10^{-2}$ (2.0$times10^{-2}$ / 4.1$times10^{-2}$)    & 4.2$times10^{-2}$ (3.3$times10^{-2}$ / 5.2$times10^{-2}$)    & 4.8$times10^{-3}$        & 0.75       \       
            textbf{textit{m}(PRtextsubscript{off RRnorm})} begin{footnotesize}[a.u.]end{footnotesize}       & 2.4$times10^{-2}$ (1.4$times10^{-2}$ / 3.5$times10^{-2}$)    & 3.5$times10^{-2}$ (3.0$times10^{-2}$ / 4.3$times10^{-2}$)    & 7.7$times10^{-3}$        & 0.73       \ 

            hline


            multicolumn{5}{c}{textbf{48 hours before POAF} ($S=10$)}                                                                                                                           \ hline
            textbf{$boldsymbol{alpha}$(Ptextsubscript{magn.})} begin{footnotesize}[mV]end{footnotesize}                           & -1.4$times10^{-5}$ (-3.4$times10^{-5}$ / -8.1$times10^{-7}$) & 6.7$times10^{-6}$ (-5.2$times10^{-6}$ / 1.6$times10^{-5}$)   & 2.1$times10^{-3}$        & 0.78       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{rms norm.})} begin{footnotesize}[mV]end{footnotesize}                      & -6.3$times10^{-7}$ (-1.5$times10^{-6}$ / -4.1$times10^{-9}$) & 2.7$times10^{-7}$ (7.8$times10^{-8}$ / 6.4$times10^{-7}$)    & 9.3$times10^{-3}$        & 0.73       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{energy})} begin{footnotesize}[$mu V^2$]end{footnotesize}                        & -4.7$times10^{-9}$ (-1.8$times10^{-8}$ / 1.3$times10^{-9}$)  & 2.0$times10^{-9}$ (1.5$times10^{-10}$ / 9.2$times10^{-9}$)    & 7.0$times10^{-3}$        & 0.74       \
            textbf{$boldsymbol{alpha}$(Ptextsubscript{energy norm.})} begin{footnotesize}[V/s]end{footnotesize}                  & -4.1$times10^{-10}$ (-1.2$times10^{-9}$ / 4.1$times10^{-11}$)  & 2.1$times10^{-10}$ (9.6$times10^{-12}$ / 1.6$times10^{-9}$)    & 3.9$times10^{-3}$        & 0.76       \

            textbf{$boldsymbol{alpha}$(PQtextsubscript{level, Pnorm})} begin{footnotesize}[mV]end{footnotesize}                   & -3.7$times10^{-3}$ (-7.0$times10^{-2}$ / -6.6$times10^{-4}$) & 3.0$times10^{-5}$ (-2.1$times10^{-4}$ / 1.8$times10^{-3}$)   & 7.4$times10^{-4}$        & 0.86       \
            textbf{textit{m}(Ptextsubscript{eucl. dist.})} begin{footnotesize}[a.u.]end{footnotesize}       & 9.3$times10^{-2}$ (7.3$times10^{-2}$ / 1.2$times10^{-1}$)    & 1.4$times10^{-1}$ (9.6$times10^{-2}$ / 1.9$times10^{-1}$)    & 6.6$times10^{-3}$        & 0.74       \ hline
    end{tabular}}
end{table}

subsubsection{Non-linear variability}

Non-linear CTM was found to significantly differ between POAF patients and controls in all the tested timestamps (Table ref{table:CTM_results_POAF}). Controls were associated with higher CTM in the great majority of features and timestamps. However, CTM applied over the features Ptextsubscript{vel. disp.}, Ptextsubscript{fin. dur}, Ptextsubscript{magn.}, PQtextsubscript{level}, PQtextsubscript{level Pnorm} and Ptextsubscript{off amp.} was sometimes higher in POAF patients. Finally, several P-wave time- and morphological metrics were significant after correction for multiple comparisons 1, 12, 18, 42 and 48 hours before the arrhythmia onset, all of them showing higher CTM in controls.


begin{small}

    begin{longtable}{llllll}
        caption[Significant results obtained when using non-linear variability metrics to predict postoperative atrial fibrillation.]{Significant results (uncorrected $p<0.01$) obtained when testing the non-linear variability results. The presented values of optimal $rho$ correspond to the number of multiples of the standard deviation which minimised the textit{p}-value for the correspondent feature. Results significant after correction for multiple corrections (corrected $p<0.05$) are shaded in grey. The median value (and the first/ third quartiles) of each group are presented (in arbitrary units).}
        label{table:CTM_results_POAF} \
        hline multicolumn{1}{c}{textbf{Metrics}} & multicolumn{1}{c}{$boldsymbol{rho}$} & multicolumn{1}{c}{textbf{Controls}} & multicolumn{1}{c}{textbf{POAF}} & multicolumn{1}{c}{textbf{P-values}} & multicolumn{1}{c}{textbf{AUC}} \ hline
        endfirsthead

        multicolumn{3}{c}%
        {{bfseries tablename thetable{} -- continued from previous page}} \
        hline multicolumn{1}{c}{textbf{Metrics}} & multicolumn{1}{c}{$boldsymbol{rho}$} & multicolumn{1}{c}{textbf{Controls}} & multicolumn{1}{c}{textbf{POAF}} & multicolumn{1}{c}{textbf{P-values}} & multicolumn{1}{c}{textbf{AUC}} \ hline
        endhead

        hline multicolumn{6}{r}{{Continued on next page}} \ hline
        endfoot

        endlastfoot

        multicolumn{6}{c}{textbf{1 hour before POAF} (lag$=5$)}                                                                                                                                                                              \ hline
        textbf{PQtextsubscript{off RRnorm}}          & 3.0                      & 0.8944 (0.8751 / 0.9085)            & 0.9089 (0.8996 / 0.9367)        & 2.7$times10^{-3}$                              & 0.75                           \
        textbf{PRtextsubscript{off RRnorm}}         & 8.0                      & 1.0000 (0.9994 / 1.0000)            & 0.9994 (0.9979 / 1.0000)        & 6.0$times10^{-3}$                              & 0.71                           \

        textbf{PRtextsubscript{on RRnorm}}          & 4.0                      & 0.9863 (0.9791 / 0.9931)            & 0.9741 (0.9554 / 0.9814)       & 3.1$times10^{-4}$                              & 0.80                           \

        textbf{PRtextsubscript{peak RRnorm}}        & 3.5                   & 0.9849 (0.9677 / 0.9942)            & 0.9529 (0.9303 / 0.9735)        & 5.4$times10^{-4}$                              & 0.79                           \

        textbf{Ptextsubscript{area}}               & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9999 / 1.0000)        & 1.2$times10^{-3}$                              & 0.62                           \

        textbf{Ptextsubscript{dur. RRnorm}}   & 4.0                      & 0.9822 (0.9758 / 0.9884)            & 0.9714 (0.9637 / 0.9767)        & 3.3$times10^{-4}$                              & 0.80                           \

        textbf{Ptextsubscript{eucl. dist.}}         & 4.0                      & 0.9906 (0.9822 / 0.9930)            & 0.9754 (0.9658 / 0.9834)        & 3.1$times10^{-5}$                              & 0.85                           \
        textbf{Ptextsubscript{gauss. A}}             & 6.0                      & 0.9981 (0.9958 / 0.9990)            & 0.9947 (0.9907 / 0.9977)        & 3.9$times10^{-3}$                              & 0.74                           \

        textbf{Ptextsubscript{magn.}}               & 4.0                      & 0.9826 (0.9770 / 0.9896)            & 0.9721 (0.9564 / 0.9816)        & 9.2$times10^{-4}$                              & 0.78                           \

        textbf{Ptextsubscript{area norm.}}         & 4.0                      & 0.9776 (0.9687 / 0.9843)            & 0.9647 (0.9560 / 0.9724)        & 4.8$times10^{-4}$                              & 0.79                           \
        textbf{Ptextsubscript{rms norm.}}          & 5.0                      & 0.9912 (0.9855 / 0.9935)            & 0.9842 (0.9787 / 0.9896)        & 5.0$times10^{-3}$                              & 0.73                           \
        textbf{Ptextsubscript{vel. disp.}}          & 4.0                      & 0.9821 (0.9781 / 0.9870)            & 0.9764 (0.9726 / 0.9816)        & 3.5$times10^{-3}$                              & 0.74                           \

        textbf{CCI}          & 10.5                      & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9993 / 1.0000)        & 3.5$times10^{-3}$                              & 0.74                           \


        hline multicolumn{6}{c}{textbf{2 hours before POAF} (lag$=8$)}   \ hline
        textbf{PQtextsubscript{off}}                 & 8.5                   & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9987 / 1.0000)        & 2.8$times10^{-3}$                              & 0.67                           \
        textbf{PRtextsubscript{on}}                  & 11.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9992 / 1.0000)        & 5.2$times10^{-3}$                              & 0.65                           \
        textbf{PRtextsubscript{peak}}                & 14.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 5.9$times10^{-3}$                              & 0.67                           \
        textbf{PQtextsubscript{off RRnorm}}   & 9.5                   & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 6.7$times10^{-3}$                              & 0.65                          \
        textbf{Ptextsubscript{eucl. dist.}}         & 4.5                   & 0.9952 (0.9892 / 0.9968)            & 0.9884 (0.9756 / 0.9942)        & 2.8$times10^{-3}$                              & 0.76                           \
        textbf{Ptextsubscript{gauss. C}}             & 14.5                  & 1.0000 (0.9992 / 1.0000)            & 0.9991 (0.9986 / 0.9997)        & 7.1$times10^{-3}$                              & 0.71                           \
        textbf{Ptextsubscript{area norm.}}         & 3.5                   & 0.9593 (0.9466 / 0.9684)            & 0.9372 (0.9327 / 0.9548)        & 5.3$times10^{-3}$                              & 0.74                           \
        textbf{Ptextsubscript{fin. dur.}}     & 6.0                      & 0.9994 (0.9981 / 1.0000)            & 1.0000 (0.9998 / 1.0000)        & 2.7$times10^{-3}$                              & 0.75                           \

        hline multicolumn{6}{c}{textbf{4 hours before POAF} (lag$=6$)}    \ hline
        textbf{Ptextsubscript{dur RRnorm}}               & 6.0                     & 0.9995 (0.9988 / 1.0000)            & 0.9982 (0.9957 / 0.9995)        & 4.6$times10^{-3}$                              & 0.75                           \
        textbf{PRtextsubscript{on RRnorm}}               & 4.5                     & 0.9928 (0.9882 / 0.9966)            & 0.9856 (0.9667 / 0.9913)        & 4.4$times10^{-3}$                              & 0.75                           \          


        textbf{Ptextsubscript{area}}               & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9995 / 1.0000)        & 1.5$times10^{-3}$                              & 0.65                           \
        hline multicolumn{6}{c}{textbf{6 hours before POAF} (lag$=6$)}     \ hline
        textbf{Ptextsubscript{energy}}             & 11.5                  & 0.9991 (0.9981 / 0.9997)            & 0.9980 (0.9961 / 0.9987)        & 8.3$times10^{-3}$                              & 0.72                           \
        textbf{Ptextsubscript{eucl. dist.}}         & 4.5                   & 0.9941 (0.9895 / 0.9968)            & 0.9911 (0.9816 / 0.9922)        & 4.8$times10^{-3}$                              & 0.74                           \
        textbf{Ptextsubscript{fin. dur.}}     & 6.0                      & 0.9993 (0.9976 / 1.0000)            & 1.0000 (0.9994 / 1.0000)        & 5.9$times10^{-3}$                              & 0.72                           \

        hline multicolumn{6}{c}{textbf{12 hours before POAF} (lag$=4$)}    \ hline


        textbf{PQtextsubscript{off}}                 & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9990 / 1.0000)        & 5.2$times10^{-4}$                              & 0.65                           \
        textbf{PQtextsubscript{off RRnorm}}                 & 9.5                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 2.2$times10^{-4}$                              & 0.64                           \

        textbf{PQtextsubscript{on}}                  & 7.5                   & 1.0000 (1.0000 / 1.0000)            & 0.9998 (0.9990 / 1.0000)        & 7.6$times10^{-4}$                              & 0.71                           \


        textbf{Ptextsubscript{gauss. W}}             & 20.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9989 / 1.0000)        & 9.9$times10^{-3}$                              & 0.66                           \
        textbf{Ptextsubscript{magn.}}               & 2.5                   & 0.9210 (0.8766 / 0.9576)            & 0.8810 (0.8358 / 0.9132)        & 7.4$times10^{-3}$                              & 0.74                           \

        textbf{Ptextsubscript{area norm.}}         & 2.0                      & 0.8111 (0.7547 / 0.8485)            & 0.7089 (0.6585 / 0.7424)        & 1.5$times10^{-4}$                              & 0.84                           \

        textbf{Ptextsubscript{rms norm.}}          & 2.0                      & 0.7889 (0.7472 / 0.8466)            & 0.6877 (0.6503 / 0.7236)        & 1.2$times10^{-3}$                              & 0.79                           \
        textbf{Ptextsubscript{off amp.}}           & 8.0                      & 0.9971 (0.9952 / 0.9986)            & 0.9992 (0.9980 / 1.0000)        & 2.3$times10^{-3}$                              & 0.77                           \
        textbf{Ptextsubscript{fin. dur.}}     & 5.5                   & 0.9988 (0.9962 / 0.9995)            & 0.9997 (0.9993 / 1.0000)        & 9.3$times10^{-3}$                              & 0.73                           \
        textbf{WI$_t$}                        & 2.5                   & 0.8301 (0.8163 / 0.8425)            & 0.8083 (0.8008 / 0.8246)        & 3.7$times10^{-3}$                              & 0.76         \ hline                 
    end{longtable}

end{small}

















end{document}

longtable error – float(s) lost

I have this really big table, which is divided in several pages. The table was good, but I decided to add an extra row, and now it gives me the following errors:
Errro

Any idea what’s happening?

This is my table code (giving the error!):

begin{center}
    begin{small}

        begin{longtable}{llllll}
            caption[Significant results obtained when using non-linear variability metrics to predict postoperative atrial fibrillation.]{Significant results (uncorrected $p<0.01$) obtained when testing the non-linear variability results. The presented values of optimal $rho$ correspond to the number of multiples of the standard deviation which minimised the textit{p}-value for the correspondent feature. Results significant after correction for multiple corrections (corrected $p<0.05$) are shaded in grey. The median value (and the first/ third quartiles) of each group are presented (in arbitrary units).}
            label{table:CTM_results_POAF} \
            hline multicolumn{1}{c}{textbf{Metrics}} & multicolumn{1}{c}{$boldsymbol{rho}$} & multicolumn{1}{c}{textbf{Controls}} & multicolumn{1}{c}{textbf{POAF}} & multicolumn{1}{c}{textbf{P-values}} & multicolumn{1}{c}{textbf{AUC}} \ hline
            endfirsthead

            multicolumn{3}{c}%
            {{bfseries tablename thetable{} -- continued from previous page}} \
            hline multicolumn{1}{c}{textbf{Metrics}} & multicolumn{1}{c}{$boldsymbol{rho}$} & multicolumn{1}{c}{textbf{Controls}} & multicolumn{1}{c}{textbf{POAF}} & multicolumn{1}{c}{textbf{P-values}} & multicolumn{1}{c}{textbf{AUC}} \ hline
            endhead

            hline multicolumn{6}{r}{{Continued on next page}} \ hline
            endfoot

            endlastfoot

            multicolumn{6}{c}{textbf{1 hour before POAF} (lag$=5$)}                                                                                                                                                                              \ hline
            textbf{PQtextsubscript{off RRnorm}}          & 3.0                      & 0.8944 (0.8751 / 0.9085)            & 0.9089 (0.8996 / 0.9367)        & 2.7$times10^{-3}$                              & 0.75                           \
            textbf{PRtextsubscript{off RRnorm}}         & 8.0                      & 1.0000 (0.9994 / 1.0000)            & 0.9994 (0.9979 / 1.0000)        & 6.0$times10^{-3}$                              & 0.71                           \
                    rowcolor[HTML]{efefef} 
            textbf{PRtextsubscript{on RRnorm}}          & 4.0                      & 0.9863 (0.9791 / 0.9931)            & 0.9741 (0.9554 / 0.9814)       & 3.1$times10^{-4}$                              & 0.80                           \
                    rowcolor[HTML]{efefef} 
            textbf{PRtextsubscript{peak RRnorm}}        & 3.5                   & 0.9849 (0.9677 / 0.9942)            & 0.9529 (0.9303 / 0.9735)        & 5.4$times10^{-4}$                              & 0.79                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{area}}               & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9999 / 1.0000)        & 1.2$times10^{-3}$                              & 0.62                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{dur. RRnorm}}   & 4.0                      & 0.9822 (0.9758 / 0.9884)            & 0.9714 (0.9637 / 0.9767)        & 3.3$times10^{-4}$                              & 0.80                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{eucl. dist.}}         & 4.0                      & 0.9906 (0.9822 / 0.9930)            & 0.9754 (0.9658 / 0.9834)        & 3.1$times10^{-5}$                              & 0.85                           \
            textbf{Ptextsubscript{gauss. A}}             & 6.0                      & 0.9981 (0.9958 / 0.9990)            & 0.9947 (0.9907 / 0.9977)        & 3.9$times10^{-3}$                              & 0.74                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{magn.}}               & 4.0                      & 0.9826 (0.9770 / 0.9896)            & 0.9721 (0.9564 / 0.9816)        & 9.2$times10^{-4}$                              & 0.78                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{area norm.}}         & 4.0                      & 0.9776 (0.9687 / 0.9843)            & 0.9647 (0.9560 / 0.9724)        & 4.8$times10^{-4}$                              & 0.79                           \
            textbf{Ptextsubscript{rms norm.}}          & 5.0                      & 0.9912 (0.9855 / 0.9935)            & 0.9842 (0.9787 / 0.9896)        & 5.0$times10^{-3}$                              & 0.73                           \
            textbf{Ptextsubscript{vel. disp.}}          & 4.0                      & 0.9821 (0.9781 / 0.9870)            & 0.9764 (0.9726 / 0.9816)        & 3.5$times10^{-3}$                              & 0.74                           \
            textbf{CCI}          & 10.5                      & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9993 / 1.0000)        & 3.5$times10^{-3}$                              & 0.74                           \


            hline multicolumn{6}{c}{textbf{2 hours before POAF} (lag$=8$)}   \ hline
            textbf{PQtextsubscript{off}}                 & 8.5                   & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9987 / 1.0000)        & 2.8$times10^{-3}$                              & 0.67                           \
            textbf{PRtextsubscript{on}}                  & 11.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9992 / 1.0000)        & 5.2$times10^{-3}$                              & 0.65                           \
            textbf{PRtextsubscript{peak}}                & 14.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 5.9$times10^{-3}$                              & 0.67                           \
            textbf{PQtextsubscript{off RRnorm}}   & 9.5                   & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 6.7$times10^{-3}$                              & 0.65                          \
            textbf{Ptextsubscript{eucl. dist.}}         & 4.5                   & 0.9952 (0.9892 / 0.9968)            & 0.9884 (0.9756 / 0.9942)        & 2.8$times10^{-3}$                              & 0.76                           \
            textbf{Ptextsubscript{gauss. C}}             & 14.5                  & 1.0000 (0.9992 / 1.0000)            & 0.9991 (0.9986 / 0.9997)        & 7.1$times10^{-3}$                              & 0.71                           \
            textbf{Ptextsubscript{area norm.}}         & 3.5                   & 0.9593 (0.9466 / 0.9684)            & 0.9372 (0.9327 / 0.9548)        & 5.3$times10^{-3}$                              & 0.74                           \
            textbf{Ptextsubscript{fin. dur.}}     & 6.0                      & 0.9994 (0.9981 / 1.0000)            & 1.0000 (0.9998 / 1.0000)        & 2.7$times10^{-3}$                              & 0.75                           \

            hline multicolumn{6}{c}{textbf{4 hours before POAF} (lag$=6$)}    \ hline
            textbf{Ptextsubscript{dur RRnorm}}               & 6.0                     & 0.9995 (0.9988 / 1.0000)            & 0.9982 (0.9957 / 0.9995)        & 4.6$times10^{-3}$                              & 0.75                           \



            textbf{Ptextsubscript{area}}               & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9995 / 1.0000)        & 1.5$times10^{-3}$                              & 0.65                           \
            hline multicolumn{6}{c}{textbf{6 hours before POAF} (lag$=6$)}     \ hline
            textbf{Ptextsubscript{energy}}             & 11.5                  & 0.9991 (0.9981 / 0.9997)            & 0.9980 (0.9961 / 0.9987)        & 8.3$times10^{-3}$                              & 0.72                           \
            textbf{Ptextsubscript{eucl. dist.}}         & 4.5                   & 0.9941 (0.9895 / 0.9968)            & 0.9911 (0.9816 / 0.9922)        & 4.8$times10^{-3}$                              & 0.74                           \
            textbf{Ptextsubscript{fin. dur.}}     & 6.0                      & 0.9993 (0.9976 / 1.0000)            & 1.0000 (0.9994 / 1.0000)        & 5.9$times10^{-3}$                              & 0.72                           \

            hline multicolumn{6}{c}{textbf{12 hours before POAF} (lag$=4$)}    \ hline
                    rowcolor[HTML]{efefef} 
            textbf{PQtextsubscript{off}}                 & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9990 / 1.0000)        & 5.2$times10^{-4}$                              & 0.65                           \
                    rowcolor[HTML]{efefef} 
            textbf{PQtextsubscript{on}}                  & 7.5                   & 1.0000 (1.0000 / 1.0000)            & 0.9998 (0.9990 / 1.0000)        & 7.6$times10^{-4}$                              & 0.71                           \
            textbf{PQtextsubscript{level}}                 & 11.0                     & 0.9996 (0.9990 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 6.4$times10^{-3}$                              & 0.70                           \
            textbf{PRtextsubscript{off}}                 & 16.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9994 / 1.0000)        & 2.5$times10^{-3}$                              & 0.62                           \
                    rowcolor[HTML]{efefef} 
            textbf{PRtextsubscript{on}}                  & 8.0                      & 1.0000 (1.0000 / 1.0000)            & 0.9995 (0.9986 / 1.0000)        & 5.6$times10^{-5}$                              & 0.75                           \
            textbf{PRtextsubscript{peak}}                & 13.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9987 / 1.0000)        & 2.4$times10^{-3}$                              & 0.66 \

            textbf{PQtextsubscript{off RRnorm}}                & 9.5                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9991 / 1.0000)        & 2.2$times10^{-3}$                              & 0.64 \          


                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{al}}           & 7.0                      & 1.0000 (1.0000 / 1.0000)            & 0.9998 (0.9997 / 1.0000)        & 6.2$times10^{-4}$                              & 0.70                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{dur.}}           & 7.0                      & 1.0000 (1.0000 / 1.0000)            & 0.9998 (0.9997 / 1.0000)        & 6.2$times10^{-4}$                              & 0.70                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{eucl. dist.}}         & 5.0                      & 0.9974 (0.9937 / 0.9990)            & 0.9938 (0.9902 / 0.9953)        & 3.4$times10^{-4}$                              & 0.79                           \
            textbf{Ptextsubscript{magn.}}               & 10.0                     & 0.9996 (0.9989 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 3.2$times10^{-3}$                              & 0.72                           \
            textbf{Ptextsubscript{vel. disp.}}          & 10.5                  & 1.0000 (0.9993 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 8.1$times10^{-3}$                              & 0.67                           \

            hline multicolumn{6}{c}{textbf{18 hours before POAF} (lag$=9$)}         \ hline
            textbf{PQtextsubscript{off}}                 & 9.5                   & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9988 / 1.0000)        & 6.5$times10^{-3}$                              & 0.63                           \
            textbf{Ptextsubscript{al}}           & 1.0                      & 0.2750 (0.2431 / 0.3175)            & 0.2420 (0.2335 / 0.2543)        & 2.6$times10^{-3}$                              & 0.74                           \
            textbf{Ptextsubscript{dur.}}           & 1.0                      & 0.2750 (0.2431 / 0.3175)            & 0.2421 (0.2335 / 0.2543)        & 2.6$times10^{-3}$                              & 0.74                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{eucl. dist.}}         & 4.0                      & 0.9901 (0.9862 / 0.9931)            & 0.9827 (0.9633 / 0.9870)        & 1.2$times10^{-3}$                              & 0.76                           \
            textbf{Ptextsubscript{ini. dur.}}     & 2.0                      & 0.6733 (0.6358 / 0.7047)            & 0.6468 (0.6180 / 0.6552)        & 8.5$times10^{-3}$                              & 0.71                           \

            hline multicolumn{6}{c}{textbf{24 hours before POAF} (lag$=6$)}        \ hline
            textbf{Ptextsubscript{al}}           & 8.0                      & 1.0000 (1.0000 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 4.9$times10^{-3}$                              & 0.59                           \
            textbf{Ptextsubscript{dur.}}           & 8.0                      & 1.0000 (1.0000 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 4.9$times10^{-3}$                              & 0.59                           \
            textbf{Ptextsubscript{magn.}}               & 3.0                      & 0.9461 (0.9349 / 0.9627)            & 0.9270 (0.9185 / 0.9405)        & 7.8$times10^{-3}$                              & 0.72                           \
            textbf{Ptextsubscript{max. vel.}}           & 3.5                   & 0.9629 (0.9585 / 0.9706)            & 0.9576 (0.9467 / 0.9605)        & 3.9$times10^{-3}$                              & 0.74                           \
            textbf{Ptextsubscript{min. vel.}}           & 3.5                   & 0.9625 (0.9561 / 0.9697)            & 0.9548 (0.9508 / 0.9633)        & 7.1$times10^{-3}$                              & 0.72                           \

            hline multicolumn{6}{c}{textbf{30 hours before POAF} (lag$=7$)}          \ hline
            textbf{Ptextsubscript{area}}               & 12.5                  & 1.0000 (1.0000 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 8.3$times10^{-3}$                              & 0.58                           \
            textbf{WI$_t$}                        & 9.0                      & 1.0000 (1.0000 / 1.0000)            & 1.0000 (1.0000 / 1.0000)        & 2.1$times10^{-3}$                              & 0.61                           \

            hline multicolumn{6}{c}{textbf{36 hours before POAF} (lag$=3$)}              \ hline

            textbf{PQtextsubscript{on RRnorm}}          & 23.5                  & 0.9993 (0.9989 / 1.0000)            & 0.9987 (0.9972 / 0.9994)        & 5.5$times10^{-3}$                              & 0.73                           \
            textbf{PQtextsubscript{level}}                 & 6.5                   & 0.9972 (0.9952 / 0.9993)            & 0.9936 (0.9907 / 0.9966)        & 2.1$times10^{-3}$                              & 0.75                           \
            textbf{PQtextsubscript{level Rnorm}}          & 6.5                   & 0.9972 (0.9951 / 0.9989)            & 0.9950 (0.9911 / 0.9974)        & 9.5$times10^{-3}$                              & 0.71                           \
            textbf{PRtextsubscript{off RRnorm}}         & 23.5                  & 0.9993 (0.9989 / 1.0000)            & 0.9987 (0.9972 / 0.9994)        & 9.6$times10^{-3}$                              & 0.71                           \
            textbf{PRtextsubscript{on RRnorm}}          & 25.0                     & 0.9993 (0.9989 / 1.0000)            & 0.9987 (0.9979 / 0.9994)        & 4.3$times10^{-3}$                              & 0.73                           \
            textbf{PRtextsubscript{peak RRnorm}}        & 23.5                  & 0.9993 (0.9989 / 1.0000)            & 0.9987 (0.9972 / 0.9994)        & 5.3$times10^{-3}$                              & 0.73                           \
            textbf{Ptextsubscript{area}}               & 5.5                   & 0.9980 (0.9957 / 0.9993)            & 0.9945 (0.9908 / 0.9983)        & 9.2$times10^{-3}$                              & 0.71                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{dur. RRnorm}}   & 23.5                  & 0.9995 (0.9990 / 1.0000)            & 0.9986 (0.9972 / 0.9994)        & 1.1$times10^{-3}$                              & 0.77                           \
            textbf{Ptextsubscript{area norm.}}         & 4.5                   & 0.9886 (0.9833 / 0.9938)            & 0.9806 (0.9763 / 0.9886)        & 7.7$times10^{-3}$                              & 0.72                           \

            hline multicolumn{6}{c}{textbf{42 hours before POAF} (lag$=1$)}          \ hline
            textbf{PQtextsubscript{on}}                  & 3.5                   & 0.9387 (0.9278 / 0.9454)            & 0.9459 (0.9429 / 0.9520)        & 9.6$times10^{-3}$                              & 0.73                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{energy norm.}}       & 12.5                     & 0.9993 (0.9986 / 0.9998)            & 0.9982 (0.9973 / 0.9987)        & 1.1$times10^{-3}$                              & 0.79                           \
            textbf{Ptextsubscript{fin. dur.}}     & 3.5                   & 0.9402 (0.9251 / 0.9537)            & 0.9571 (0.9470 / 0.9654)        & 4.6$times10^{-3}$                              & 0.75                           \
            textbf{WI$_t$}                        & 8.0                      & 1.0000 (1.0000 / 1.0000)            & 0.9998 (0.9997 / 1.0000)        & 9.7$times10^{-3}$                              & 0.68                           \

            hline multicolumn{6}{c}{textbf{48 hours before POAF} (lag$=7$)} \ hline
            textbf{PQtextsubscript{level Pnorm}}          & 17.5                  & 0.9982 (0.9975 / 0.9989)            & 0.9993 (0.9989 / 1.0000)        & 3.9$times10^{-3}$                              & 0.76                           \
            textbf{Ptextsubscript{area}}               & 3.0                      & 0.9181 (0.9010 / 0.9338)            & 0.8926 (0.8859 / 0.9262)        & 9.3$times10^{-3}$                              & 0.73                           \
            textbf{Ptextsubscript{gauss. W}}             & 20.0                     & 1.0000 (1.0000 / 1.0000)            & 1.0000 (0.9989 / 1.0000)        & 9.9$times10^{-3}$                              & 0.66                           \
            textbf{Ptextsubscript{magn.}}               & 2.5                   & 0.9210 (0.8766 / 0.9576)            & 0.8810 (0.8358 / 0.9132)        & 7.4$times10^{-3}$                              & 0.74                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{area norm.}}         & 2.0                      & 0.8111 (0.7547 / 0.8485)            & 0.7089 (0.6585 / 0.7424)        & 1.5$times10^{-4}$                              & 0.84                           \
                    rowcolor[HTML]{efefef} 
            textbf{Ptextsubscript{rms norm.}}          & 2.0                      & 0.7889 (0.7472 / 0.8466)            & 0.6877 (0.6503 / 0.7236)        & 1.2$times10^{-3}$                              & 0.79                           \
            textbf{Ptextsubscript{off amp.}}           & 8.0                      & 0.9971 (0.9952 / 0.9986)            & 0.9992 (0.9980 / 1.0000)        & 2.3$times10^{-3}$                              & 0.77                           \
            textbf{Ptextsubscript{fin. dur.}}     & 5.5                   & 0.9988 (0.9962 / 0.9995)            & 0.9997 (0.9993 / 1.0000)        & 9.3$times10^{-3}$                              & 0.73                           \
            textbf{WI$_t$}                        & 2.5                   & 0.8301 (0.8163 / 0.8425)            & 0.8083 (0.8008 / 0.8246)        & 3.7$times10^{-3}$                              & 0.76         \ hline                 
        end{longtable}
    end{small}
end{center}

Longtable Issues – Can’t compile in sharelatex and it doesn’t work well

Good evening,

I was trying to create a longtable with this kind of format. However, every time I try to compile the file with this table, I get a runout error in ShareLatex. What’s weirder is that I could compile it before. Here is the longtable I tried to create

begin{center}
    begin{longtable}{>{raggedleftarraybackslash}p{2.5cm} p{3.5cm} p{4cm} p{4cm}}
    caption{Ventajas y Desventajas de los Ensayos No Destructivos.} label{tab:long} \
        toprule
        % aquí añadimos el encabezado de la primera hoja.
        multicolumn{1}{>{centeringarraybackslash}m{2.5cm}}{textbf{Método Empleado}} & 
        multicolumn{1}{>{centeringarraybackslash}m{2.5cm}}{textbf{Campo de Aplicación}} &
        multicolumn{1}{>{centeringarraybackslash}m{4.2cm}}{textbf{Ventajas}} & 
        multicolumn{1}{>{centeringarraybackslash}m{4.2cm}}{textbf{Desventajas}}\[.5ex] midrule 
        endfirsthead


        multicolumn{4}{c}{Sigue en la página siguiente.}
        toprule
       multicolumn{1}{>{centeringarraybackslash}m{2.5cm}}{textbf{Método Empleado}} & 
        multicolumn{1}{>{centeringarraybackslash}m{2.5cm}}{textbf{Campo de Aplicación}} &
        multicolumn{1}{>{centeringarraybackslash}m{4.2cm}}{textbf{Ventajas}} & 
        multicolumn{1}{>{centeringarraybackslash}m{4.2cm}}{textbf{Desventajas}}\[.5ex] midrule
        endhead

        hline multicolumn{4}{|r|}{{Continued on next page}} 
        endfoot

        % aquí añadimos el fondo de la última hoja.
        endlastfoot


         textbf{Termografía}    &    Detección de agua dentro de los paneles de sándwich. Detección de Corrosión.  Detección de delaminación.      &  Capacidad de procesado por imagen, no requiere contacto con el componente, rápido, bueno para detectar acumulación de agua en el panel sándwich.   & Necesita cargarse térmicamente, mediante calentadores de aire, mantas eléctricas, etc. Superficies de protección (como la pintura) puede influenciar (e incluso impedir) su aplicación. No puede repetirse tras un breve espacio de tiempo, penetración térmica limitada, etc. \[2ex]

          textbf{Rayos-X}  & Detección de flujo interno y discontinuidades, como son grietas, inclusiones y variaciones de espesor.            & Elimina muchos requerimientos de desmontaje. Tiene una alta sensibilidad y permite grabar los resultados en cámara. & Peligrosidad ante radiación, por lo que se requiere de inspectores y equipamiento especializado. Se requiere fuente eléctrica. La grieta debe estar casi paralela al rayo para ser detectable \[3ex]

          textbf{Ultrasonidos}  & Detección de discontinuidades superficial y sub-superficial, grietas y fallos internos en la mayoría de metales son fácilmente detectables con la técnica textit{pulse-echo}.  & Rápido y fácil de utilizar generalmente. Los resultados se conocen al instante. Elevada precisión. Alta sensibilidad y suelen ser equipos portátiles  & Se requieren operadores cualificados y de fuente eléctrica de alimentación. El plano de orientación de la grieta debe ser conocido a priori para seleccionar el tipo de onda a utilizar. Se requieren también de bloques de referencia para establecer la sensibilidad del equipo \[3ex]

          textbf{Corrientes Inducidas}  & Permite la detección de discontinuidades en superficies metálicas, grietas, corrosión intergranular y fallos por sobrecalentamiento (mediante la medida de la conductividad de la zona calentada)  & Simple de aplicar, fácil, detecta discontinuidades de un tamaño muy inferior a otras técnicas, como visual o líquidos penetrantes. Además es rápido y portátil & Sensible ante pequeñas variaciones del material, así como de la propia inspección (efecto textit{lift-off}). Se requieren de distintos bloques de calibración y probetas para cada material \[3ex]

          textbf{Partículas Magnéticas}  & Detección superficial de discontinuidades en materiales ferromagnéticos de cualquier forma o condición de calentamiento.  & Principio en el que se basa simple, fácil de utilizar, portátil, rápido.  & Debe limpiarse la superficie para el testeo. El campo magnético debe ser normal al plano del defecto \[3ex]

            textbf{Líquido Penetrante}  & Detección de grietas en la superficie de metales, forjados, soldaduras y partes mecanizadas  & Fácil de utilizar e interpretar, rápido y preciso  & No permite detectar fallos sub-superficiales  \[3ex]

            textbf{Inspección Visual}  & Detección de discontinuidades superficiales daños estructurales en todo tipo de materiales  & Simple de aplicar en áreas donde para otro tipo de técnicas sería imposible. Equipamiento óptico permite mejorar este método. & La fiabilidad depende de la habilidad y experiencia del usuario. A veces para acceder a algunos sitios se requiere equipos complejos de tipo óptico.   \[3ex]

        bottomrule
    end{longtable}
end{center}

Pgfplotstableset, longtable and subcaption

I am using pgfplotstableset and longtable to read data from a file and format it into a table composed of several subtables. I have managed to create the table and to include a caption over it. However, I would also like to include a subcaption over each one of the subtables and I have not been able to do it.

The desired output should look like:
Desired output

I have created the table above with caption*. However, I would prefer to use subcaption to maintain the consistency of my references. Below, I include the minimal code, which I have used to create the table above. I have tried replacing caption* with subcaption and I get the following error:

! Package caption Error: subcaption outside float.

Minimal code.
article.tex:

documentclass{article} 
usepackage{conf-simple}
begin{document}
includetable{data/minimal-data.dat}{Minimal data}{minimal-data}
end{document}

conf-simple.sty:

ProvidesPackage{conf-simple}
usepackage{subcaption}
usepackage{pgfplotstable}
usepackage{longtable}
usepackage{booktabs}

pgfplotstableset{
begin table=begin{longtable},
create on use/double/.style={create col/expr={thisrowno{1}*2}},
end table=end{longtable},
}

newcommand{includetable}[3]{

noindentbegin{minipage}{textwidth}  
pgfplotstabletypeset[
col sep=space,
header=false, 
column type=r,   
columns={0,1,double},      % display specified columns
columns/0/.style={string type, column name =},
columns/1/.style={column name=small{Value}},
columns/double/.style={column name=small{Double}},
% requires booktabs to place horiz rules
every head row/.style={before row={caption{#2 label{table:#3}} \ caption*{(a) First subtable} \ toprule 
 multicolumn{3}{|c|}{Numbers} \ midrule}, after row=midrule},
every last row/.style={after row=bottomrule},
every first column/.style={column type/.add={|}{}},
every column/.style={column type/.add={}{|}},
]{#1}

end{minipage}

noindentbegin{minipage}{textwidth}
pgfplotstabletypeset[col sep=space,
header=false,    
columns={0,1},      % display specified columns
columns/0/.style={string type,column name=},
columns/1/.style={column name=small{Value}},
% requires booktabs to place horiz rules
every head row/.style={before row={caption*{(b) Second subtable} \ toprule  
   multicolumn{2}{|c|}{Numbers} \ midrule }, after row=midrule}, 
every last row/.style={after row=bottomrule},
every first column/.style={column type/.add={|}{}},
every column/.style={column type/.add={}{|}},
]{#1}
end{minipage}

}

end{document}

Minimal data file:

One 1
Two 2
Three 3

As far as I understand, the problem is related to longtable not accepting subcaptions but I do not know how to build my table in a different way.

I have found related questions like this and this but they do not solve my issue.