1

I use long table in overleaf across multiple pages. However, I need to put single-spacing caption description below the table. In principle, I want to describe the table legend. I would like my caption title to be at the begining of the table (field requirement) and caption description (description of the table legend) bellow the table (at the table end).

Anyone knows how to do it?

\usepackage[labelfont=bf]{caption}
\usepackage[format=plain]{caption}
\usepackage{longtable}
\usepackage{ltablex}
\usepackage{tabularx}
\usepackage{tabulary} % Automatic table sizing
\usepackage{tabularx,booktabs}
\usepackage{graphicx, array, blindtext}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{hhline}


\begin{document}
        \LTcapwidth=\textwidth
    \renewcommand\arraystretch{0.58}
    \begin{longtable}{c c c} 
    \caption{Chemical similarity between selected analogs and KGA inhibitors.} 
    \label{tab:61analogs}
    
    %\setlength{\tabcolsep}{6pt}\\
    %\renewcommand{\arraystretch}{0.1}\\
    %\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}\\
    \hline
    \textbf{Compound ID} & \textbf{To ZINC00000169698697} & \textbf{To other inhibitors} \\
    \hline
    \endfirsthead
    \multicolumn{3}{c}%
    {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
    \hline
    \textbf{Compound ID} & \textbf{Second entry} & \textbf{Third entry} \\
    \hline
    \endhead
    \hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
    \endfoot
    \hline
    \endlastfoot
    25019940 & 0.58 & 0.47 \\
    5164097 & 0.66 & 0.48 \\
    1738866 & 0.62 & 0.47 \\
    20105225 & 0.62 & 0.49 \\
    3110202 & 0.75 & 0.45 \\
    3110206 & 0.73 & 0.62 \\
    4867157 & 0.69 & 0.54 \\
    4304409 & 0.76 & 0.54 \\
    5151381 & 0.76 & 0.49 \\
    3101013 & 0.73 & 0.53 \\
    3100996 & 0.71 & 0.53 \\
    3101001 & 0.71 & 0.36 \\
    19165041 & 0.60 & 0.55 \\
    74982828 & 0.95 & 0.59 \\
    2959312 & 0.62 & 0.42 \\
    25287769 & 0.54 & 0.42 \\
    25287770 & 0.54 & 0.51 \\
    5222294 & 0.65 & 0.60 \\
    1256772 & 0.67 & 0.59 \\
    5080634 & 0.66 & 0.59 \\
    1146140 & 0.69 & 0.35 \\
    5081393 & 0.58 & 0.41 \\
    3463344 & 0.63 & 0.49 \\
    3649210 & 0.73 & 0.49 \\
    3101002 & 0.73 & 0.48 \\
    3100991 & 0.68 & 0.39 \\
    100382946 & 0.54 & 0.41 \\
    100232025 & 0.53 & 0.35 \\
    124451668 & 0.58 & 0.48 \\
    3720795 & 0.67 & 0.59 \\
    16678941 & 0.54 & 0.66 \\
    24593477 & 0.63 & 0.65 \\
    53198065 & 0.68 & 0.48 \\
    4054374 & 0.64 & 0.45 \\
    4573030 & 0.70 & 0.66 \\
    46199646 & 0.43 & 0.41 \\
    1261915 & 0.65 & 0.53 \\
    51065402 & 0.57 & 0.47 \\
    4313682 & 0.63 & 0.46 \\
    40732500 & 0.70 & 0.46 \\
    40732501 & 0.70 & 0.65 \\
    11497983 & 0.64 & 0.52 \\
    20933064 & 0.61 & 0.43 \\
    4387920 & 0.63 & 0.47 \\
    4575072 & 0.65 & 0.42 \\
    40462013 & 0.55 & 0.42 \\
    40462014 & 0.55 & 0.67 \\
    28790638 & 0.73 & 0.67 \\
    28790635 & 0.73 & 0.60 \\
    51134141 & 0.63 & 0.66 \\
    26351270 & 0.65 & 0.57 \\
    16194825 & 0.62 & 0.71 \\
    26324089 & 0.68 & 0.55 \\
    125980034 & 0.68 & 0.49 \\
    42176161 & 0.69 & 0.48 \\
    42176160 & 0.68 & 0.67 \\
    24569294 & 0.64 & 0.44 \\
    3101014 & 0.71 & 0.48 \\
    3587610 & 0.71 & 0.49 \\
    3100992 & 0.68 & 0.49 \\
    995167 & 0.64 & 0.44 \\
    \end{longtable}
    \justify{\textbf{Compound ID}, ID of the compound taken from XXX. \textbf{To XXXX}, chemical XXXX values measured between 61 analogs and the most potent XXXXXX. \textbf{To remaining inhibitors}, chemical similarity values measured between 61 XXXX and the remaining 4 XXXX inhibitors.}
\end{document}
3
  • 2
    unfortunately your MWE is not complete, please add a documentclass, necessary packages as well as \begin{document} and \end{document} so that we can copy your MWE (Minimal Working Example) and compile it without having to guess anything and help you better. And welcome to TeX.SE!
    – Lukas
    Sep 25, 2021 at 8:22
  • 2
    Please clarify what you mean by "caption description". E.g., a single-llne caption, a multiline single-spaced caption, or a single-spaced legend that provides some explanatory information for the table (and possibly the table's caption)? And please clarify what you're trying to achieve with \renewcommand\arraystretch{0.58}. Finallly, is "ZINC00000169698697" a real word?
    – Mico
    Sep 25, 2021 at 9:05
  • I mean to describe the legend. I did not know how to describe the legend in the table. I wanted to describe it in the bottom/end of the table.
    – sergio
    Sep 25, 2021 at 12:17

3 Answers 3

4

Here are three alternative versions of your table:

In the first one, I used a combination of longtable to allow the table to span multiple pages in combination with the threeparttablex package for the descriptive text below the table.

enter image description here

I also included two other alternatives that both make sure the table fits onto a single page by showing not only three columns, but two sets of three column side by side. Since the column's entries are quite narrow, you could introduce linebreaks in the column headers (for example with the help of the \thead command from the makecell package) and fit the second half of the table right next to the first half. This allows you to save space without having to compress the table's contents. I also used horizontal lines from the booktabs package as well as \addlinespace in order to provide a guide to the eye and make the table more readable.

enter image description here

The second alternative makes sure, the table is as wide as the textwidth and the explanatory text is just placed inside of the table environment. \smallskip adds a small amount of vertical white space between the bottom of the table and the start of the explanatory text.

In the third and last alternative, I kept the table at its natural width and used threeparttable in order to make sure the explanatory text below the table is as wide as the table naturally is. I also tried to provide more structure to the descriptive text by starting each item in a new line.

\documentclass{article}
\usepackage[labelfont=bf, format=plain]{caption}
\usepackage{longtable}
\usepackage{tabularx,booktabs}

\usepackage{threeparttablex}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}

\begin{document}
\LTcapwidth=\textwidth
\begin{ThreePartTable}
\begin{TableNotes}[flushleft]
\setlength\labelsep{0pt}
\footnotesize
\item[]     \textbf{Compound ID}, ID of the compound taken from XXX. 
\textbf{To XXXX}, chemical XXXX values measured between 61 analogs and the most potent XXXXXX. \textbf{To remaining inhibitors}, chemical similarity values measured between 61 XXXX and the remaining 4 XXXX inhibitors.
\end{TableNotes}
    \begin{longtable}{c c c} 
    \caption{Chemical similarity between selected analogs and KGA inhibitors.} 
    \label{tab:61analogs}\\
    \hline
    \textbf{Compound ID} & \textbf{To ZINC00000169698697} & \textbf{To other inhibitors} \\
    \hline
    \endfirsthead
    \multicolumn{3}{c}%
    {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
    \hline
    \textbf{Compound ID} & \textbf{Second entry} & \textbf{Third entry} \\
    \hline
    \endhead
    \hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
    \endfoot
    \hline
    \insertTableNotes
    \endlastfoot
    25019940 & 0.58 & 0.47 \\
    5164097 & 0.66 & 0.48 \\
    1738866 & 0.62 & 0.47 \\
    20105225 & 0.62 & 0.49 \\
    3110202 & 0.75 & 0.45 \\
    3110206 & 0.73 & 0.62 \\
    4867157 & 0.69 & 0.54 \\
    4304409 & 0.76 & 0.54 \\
    5151381 & 0.76 & 0.49 \\
    3101013 & 0.73 & 0.53 \\
    3100996 & 0.71 & 0.53 \\
    3101001 & 0.71 & 0.36 \\
    19165041 & 0.60 & 0.55 \\
    74982828 & 0.95 & 0.59 \\
    2959312 & 0.62 & 0.42 \\
    25287769 & 0.54 & 0.42 \\
    25287770 & 0.54 & 0.51 \\
    5222294 & 0.65 & 0.60 \\
    1256772 & 0.67 & 0.59 \\
    5080634 & 0.66 & 0.59 \\
    1146140 & 0.69 & 0.35 \\
    5081393 & 0.58 & 0.41 \\
    3463344 & 0.63 & 0.49 \\
    3649210 & 0.73 & 0.49 \\
    3101002 & 0.73 & 0.48 \\
    3100991 & 0.68 & 0.39 \\
    100382946 & 0.54 & 0.41 \\
    100232025 & 0.53 & 0.35 \\
    124451668 & 0.58 & 0.48 \\
    3720795 & 0.67 & 0.59 \\
    16678941 & 0.54 & 0.66 \\
    24593477 & 0.63 & 0.65 \\
    53198065 & 0.68 & 0.48 \\
    4054374 & 0.64 & 0.45 \\
    4573030 & 0.70 & 0.66 \\
    46199646 & 0.43 & 0.41 \\
    1261915 & 0.65 & 0.53 \\
    51065402 & 0.57 & 0.47 \\
    4313682 & 0.63 & 0.46 \\
    40732500 & 0.70 & 0.46 \\
    40732501 & 0.70 & 0.65 \\
    11497983 & 0.64 & 0.52 \\
    20933064 & 0.61 & 0.43 \\
    4387920 & 0.63 & 0.47 \\
    4575072 & 0.65 & 0.42 \\
    40462013 & 0.55 & 0.42 \\
    40462014 & 0.55 & 0.67 \\
    28790638 & 0.73 & 0.67 \\
    28790635 & 0.73 & 0.60 \\
    51134141 & 0.63 & 0.66 \\
    26351270 & 0.65 & 0.57 \\
    16194825 & 0.62 & 0.71 \\
    26324089 & 0.68 & 0.55 \\
    125980034 & 0.68 & 0.49 \\
    42176161 & 0.69 & 0.48 \\
    42176160 & 0.68 & 0.67 \\
    24569294 & 0.64 & 0.44 \\
    3101014 & 0.71 & 0.48 \\
    3587610 & 0.71 & 0.49 \\
    3100992 & 0.68 & 0.49 \\
    995167 & 0.64 & 0.44 \\
    \end{longtable}
    \end{ThreePartTable}

    \begin{table}
    \caption{Chemical similarity between selected analogs and KGA inhibitors.} 
    \label{tab:61analogs}
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l c c lcc} 
    \toprule
    \thead{Compound\\ ID} & \thead{Second\\ entry} & \thead{Third\\ entry} & \thead{Compound\\ ID} & \thead{Second\\ entry} & \thead{Third\\ entry} \\
    \cmidrule(r){1-3} \cmidrule(l){4-6}
    25019940 & 0.58 & 0.47  &   24593477 & 0.63 & 0.65  \\
    5164097 & 0.66 & 0.48   &   53198065 & 0.68 & 0.48  \\
    1738866 & 0.62 & 0.47   &   4054374 & 0.64 & 0.45   \\
    20105225 & 0.62 & 0.49  &   4573030 & 0.70 & 0.66   \\
    3110202 & 0.75 & 0.45   &   46199646 & 0.43 & 0.41  \\ \addlinespace
    3110206 & 0.73 & 0.62   &   1261915 & 0.65 & 0.53   \\
    4867157 & 0.69 & 0.54   &   51065402 & 0.57 & 0.47  \\
    4304409 & 0.76 & 0.54   &   4313682 & 0.63 & 0.46   \\
    5151381 & 0.76 & 0.49   &   40732500 & 0.70 & 0.46  \\
    3101013 & 0.73 & 0.53   &   40732501 & 0.70 & 0.65  \\ \addlinespace
    3100996 & 0.71 & 0.53   &   11497983 & 0.64 & 0.52  \\
    3101001 & 0.71 & 0.36   &   20933064 & 0.61 & 0.43  \\
    19165041 & 0.60 & 0.55  &   4387920 & 0.63 & 0.47   \\
    74982828 & 0.95 & 0.59  &   4575072 & 0.65 & 0.42   \\
    2959312 & 0.62 & 0.42   &   40462013 & 0.55 & 0.42  \\ \addlinespace
    25287769 & 0.54 & 0.42  &   40462014 & 0.55 & 0.67  \\
    25287770 & 0.54 & 0.51  &   28790638 & 0.73 & 0.67  \\
    5222294 & 0.65 & 0.60   &   28790635 & 0.73 & 0.60  \\
    1256772 & 0.67 & 0.59   &   51134141 & 0.63 & 0.66  \\
    5080634 & 0.66 & 0.59   &   26351270 & 0.65 & 0.57  \\ \addlinespace
    1146140 & 0.69 & 0.35   &   16194825 & 0.62 & 0.71  \\
    5081393 & 0.58 & 0.41   &   26324089 & 0.68 & 0.55  \\
    3463344 & 0.63 & 0.49   &   125980034 & 0.68 & 0.49 \\
    3649210 & 0.73 & 0.49   &   42176161 & 0.69 & 0.48  \\
    3101002 & 0.73 & 0.48   &   42176160 & 0.68 & 0.67  \\ \addlinespace
    3100991 & 0.68 & 0.39   &   24569294 & 0.64 & 0.44  \\
    100382946 & 0.54 & 0.41 &   3101014 & 0.71 & 0.48   \\
    100232025 & 0.53 & 0.35 &   3587610 & 0.71 & 0.49   \\
    124451668 & 0.58 & 0.48 &   3100992 & 0.68 & 0.49   \\
    3720795 & 0.67 & 0.59   &   995167 & 0.64 & 0.44    \\ \addlinespace
    16678941 & 0.54 & 0.66  \\
    \bottomrule
    \end{tabular*}
    \smallskip
    
\textbf{Compound ID}, ID of the compound taken from XXX. 
\textbf{To XXXX}, chemical XXXX values measured between 61 analogs and the most potent XXXXXX. \textbf{To remaining inhibitors}, chemical similarity values measured between 61 XXXX and the remaining 4 XXXX inhibitors.
    \end{table}
    
    \begin{table}
    \centering
    \begin{threeparttable}
    \caption{Chemical similarity between selected analogs and KGA inhibitors.} 
    \label{tab:61analogs}
    \begin{tabular}{l c c lcc} 
    \toprule
    \thead{Compound\\ ID} & \thead{Second\\ entry} & \thead{Third\\ entry} & \thead{Compound\\ ID} & \thead{Second\\ entry} & \thead{Third\\ entry} \\
    \cmidrule(r){1-3} \cmidrule(l){4-6}
    25019940 & 0.58 & 0.47  &   24593477 & 0.63 & 0.65  \\
    5164097 & 0.66 & 0.48   &   53198065 & 0.68 & 0.48  \\
    1738866 & 0.62 & 0.47   &   4054374 & 0.64 & 0.45   \\
    20105225 & 0.62 & 0.49  &   4573030 & 0.70 & 0.66   \\
    3110202 & 0.75 & 0.45   &   46199646 & 0.43 & 0.41  \\ \addlinespace
    3110206 & 0.73 & 0.62   &   1261915 & 0.65 & 0.53   \\
    4867157 & 0.69 & 0.54   &   51065402 & 0.57 & 0.47  \\
    4304409 & 0.76 & 0.54   &   4313682 & 0.63 & 0.46   \\
    5151381 & 0.76 & 0.49   &   40732500 & 0.70 & 0.46  \\
    3101013 & 0.73 & 0.53   &   40732501 & 0.70 & 0.65  \\ \addlinespace
    3100996 & 0.71 & 0.53   &   11497983 & 0.64 & 0.52  \\
    3101001 & 0.71 & 0.36   &   20933064 & 0.61 & 0.43  \\
    19165041 & 0.60 & 0.55  &   4387920 & 0.63 & 0.47   \\
    74982828 & 0.95 & 0.59  &   4575072 & 0.65 & 0.42   \\
    2959312 & 0.62 & 0.42   &   40462013 & 0.55 & 0.42  \\ \addlinespace
    25287769 & 0.54 & 0.42  &   40462014 & 0.55 & 0.67  \\
    25287770 & 0.54 & 0.51  &   28790638 & 0.73 & 0.67  \\
    5222294 & 0.65 & 0.60   &   28790635 & 0.73 & 0.60  \\
    1256772 & 0.67 & 0.59   &   51134141 & 0.63 & 0.66  \\
    5080634 & 0.66 & 0.59   &   26351270 & 0.65 & 0.57  \\ \addlinespace
    1146140 & 0.69 & 0.35   &   16194825 & 0.62 & 0.71  \\
    5081393 & 0.58 & 0.41   &   26324089 & 0.68 & 0.55  \\
    3463344 & 0.63 & 0.49   &   125980034 & 0.68 & 0.49 \\
    3649210 & 0.73 & 0.49   &   42176161 & 0.69 & 0.48  \\
    3101002 & 0.73 & 0.48   &   42176160 & 0.68 & 0.67  \\ \addlinespace
    3100991 & 0.68 & 0.39   &   24569294 & 0.64 & 0.44  \\
    100382946 & 0.54 & 0.41 &   3101014 & 0.71 & 0.48   \\
    100232025 & 0.53 & 0.35 &   3587610 & 0.71 & 0.49   \\
    124451668 & 0.58 & 0.48 &   3100992 & 0.68 & 0.49   \\
    3720795 & 0.67 & 0.59   &   995167 & 0.64 & 0.44    \\ \addlinespace
    16678941 & 0.54 & 0.66  \\
    \bottomrule
    \end{tabular}
    \begin{tablenotes}[flushleft]
\setlength\labelsep{0pt}
\footnotesize
    \item[]\textbf{Compound ID}, ID of the compound taken from XXX. 
    \item[]\textbf{To XXXX}, chemical XXXX values measured between 61 analogs and the most potent XXXXXX. 
    \item[]\textbf{To remaining inhibitors}, chemical similarity values measured between 61 XXXX and the remaining 4 XXXX inhibitors.
    \end{tablenotes}
    \end{threeparttable}

    \end{table}
\end{document}
1
  • You have some serious skills man/woman. Thank you as you provide an answers to the question I posted.
    – sergio
    Sep 26, 2021 at 8:45
2

A variation of the second example in the @leandriis answer (+1) with:

  • use tabularray package with
    • talltablr table
    • booktabs tabularray library
    • use of a \NewTblrTheme
    • use of a \NewChildSelector
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
%
\NewTblrTheme{fancy}{
\SetTblrStyle{head}{font=\small}
\SetTblrStyle{foot}{font=\footnotesize}
\SetTblrStyle{caption-tag}{font=\bfseries}
                    }
  \ExplSyntaxOn
\NewChildSelector{eachfour}
  {
    \int_step_inline:nnnn {1}{4}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{table}[ht]
%
   \centering
    \begin{talltblr}[
  theme = fancy,
caption = {Chemical similarity between selected analogs and KGA inhibitors.},
  label = {tab:61analogs},
note{a} = {ZINC00000169698697},
                    ]{colspec = {@{} *{2}{l c c} @{}},
                      rowsep =0pt,
                      row{1} = {font=\bfseries},
                      row{eachfour} = {belowsep=1ex},
                      }
% columns headers
    \toprule
\SetCell[c=1]{c}{Compound\\ ID}
            & {To\\ ZINC\TblrNote{a}}
                   & {To other\\ inhibitors}
                          & \SetCell[c=1]{c}{Compound\\ ID}
                                        & {To\\ ZINC\TblrNote{a}}
                                               & {To other\\ inhibitors}   \\
    \cmidrule[r=-0.9]{1-3}
    \cmidrule[l=-0.9]{4-6}
% table body
25019940    & 0.58 & 0.47 & 24593477    & 0.63 & 0.65 \\
5164097     & 0.66 & 0.48 & 53198065    & 0.68 & 0.48 \\
1738866     & 0.62 & 0.47 & 4054374     & 0.64 & 0.45 \\
20105225    & 0.62 & 0.49 & 4573030     & 0.70 & 0.66 \\
3110202     & 0.75 & 0.45 & 46199646    & 0.43 & 0.41 \\
3110206     & 0.73 & 0.62 & 1261915     & 0.65 & 0.53 \\
4867157     & 0.69 & 0.54 & 51065402    & 0.57 & 0.47 \\
4304409     & 0.76 & 0.54 & 4313682     & 0.63 & 0.46 \\
5151381     & 0.76 & 0.49 & 40732500    & 0.70 & 0.46 \\
3101013     & 0.73 & 0.53 & 40732501    & 0.70 & 0.65 \\
3100996     & 0.71 & 0.53 & 11497983    & 0.64 & 0.52 \\
3101001     & 0.71 & 0.36 & 20933064    & 0.61 & 0.43 \\
19165041    & 0.60 & 0.55 & 4387920     & 0.63 & 0.47 \\
74982828    & 0.95 & 0.59 & 4575072     & 0.65 & 0.42 \\
2959312     & 0.62 & 0.42 & 40462013    & 0.55 & 0.42 \\
25287769    & 0.54 & 0.42 & 40462014    & 0.55 & 0.67 \\
25287770    & 0.54 & 0.51 & 28790638    & 0.73 & 0.67 \\
5222294     & 0.65 & 0.60 & 28790635    & 0.73 & 0.60 \\
1256772     & 0.67 & 0.59 & 51134141    & 0.63 & 0.66 \\
5080634     & 0.66 & 0.59 & 26351270    & 0.65 & 0.57 \\
1146140     & 0.69 & 0.35 & 16194825    & 0.62 & 0.71 \\
5081393     & 0.58 & 0.41 & 26324089    & 0.68 & 0.55 \\
3463344     & 0.63 & 0.49 & 125980034   & 0.68 & 0.49 \\
3649210     & 0.73 & 0.49 & 42176161    & 0.69 & 0.48 \\
3101002     & 0.73 & 0.48 & 42176160    & 0.68 & 0.67 \\
3100991     & 0.68 & 0.39 & 24569294    & 0.64 & 0.44 \\
100382946   & 0.54 & 0.41 & 3101014     & 0.71 & 0.48 \\
100232025   & 0.53 & 0.35 & 3587610     & 0.71 & 0.49 \\
124451668   & 0.58 & 0.48 & 3100992     & 0.68 & 0.49 \\
3720795     & 0.67 & 0.59 & 995167      & 0.64 & 0.44 \\
16678941    & 0.54 & 0.66 &             &      &      \\
    \bottomrule
    \end{talltblr}
\end{table}
\end{document}

enter image description here

(red lines indicate text area borders)

1
\documentclass{article}

\usepackage[labelfont=bf, format=plain]{caption}
%\usepackage[format=plain]{caption}
\usepackage{longtable}
%\usepackage{ltablex}
%\usepackage{tabularx}
%\usepackage{tabulary} % Automatic table sizing
%\usepackage{tabularx,booktabs}
%\usepackage{graphicx, array, blindtext}
%\usepackage[utf8]{inputenc}
%\usepackage{graphicx}
%\usepackage{tabularx}
%\usepackage{multirow}
%\usepackage{hhline}

\begin{document}
    \LTcapwidth=\textwidth
    \renewcommand\arraystretch{1}
        \begin{longtable}{c c c} 
            %\setlength{\tabcolsep}{6pt}\\
            %\renewcommand{\arraystretch}{0.1}\\
            %\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}\\
            \hline
            \textbf{Compound ID} & \textbf{To ZINC00000169698697} & \textbf{To other inhibitors} \\
            \hline
            \endfirsthead
            \multicolumn{3}{c}%
            {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
            \hline
            \textbf{Compound ID} & \textbf{Second entry} & \textbf{Third entry} \\
            \hline
            \endhead
            \hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
            \endfoot
            \hline
            \caption{Chemical similarity between selected analogs and KGA inhibitors.} \label{tab:61analogs} % changed position of caption
            \endlastfoot
            25019940 & 0.58 & 0.47 \\
            5164097 & 0.66 & 0.48 \\
            1738866 & 0.62 & 0.47 \\
            20105225 & 0.62 & 0.49 \\
            3110202 & 0.75 & 0.45 \\
            3110206 & 0.73 & 0.62 \\
            4867157 & 0.69 & 0.54 \\
            4304409 & 0.76 & 0.54 \\
            5151381 & 0.76 & 0.49 \\
            3101013 & 0.73 & 0.53 \\
            3100996 & 0.71 & 0.53 \\
            3101001 & 0.71 & 0.36 \\
            19165041 & 0.60 & 0.55 \\
            74982828 & 0.95 & 0.59 \\
            2959312 & 0.62 & 0.42 \\
            25287769 & 0.54 & 0.42 \\
            25287770 & 0.54 & 0.51 \\
            5222294 & 0.65 & 0.60 \\
            1256772 & 0.67 & 0.59 \\
            5080634 & 0.66 & 0.59 \\
            1146140 & 0.69 & 0.35 \\
            5081393 & 0.58 & 0.41 \\
            3463344 & 0.63 & 0.49 \\
            3649210 & 0.73 & 0.49 \\
            3101002 & 0.73 & 0.48 \\
            3100991 & 0.68 & 0.39 \\
            100382946 & 0.54 & 0.41 \\
            100232025 & 0.53 & 0.35 \\
            124451668 & 0.58 & 0.48 \\
            3720795 & 0.67 & 0.59 \\
            16678941 & 0.54 & 0.66 \\
            24593477 & 0.63 & 0.65 \\
            53198065 & 0.68 & 0.48 \\
            4054374 & 0.64 & 0.45 \\
            4573030 & 0.70 & 0.66 \\
            46199646 & 0.43 & 0.41 \\
            1261915 & 0.65 & 0.53 \\
            51065402 & 0.57 & 0.47 \\
            4313682 & 0.63 & 0.46 \\
            40732500 & 0.70 & 0.46 \\
            40732501 & 0.70 & 0.65 \\
            11497983 & 0.64 & 0.52 \\
            20933064 & 0.61 & 0.43 \\
            4387920 & 0.63 & 0.47 \\
            4575072 & 0.65 & 0.42 \\
            40462013 & 0.55 & 0.42 \\
            40462014 & 0.55 & 0.67 \\
            28790638 & 0.73 & 0.67 \\
            28790635 & 0.73 & 0.60 \\
            51134141 & 0.63 & 0.66 \\
            26351270 & 0.65 & 0.57 \\
            16194825 & 0.62 & 0.71 \\
            26324089 & 0.68 & 0.55 \\
            125980034 & 0.68 & 0.49 \\
            42176161 & 0.69 & 0.48 \\
            42176160 & 0.68 & 0.67 \\
            24569294 & 0.64 & 0.44 \\
            3101014 & 0.71 & 0.48 \\
            3587610 & 0.71 & 0.49 \\
            3100992 & 0.68 & 0.49 \\
            995167 & 0.64 & 0.44 \\ \hline
        \end{longtable}
\end{document}

What you have to be careful about: you load some packages multiple times, I commented out some packages that were not required as well as I added the option format=plain to your first call of the package caption.

Loading \package[UTF8]{inputenc} should no longer be required if you use a relatively up-to-date version of LaTeX.

One last thing that caught my eyes: your choice of \renewcommand\arraystretch{0.58} (so currently 0.58) made your longtable really cramped, you might consider allowing a bigger arraystretch (I changed the arraystretch to 1 for demonstration purposes).

10
  • 3
    What's the purpose of longtable inside of table? A table can not break across pages, so you could use a regular tabular inside of the table environment.
    – leandriis
    Sep 25, 2021 at 9:06
  • you're right, I updated my MWE accordingly, thank you very much
    – Lukas
    Sep 25, 2021 at 9:12
  • 1
    If I try to compile your code, I get a "dimension too large" error message, which is caused by the fact that you're not allowing the table to break across pages.
    – Mico
    Sep 25, 2021 at 9:15
  • thank you very much, I updated it accordingly
    – Lukas
    Sep 25, 2021 at 9:20
  • 1
    You may want to remove/replace the introductory sentence to your answer as it no longer corrensponds to the MWE. You may also want to adjust the part between \endfirsthead and \endhead as the caption "continued from previous page" on the second page looks quite odd with the actual caption just below it.
    – leandriis
    Sep 25, 2021 at 9:30

You must log in to answer this question.

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