AnswerBun.com

Making tables with lots of footnotes and aligning the caption

TeX - LaTeX Asked by Miloop on December 19, 2020

I learnt Latex last month and am trying to write a large document with it. I have managed the text and figures, but not tables.
Although my table is centered, I would like my caption to begin along with the first cell of the table rather than the full left indent like a normal paragraph.

I also have many footnotes which pertain to the whole table rather than specific parts of the table. I tried using tablefootnote, but no text seems to appear. Also, I don’t want the numbers, just the text.

documentclass[a4paper, oneside]{book}
usepackage[left=35mm, right=15mm, top=20mm, bottom=15mm]{geometry}
usepackage{setspace}
usepackage{fixltx2e}
usepackage{graphicx}
usepackage{float}
usepackage{tabularx}
usepackage{amssymb}
usepackage{booktabs} % For toprule, midrule and bottomrule
usepackage{pgfplotstable} % Generates table from .csv
usepackage{longtable}    %Allows multi-page tables
usepackage{rotating}     %Allows for single page landscape using sidewaystable{}
usepackage{pdflscape}     %Allows for landscape
usepackage{multirow}      %Allows for merging across rows
usepackage{tablefootnote} 
usepackage{footnote}

begin{document}

begin{table}[h!]
begin{center}
caption{Proximate phenolic and carbohydrate content}
label{Table4}
 begin{tabular}{c c c c c c c} 
 toprule
 &multicolumn{2}{c}{textbf{Leaf}}& &multicolumn{2}{c}{textbf{Roots}}\
cline{2-3}cline{5-6} 
 textbf{Plant} & textbf{Colour} & textbf{Density} &  &textbf{Colour} & textbf{Density}\
 midrule
 Sample1&26.1$pm$0.7$^{c}$ &172.3$pm$9.0& & 25.5$pm$6.8$^{b}$&83.7$pm$4.5$^{a}$\
 Sample2&53.9$pm$2.0$^{d}$&129.5$pm$3.2& &29.4$pm$4.8$^{b}$&11.7$pm$1.8\
 Sample3&32.5$pm$3.2$^{c}$&163.3$pm$6.5& &96.8$pm$18.1&64.4$pm$1.3\
 Sample4&54.2$pm$2.3$^{d}$&82.6$pm$7.5& &28.9$pm$3.0$^{b}$&35.7$pm$1.2\
 Sample5&28.4$pm$3.9$^{c}$&172.1$pm$6.3& &26.9$pm$5.1$^{b}$&78.8$pm$2.8$^{a}$\
 Sample6&50.0$pm$2.0$^{d}$&112.3$pm$5.3& &54.1$pm$5.7&48.1$pm$7.1\
 bottomrule
end{tabular}
end{center}
footnotesize{Values expressed in %(mg.mg$^{-1}$)}\
footnotesize{Values with same superscript are statistically similar (OW-ANOVA,p textless 0.01)}\
footnotesize{NSP=Non-starch polysaccahride}
end{table}

end{document}

I tried to be clever, but didn’t work for the second caption:

begin{table}[h!]
begin{center}
caption{Proximate phenolic and carbohydrate content}
label{Table4}
 begin{tabular}{c c c c c c c} 
 toprule
 &multicolumn{2}{c}{textbf{Leaf}}& &multicolumn{2}{c}{textbf{Roots}}\
cline{2-3}cline{5-6} 
 textbf{Plant} & textbf{Colour} & textbf{Density} &  &textbf{Colour} & textbf{Density}\
 midrule
 Sample1&26.1$pm$0.7$^{c}$ &172.3$pm$9.0& & 25.5$pm$6.8$^{b}$&83.7$pm$4.5$^{a}$\
 Sample2&53.9$pm$2.0$^{d}$&129.5$pm$3.2& &29.4$pm$4.8$^{b}$&11.7$pm$1.8\
 Sample3&32.5$pm$3.2$^{c}$&163.3$pm$6.5& &96.8$pm$18.1&64.4$pm$1.3\
 Sample4&54.2$pm$2.3$^{d}$&82.6$pm$7.5& &28.9$pm$3.0$^{b}$&35.7$pm$1.2\
 Sample5&28.4$pm$3.9$^{c}$&172.1$pm$6.3& &26.9$pm$5.1$^{b}$&78.8$pm$2.8$^{a}$\
 Sample6&50.0$pm$2.0$^{d}$&112.3$pm$5.3& &54.1$pm$5.7&48.1$pm$7.1\
 bottomrule
end{tabular}
end{center}
begin{tabular}
footnotesize{Values expressed in %(mg.mg$^{-1}$)}\
footnotesize{Values with same superscript are statistically similar (OW-ANOVA,p textless 0.01)}\
footnotesize{NSP=Non-starch polysaccahride}
end{tabular}
end{table}

Would this solution work in landscape format? I have tables of that variety as well

One Answer

Here is my suggestion using threeparttable for the tablenotes. The caption alignment is also done with threeparttable in combination with an appropriate captionsetup. In order to improve the alignment of the numbers in the table, I have added the siunitx package:

enter image description here

documentclass[a4paper, oneside]{book}
usepackage[left=35mm, right=15mm, top=20mm, bottom=15mm]{geometry}
usepackage{setspace}
usepackage{fixltx2e}
usepackage{graphicx}
usepackage{float}
usepackage{tabularx}
usepackage{amssymb}
usepackage{booktabs} % For toprule, midrule and bottomrule
usepackage{pgfplotstable} % Generates table from .csv
usepackage{longtable}    %Allows multi-page tables
usepackage{rotating}     %Allows for single page landscape using sidewaystable{}
usepackage{pdflscape}     %Allows for landscape
usepackage{multirow}      %Allows for merging across rows
usepackage{tablefootnote} 
usepackage{footnote}

usepackage{threeparttable}
usepackage{caption}
captionsetup{singlelinecheck=false}
usepackage{siunitx}
sisetup{input-uncertainty-signs=pm, 
         separate-uncertainty=true}
        
begin{document}

begin{table}[h!]
centering
begin{threeparttable}
caption{Proximate phenolic and carbohydrate content}
label{Table4}
sisetup{table-format=2.1(3), 
         table-space-text-post=tnote{a}, 
         table-align-text-post=false}
 begin{tabular}{l S S S S} 
 toprule
 &multicolumn{2}{c}{textbf{Leaf}}& multicolumn{2}{c}{textbf{Roots}}\
cmidrule(r){2-3}cmidrule(l){4-5} 
 {textbf{Plant}} & {textbf{Colour}} & {textbf{Density}} & {textbf{Colour}} & {textbf{Density}}\
 midrule
 Sample1 & 26.1 pm 0.7tnote{c} & 172.3 pm 9.0 & 25.5 pm 6.8tnote{b} & 83.7 pm 4.5tnote{a} \
 Sample2 & 53.9 pm 2.0tnote{d} & 129.5 pm 3.2 & 29.4 pm 4.8tnote{b} & 11.7 pm 1.8          \
 Sample3 & 32.5 pm 3.2tnote{c} & 163.3 pm 6.5 & 96.8 pm 18.1         & 64.4 pm 1.3          \
 Sample4 & 54.2 pm 2.3tnote{d} & 82.6  pm 7.5 & 28.9 pm 3.0tnote{b} & 35.7 pm 1.2          \
 Sample5 & 28.4 pm 3.9tnote{c} & 172.1 pm 6.3 & 26.9 pm 5.1tnote{b} & 78.8 pm 2.8tnote{a} \
 Sample6 & 50.0 pm 2.0tnote{d} & 112.3 pm 5.3 & 54.1 pm 5.7          & 48.1 pm 7.1          \
 bottomrule
end{tabular}
footnotesize
Values expressed in %(mg.mg$^{-1}$)

Values with same superscript are statistically similar (OW-ANOVA,p textless 0.01)
 
NSP=Non-starch polysaccharide
end{threeparttable}
end{table}



end{document}

Correct answer by leandriis on December 19, 2020

Add your own answers!

Related Questions

How to create biblatex bibliograpy and citation syles

1  Asked on August 25, 2021 by ossama-nasser

   

tikz draw not defined error inside lettrine

1  Asked on August 25, 2021 by richard-robertson

     

Latex can’t run because it finds a bracket too many?

1  Asked on August 25, 2021 by fastbanana

 

Align text in a new command

1  Asked on August 25, 2021

     

Subfigure vertically (!!! not side by side)

1  Asked on August 25, 2021 by arseniy-sleptsov

   

Fit a longtable to page width

2  Asked on August 25, 2021 by pablosalgado

 

TikZ node text margins

3  Asked on August 25, 2021

 

How can I draw graphs of P_n(x) function?

1  Asked on August 24, 2021 by user213378

 

Modify the attributes of a circle

1  Asked on August 24, 2021

 

How to type theorem with automatic number by opmac

2  Asked on August 23, 2021 by user88544

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP