0

Thanks to this post Longtable with threeparttable (but the one that I can't comment because I'm really new here) I found that I can use footnotes with longtable, if I use threeparttable package.

However, I'd like to have a line above my notes. Anyone know how to do it? (I want something like this)

enter image description here

Here it's an example of my code. The table 1 (longtable) is the one that have footnotes with ThreePartTable package. It hasn't line above the notes. The table 2 (with minipage environment) has line above the notes. I want a similar line in table 1.

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{lipsum}  
\usepackage{booktabs,threeparttablex}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{caption}
\usepackage[labelfont=bf,labelsep=period]{caption}

\begin{document}

\lipsum[2-3]

\begin{ThreePartTable} \renewcommand\TPTminimum{\textwidth} \setlength\LTleft{0pt} \begin{TableNotes} \item[*] A note adsfasdf \item[] Another note asdfasfasd

\end{TableNotes}

\begin{longtable}{|l|l|l|l|l|l|} \caption{\textit{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA}} \ \hline \textbf{Col1} & \textbf{Col2} & \textbf{Col3\tnote{}} & \textbf{Col4} & \textbf{Col5} & \textbf{Col6\tnote{}} \ \hline \endfirsthead \multicolumn{6}{l}{\tablename\ \thetable: \textit{AAAAAAAAAAAAAAA}(Cont\ldots)}\ \hline \textbf{Col1} & \textbf{Col2} & \textbf{Col3} & \textbf{Col4} & \textbf{Col5} & \textbf{Col6} \ \hline \endhead \hline \multicolumn{6}{l}{}\ \endfoot \insertTableNotes
\endlastfoot \multirow{3}{
}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline \multirow{3}{}{23412} & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ & AAAA & A & AAAAAAA & AAAAAAA & A \ \hline

\end{longtable} \end{ThreePartTable}

\begin{table}[!ht] \centering \caption{AAAAAAAAAAAAAAAAAAAA}

\begin{minipage}{\textwidth} \renewcommand*{\thempfootnote}{\fnsymbol{mpfootnote}}

\begin{tabular}{|l|l|l|l|l|l|} \hline \textbf{Col1} & \textbf{Col2} & \textbf{Col3\footnote[1]{A note adsfasdf}} & \textbf{Col4} & \textbf{Col5} & \textbf{Col6\footnote[0]{Another note asdfasfasd}} \ \hline AAAAAA & AAAAAA & A & AAAAAA & AAAAAA & A \ \hline AAAAAA & AAAAAA & A & AAAAAA & AAAAAA & A \ \hline AAAAAA & AAAAAA & A & AAAAAA & AAAAAA & A \ \hline AAAAAA & AAAAAA & A & AAAAAA & AAAAAA & A \ \hline \end{tabular} \end{minipage} \end{table} \end{document}

Thanks in advance!

emr2
  • 191
  • Usually, there should be one automatically, if your table notes are inserted after the table (in the \endlastfoot section). Unless you want a second rule, or so I misunderstand the problem? – Bernard Aug 26 '20 at 16:46
  • If you mean the last line of the table, no. It doesn't appear me one automatically. I inserted the table notes like this: \endfoot \insertTableNotes \endlastfoot – emr2 Aug 26 '20 at 16:56
  • 1
    Add \bottomrule before \insertTableNotes if you use booktabs, or simply\hline` if you don't ( or any rule from another package – makecell, boldline,…) – Bernard Aug 26 '20 at 17:04
  • \bottomrule works but, it's too long and too near to the table. Do you know if I can put a line like if I were using minipage environment? Like this https://i.stack.imgur.com/EpYSq.png – emr2 Aug 26 '20 at 17:14
  • 1
    @Eva: Please provide more information about the table, preferrably in the form of a complete and compilable minimal working example (MWE). Depending on the column size, you could probably use \cmidrule{1-1} in order to get a narrower horizontal line. What to do depends a lot on the actual table. – leandriis Aug 26 '20 at 18:37
  • @leandriis Done, I edited the post with an example. – emr2 Aug 26 '20 at 19:10
  • 2
    If you want a larger vertical spacing above the rule, you can use something like \addlinespace[3ex] , for instance. If you want a rule at you convenience, you use \noalign{\rule{somelength}{some height}. Furthermore, the vertical spacing can be incorporated to the optional argument of \rule (e.g. \noalign{\rule[-3ex]{4cm}{0.4pt}}). – Bernard Aug 26 '20 at 19:38
  • @Bernard It worked with your last solution! \noalign {\rule [-1.4ex]{6.7cm}{0.4pt}} problem solved! Should I write this as an answer of this post? Or do you have to write it? Thanks very much!!! – emr2 Aug 27 '20 at 10:23
  • You may write it if you want, I don't really have time at the moment. – Bernard Aug 27 '20 at 10:46

1 Answers1

0

Problem solved thanks to Bernard!

The way for put a horizontal line above the footnotes using ThreePartTable (and would be similar like minipage environment' footnotes) is:

\noalign {\rule [-1.4ex]{6.7cm}{0.4pt}}

emr2
  • 191