TransWikia.com

Using a footnote multiple times in tabular* environment with desired symbols

TeX - LaTeX Asked by tcokyasar on June 29, 2021

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.7times 10^{-5}$ & $2.0times 10^{-5}$ & $3.4times 10^{-5}$ & 15.06 & 14.04 & 23.87 
    & 10 & 25 & $8.8times 10^{-5}$ & $5.9times 10^{-5}$ & $2.5times 10^{-2}$ & 19.10 & 26.04 & 207.09 
    & 15 & 10 & $9.4times 10^{-5}$ & $6.5times 10^{-5}$ & $7.6times 10^{-2}$ & 28.35 & 74.89 & 300.00 
    & 20 & 5 & $1.1times 10^{-4}$ & $2.2times 10^{-5}$ & $11.9times 10^{-2}$ & 112.9 & 464.6 & 600.00 
    & 25 & 5 & $2.2times 10^{-4}$ & $9.1times 10^{-5}$ & $11.2times 10^{-2}$ & 123.7 & 314.6 & 600.00 
    bottomrule
    end{tabular*}}
end{table}
end{document}

One Answer

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.09tnote{*} 
                        & 15 & 10 & 9.4 E-5 & 6.5 E-5 &  7.6 E-2 & 28.35 & 74.89 & 300.00tnote{*} 
                        & 20 & 5  & 1.1 E-4 & 2.2 E-5 & 11.9 E-2 & 112.9 & 464.6 & 600.00tnote{+} 
                        & 25 & 5  & 2.2 E-4 & 9.1 E-5 & 11.2 E-2 & 123.7 & 314.6 & 600.00tnote{+} 
    bottomrule
    end{tabular*}
    begin{tablenotes}
    item[*] text 
    item[+] other text
    end{tablenotes}
end{threeparttable}
end{table}
end{document}

Correct answer by leandriis on June 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP