0

I want to add some tiny notes to the following table but its coming out of the lines.

\begin{table}[H] 
\centering
    \setlength{\arrayrulewidth}{1mm}
    \renewcommand{\arraystretch}{0.65}

    \begin{tabular}{lllllll}
    \hline
    Variable& Min & 1st Qu. & Median & Mean & 3rd Qu. & Max \\ \hline
        loan amnt & 500 & 8000 & 13000 & 14760 & 20000 & 35000\\
        int rate & 0.0532 & 0.0999& 0.1299 & 0.1324 & 0.1620 & 0.2899\\
        credit grade & 1.00 & 4.00 & 5.00 & 5.203 & 6.00 & 7.00 \\
        sub grade1 & 1.00 & 7.00 & 11.00 & 11.95 & 16.00 & 35.00 \\

        \hline
    \end{tabular}
    \multicolumn{5}{@{}l}{\tiny Notes: Credit Grade is the grade assigned by the Lending Club based on the FICOrano credit rating information along with other information. Credit Grade ‘1’ is the loan category of ....} \\

    \caption{Descriptive statistics for some of the variables}
    \label{tab:my_label}
\end{table}
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jun 18 '18 at 17:08
  • 1
    \multicolumn must be inside the tabular environment. – dexteritas Jun 18 '18 at 17:09
  • @dexteritas if I do that the last column of the table will be as long as the text. I want the text to fit the length of the last line of the table – Erick Jun 18 '18 at 17:14
  • 1
    Why not use a threeparttable for this? – leandriis Jun 18 '18 at 17:18
  • @marmot thanks. but how I can expand the notes till the end of the table. right now goes till the middle of the table and skips to the next line – Erick Jun 18 '18 at 17:26
4

Use threeparttable. Here's a possible code, but do you really want that result?

\documentclass{article}%
\usepackage{threeparttable, array, float}

\begin{document}

\begin{table}[H]
\centering
    \setlength{\arrayrulewidth}{1mm}
    \renewcommand{\arraystretch}{0.65}
\begin{threeparttable}
    \begin{tabular}{*{7}{l}}
    \hline
    Variable& Min & 1st Qu. & Median & Mean & 3rd Qu. & Max \\ \hline
        loan amnt & 500 & 8000 & 13000 & 14760 & 20000 & 35000\\
        int rate & 0.0532 & 0.0999& 0.1299 & 0.1324 & 0.1620 & 0.2899\\
        credit grade & 1.00 & 4.00 & 5.00 & 5.203 & 6.00 & 7.00 \\
        sub grade1 & 1.00 & 7.00 & 11.00 & 11.95 & 16.00 & 35.00 \\
        \hline
    \end{tabular}
  \begin{tablenotes}[online, flushleft]
  \tiny
   \item[]Notes: Credit Grade is the grade assigned by the Lending Club based on the FICOrano credit rating information along with other information. Credit Grade ‘1’ is the loan category of ....
  \end{tablenotes}
    \caption{Descriptive statistics for some of the variables}
    \label{tab:my_label}
\end{threeparttable}
\end{table}

\end{document} 

enter image description here

I suggest using this code, which results in a nicer table, in my opinion (load booktabs):

\begin{table}[H]
    \centering
    \begin{threeparttable}
        \begin{tabular}{*{7}{l}}
        \toprule[1.2pt]
        Variable& Min & 1st Qu. & Median & Mean & 3rd Qu. & Max \\ 
        \cmidrule[0.8pt](lr){1-7}
            loan amnt & 500 & 8000 & 13000 & 14760 & 20000 & 35000\\
            int rate & 0.0532 & 0.0999& 0.1299 & 0.1324 & 0.1620 & 0.2899\\
            credit grade & 1.00 & 4.00 & 5.00 & 5.203 & 6.00 & 7.00 \\
            sub grade1 & 1.00 & 7.00 & 11.00 & 11.95 & 16.00 & 35.00 \\
            \midrule[1.2pt]
        \end{tabular}
      \begin{tablenotes}[online, flushleft]
      \footnotesize%\smallskip
       \item[]\hspace*{-\fontdimen2\font}Notes: Credit Grade is the grade assigned by the Lending Club based on the FICOrano credit rating information along with other information. Credit Grade ‘1’ is the loan category of ....
      \end{tablenotes}
        \caption{Descriptive statistics for some of the variables}
        \label{tab:my_label}
    \end{threeparttable}
    \end{table}

enter image description here

1

Here is a MWE using \multicolumn{3}{|p{10cm}|}{...} to enable linebreak. You can adjust the width as you like.

Code:

\documentclass{article}

\usepackage{multicol}

\begin{document}

\begin{tabular}{|c|c|c|}
    \hline
    foo & bar & foobar\\ \hline
    \multicolumn{3}{|p{10cm}|}{\tiny Notes: Credit Grade is the grade assigned by the Lending Club based on the FICOrano credit rating information along with other information. Credit Grade ‘1’ is the loan category of ....}\\ \hline
\end{tabular}

\end{document}

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.