TransWikia.com

How to add the table notes in my table?

TeX - LaTeX Asked by Yao Zhao on November 15, 2020

documentclass[preprint,floatfix] {revtex4} 
usepackage{caption}
usepackage{booktabs}

begin{document}

renewcommand{thetable}{arabic{table}}

begingroup
squeezetable
begin{table}
captionsetup{font=scriptsize}
caption {label{tab:table1} SUMMARY STATISTICS FOR CONTRIBUTIONS BY INDIVIDUAL CONTRIBUTORS}
begin{ruledtabular}
begin{tabular}{llllll}
  & multicolumn{2}{c}{Pre-block}  & multicolumn{2}{c}{Post-block} & Paired textit{t}-test    
cline{2-3} cline{4-5} cline{6-6}

        &  Mean   & Standard error                                                  &   Mean          
    & Standard error    & textit{t}-stats                                                      hline




input{table1_panelA} 
hline
addlinespace[0.3cm]
input{table1_panelB}

end{tabular}

end{ruledtabular}

end{table}
endgroup






end{document}




3 Answers

Starting from the excellent suggestion by @AboAmmar

enter image description here

MWE

documentclass{article}
usepackage[flushleft]{threeparttable}
begin{document}
    begin{table*}[ht]
        caption{Revisions}
        begin{threeparttable}
            centering
            begin{tabular}{p{0.10linewidth}
                    p{0.15linewidth}
                    p{0.45linewidth}
                    p{0.20linewidth}}
                hline
                Title 1 & Title 2 & Title 3 & Title 4          
                hline
                Cell 1  & Cell 1  & Cell 3  & Cell 4 tnote{a} 
                Cell 1  & Cell 1  & Cell 3  & Cell 4 tnote{b} 
                hline
            end{tabular}
            begin{tablenotes}
                item[a] My Note.
                item[b] My Other Note.
            end{tablenotes}
        end{threeparttable}
    end{table*}
end{document}

This solution already exists at - https://tex.stackexchange.com/a/146129/197451

Answered by js bibra on November 15, 2020

  • on-topic issue: use of threeparttable is promising way to solve your problem (as suggested in @ AboAmmar comment and provided an example in @js Bibra answer)
  • off-topic issues, I would make the following changes in your table design:
    • instead of revtex4 use revtex4-2 version of document class, which support rules from the booktabs package
    • for horizontal rules use rules defined in the booktabs package
    • for columns with number use S column type, defined in the siunitx package
  • using dummy numbers for table content, An MWE can be:
documentclass[preprint,floatfix] {revtex4-2}
%usepackage{caption}
%captionsetup{font=scriptsize}
usepackage{booktabs, 
            multirow, threeparttable}   % new
usepackage{siunitx}                    % new
usepackage{xparse}                     % new
NewExpandableDocumentCommandmcc{O{1}m}
    {multicolumn{#1}{c}{#2}}

usepackage{lipsum}                     % for dummy text


begin{document}
lipsum[11]
    begin{table}[ht]
begin{threeparttable}
caption {Summary statistics for contributions by individual contributors}
label{tab:table1}
    begin{tabular}{l
               *{2}{S[table-format=3.2]S[table-format=3.2]}
                    S[table-format=3.2]}
    toprule
multirow{2.4}{*}{Contributor}
    & mcc[2]{Pre-block}        & mcc[2]{Post-block}   & {Paired $t$-test}     
   cmidrule(l){2-3} 
   cmidrule(l){4-5} 
   cmidrule(l){6-6}
    &  {Mean}   & {SEtnote{a}} & {Mean}    & {SE}      & {textit{t}-stats}                                                   &  {Mean}   & {SEtnote{a}} & {Mean}    & {SE}      & {textit{t}-stats}                                                       midrule
panel Atnote{b}
    & 123.45    & 12.3          &  123.45    & 12.3     & 123.45                
    midrule
panel Btnote{c}
    & 124.82    &  9.1          &  124.82    &  9.1     & 124.8                 
    & 124.82    &  9.1          &  124.82    &  9.1     & 124.8                 
    bottomrule
end{tabular}
    begin{tablenotes}[flushleft]footnotesize
item[a]    SE: Standard error
item[b]    description of th panel A
item[c]    description of the panel B
    end{tablenotes}
end{threeparttable}
    end{table}
end{document}

enter image description here

Answered by Zarko on November 15, 2020

You can use {NiceTabular} of nicematrix which have a built-in command tabularnote to typeset the notes of a tabular. You can thouroughly customiz the notes (the notes under the tabular are composed in a type of list of enumitem).

documentclass{article}

usepackage{nicematrix}
usepackage{enumitem}

begin{document}
begin{table*}[ht]
caption{Revisions}
centering
begin{NiceTabular}{p{0.10linewidth}
                    p{0.15linewidth}        
                    p{0.45linewidth}
                    >{arraybackslash}p{0.20linewidth}}%
hline
Title 1 & Title 2 & Title 3 & Title 4 
hline
Cell 1  & Cell 1  & Cell 3  & Cell 4tabularnote{My note} 
Cell 1  & Cell 1  & Cell 3  & Cell 4tabularnote{My other note} 
hline
end{NiceTabular}
end{table*}
end{document}

Ouput of the above code

Answered by F. Pantigny on November 15, 2020

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