LaTeX forum ⇒ Graphics, Figures & TablesHow to left align some text with the bottom-left corner of a table ? Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Cham
Posts: 819
Joined: Sat Apr 02, 2011 4:06 pm

How to left align some text with the bottom-left corner of a table ?

Postby Cham » Wed Nov 08, 2017 4:58 pm

I need to add some comments below a table. The comments should be left-aligned with the bottom part of the table. How can I achieve this ? Here's a MWE showing the issue :

  1. \documentclass[11pt,letterpaper,twoside]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{lmodern}
  4. \usepackage{microtype}
  5. \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
  6. \usepackage{mathtools}
  7. \usepackage{tabularx}
  8.  
  9. \begin{document}
  10.  
  11. \begin{center}
  12. \small
  13. \renewcommand{\arraystretch}{1.5}
  14. \begin{tabular}{|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|}
  15. \hline
  16. \multicolumn{4}{|c|}{\normalsize{11. Some table title}}
  17. \\ \hline
  18. \multicolumn{1}{|c|}{\normalsize{Column 1}}
  19. & \multicolumn{1}{c|}{\normalsize{Column 2}}
  20. & \multicolumn{1}{c|}{\normalsize{Column 3$\mathrlap{{}^{(1)}}$}}
  21. & \multicolumn{1}{c|}{\normalsize{Column 4$\mathrlap{{}^{(2)}}$}}
  22. \\ \hline
  23. 10 & 1 & $x$ & $y$
  24. \\ \hline
  25. 100 & 2 & $u$ & $v$
  26. \\ \hline
  27. 1000 & 3 & $p$ & $q$
  28. \\ \hline
  29. \end{tabular}
  30. \end{center}
  31.  
  32. \vspace{-6pt}
  33.  
  34. \noindent
  35. \small{(1) Some usefull comments. \newline (2) Another line of useless comments.}
  36.  
  37. \end{document}


Here's a preview :
here.jpg
here.jpg (23.94 KiB) Viewed 119 times


Maybe there's a better way to add comments below a table ? Note that I don't want a caption here.

User avatar
Cham
Posts: 819
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Wed Nov 08, 2017 5:36 pm

Hmm, the threeparttable package may be the solution :

  1. \documentclass[11pt,letterpaper,twoside]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{lmodern}
  4. \usepackage{microtype}
  5. \usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
  6. \usepackage{mathtools}
  7. \usepackage{tabularx}
  8. \usepackage{threeparttable}
  9.  
  10. \begin{document}
  11.  
  12. \begin{center}
  13. \begin{threeparttable}
  14. \small
  15. \renewcommand{\arraystretch}{1.5}
  16. \begin{tabular}{|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|>{\centering\arraybackslash}p{2.5cm}|}
  17. \hline
  18. \multicolumn{4}{|c|}{\normalsize{11. Some table title}}
  19. \\ \hline
  20. \multicolumn{1}{|c|}{\normalsize{Column 1}}
  21. & \multicolumn{1}{c|}{\normalsize{Column 2}}
  22. & \multicolumn{1}{c|}{\normalsize{Column 3$\mathrlap{{}^{(1)}}$}}
  23. & \multicolumn{1}{c|}{\normalsize{Column 4$\mathrlap{{}^{(2)}}$}}
  24. \\ \hline
  25. 10 & 1 & $x$ & $y$
  26. \\ \hline
  27. 100 & 2 & $u$ & $v$
  28. \\ \hline
  29. 1000 & 3 & $p$ & $q$
  30. \\ \hline
  31. \end{tabular}
  32. \begin{tablenotes}
  33. \item[(1)] Some usefull comments.
  34. \item[(2)] Another line of useless comments.
  35. \end{tablenotes}
  36. \end{threeparttable}
  37. \end{center}
  38.  
  39. \end{document}


But in case I'm missing something else, is there another way in doing this ?


EDIT : Aha ! The threeparttable documentation is very simple and clear (this is a rare case !) :)

I now can flush-left the table notes to the left using \begin{tablenotes}[flushleft], and the notes indices should be identified with \tnote{(1)}, instead of the $\mathrlap{{}^{(1)}}$ (what a kind of a hack ! :roll: ).


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests