0

I have the following table, which I still keep filling. I would like to add footnotes to several places. For instance, for rows 2 (207.09) and 3 (300.00) of the Nonlinear column, I want to add the same footnote (say note1), and for rows 4 (600.00) and 5 (600.00) of the same column, I want another footnote (say note2). Also, I would prefer customizable footnote symbols like *, +, etc.

I tried several methods that were readily given as answers. Some solutions include threeparttable and scrextend packages. I also tried others, but they did not work (got errors) probably because of tabular*.

\documentclass[review]{elsarticle}
\usepackage[colorlinks]{hyperref}
\usepackage{xcolor}
\usepackage{lineno}
\usepackage{amsmath,amsthm,amssymb,enumitem,nccmath}
\usepackage{graphicx,geometry,tabularx,tabulary}
\usepackage{booktabs,mathtools,multirow,relsize,subfig,mwe}
\usepackage{newtxmath}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{threeparttable}
\begin{table}
    \caption{Solution statistics for computational experiments.}\label[tab]{comp_res}
    {\begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} cccccccc}
    \toprule 
    \multirow{2}{*}{$|\setI|$} & \multirow{2}{*}{$|\setK|$} & \multirow{2}{*}{Instances} & \multicolumn{3}{c}{Average Gap}  & \multicolumn{3}{c}{Average Time (s)} \\ \cline{4-9}
    & & & \multicolumn{1}{c}{Cut} & \multicolumn{1}{c}{User cut} & \multicolumn{1}{c}{Nonlinear} & \multicolumn{1}{c}{Cut} & \multicolumn{1}{c}{User cut} & \multicolumn{1}{c}{Nonlinear} \\
    \midrule
    \multirow{6}{*}{40} & 5 & 50 & $3.7\times 10^{-5}$ & $2.0\times 10^{-5}$ & $3.4\times 10^{-5}$ & 15.06 & 14.04 & 23.87 \\
    & 10 & 25 & $8.8\times 10^{-5}$ & $5.9\times 10^{-5}$ & $2.5\times 10^{-2}$ & 19.10 & 26.04 & 207.09 \\
    & 15 & 10 & $9.4\times 10^{-5}$ & $6.5\times 10^{-5}$ & $7.6\times 10^{-2}$ & 28.35 & 74.89 & 300.00 \\
    & 20 & 5 & $1.1\times 10^{-4}$ & $2.2\times 10^{-5}$ & $11.9\times 10^{-2}$ & 112.9 & 464.6 & 600.00 \\
    & 25 & 5 & $2.2\times 10^{-4}$ & $9.1\times 10^{-5}$ & $11.2\times 10^{-2}$ & 123.7 & 314.6 & 600.00 \\
    \bottomrule
    \end{tabular*}}
\end{table}
\end{document}
6
  • Do you want table notes (after the last row) or standard footnotes (at the bottom of the page)?
    – Bernard
    Sep 27 '20 at 8:22
  • It was after the last row.
    – tcokyasar
    Sep 27 '20 at 14:43
  • The solution was given by @leandriis, with threeparttable, as long as the table does not have to break across pages.
    – Bernard
    Sep 27 '20 at 14:48
  • Well, it does not. But, I (future I and others) would be interested in seeing your solution method as well.
    – tcokyasar
    Sep 27 '20 at 15:30
  • 1
    It would be strictly the same. Only in the case of a longtable, there would be some differences, because threparttable doesn't work in this case, and has to be replaces with threeparttablex and its ThreePartTable & TableNotes environments, which use a slightly different syntax.
    – Bernard
    Sep 27 '20 at 16:39
0

In the following example, I have used \tnote and the tablenotes environment for the table notes, added siunitx in order to improve the input and alignment of numbers in the table, replaced the \cline command with two \cmidrule commands in order to improve the visual separation between the two blocks of three columns.

In addition, I removed the optional argument of the \label command since this caused "tab]{comp_res}" to be printed above the table in the resulting pdf file. I also placed the hyperref package at the end of the preamble since this package should (with a few exceptions) be the lat package you load. Lastly, I also had to replace \setK and \setI since the definitions of there commands was not given in the original example code.

enter image description here

\documentclass[review]{elsarticle}

\usepackage{xcolor}
\usepackage{lineno}
\usepackage{amsmath,amsthm,amssymb,enumitem,nccmath}
\usepackage{graphicx,geometry,tabularx,tabulary}
\usepackage{booktabs,mathtools,multirow,relsize,subfig,mwe}
\usepackage{newtxmath}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{threeparttable}
\usepackage{siunitx}

\usepackage[colorlinks]{hyperref} % Should be the last package in the preamble (with a few exceptions)

\begin{document}
\begin{table}
\begin{threeparttable}
    \caption{Solution statistics for computational experiments.}\label[tabl]{compres}
    \begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} 
                                 c
                                 S[table-format=2]
                                 S[table-format=1.1e-1]
                                 S[table-format=1.1e-1]
                                 S[table-format=2.1e-1]
                                 S[table-format=3.2]
                                 S[table-format=3.2]
                                 S[table-format=3.2,table-space-text-post=\tnote{+}]
                                 }
    \toprule 
    \multirow{2}{*}{$|I|$} 
      & \multirow{2}{*}{$|K|$} 
        & {\multirow{2}{*}{Instances}} 
          & \multicolumn{3}{c}{Average Gap} 
             & \multicolumn{3}{c}{Average Time (s)} \\ 
     \cmidrule(r){4-6} \cmidrule(l){7-9}
      & & 
        & \multicolumn{1}{c}{Cut} 
          & \multicolumn{1}{c}{User cut} 
            & \multicolumn{1}{c}{Nonlinear} 
              & \multicolumn{1}{c}{Cut} 
                & \multicolumn{1}{c}{User cut} 
                  & \multicolumn{1}{c}{Nonlinear} \\
    \midrule
    \multirow{5}{*}{40} & 5  & 50 & 3.7 E-5 & 2.0 E-5 &  3.4 E-5 & 15.06 & 14.04 & 23.87 \\
                        & 10 & 25 & 8.8 E-5 & 5.9 E-5 &  2.5 E-2 & 19.10 & 26.04 & 207.09\tnote{*} \\
                        & 15 & 10 & 9.4 E-5 & 6.5 E-5 &  7.6 E-2 & 28.35 & 74.89 & 300.00\tnote{*} \\
                        & 20 & 5  & 1.1 E-4 & 2.2 E-5 & 11.9 E-2 & 112.9 & 464.6 & 600.00\tnote{+} \\
                        & 25 & 5  & 2.2 E-4 & 9.1 E-5 & 11.2 E-2 & 123.7 & 314.6 & 600.00\tnote{+} \\
    \bottomrule
    \end{tabular*}
    \begin{tablenotes}
    \item[*] text 
    \item[+] other text
    \end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
2
  • I really appreciate for your time. Only one issue is remaining. When I add the following row & 50 & 5 & 2.8 E-4 & 2.8 E-2 & 5.8 E-2 & 1236.0 & 3600.0 & 3600.0 \\ and try to use comma separators for 1236 and 3600s, an error shows up. To fix it, I tried this: tex.stackexchange.com/questions/6104/… but got other errors. Can you also help for that?
    – tcokyasar
    Sep 27 '20 at 15:24
  • Nvm, this (stackoverflow.com/questions/55882681/…) solved that issue. Thanks a lot!
    – tcokyasar
    Sep 27 '20 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.