[Tex/LaTex] Footnote in table will not appear

captionsfootnotestables

I want to create a footnote within a table environment, when I use the regular \footnote then the text will not be shown on the bottom of the page. If I use \tablefootnote it will be shown on the first page and my table is shown on the second page. But I want them to appear on the same page. How can I achieve that? – Also how can I make the caption to be left-aligned?

Thanks a lot,

Julia

This is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e}
\usepackage{siunitx}
\usepackage{tablefootnote}
\begin{document}

\begin{table}[htbp]
   \centering
  \caption{Descriptives Table}
    \begin{tabular}{lll}
      \textbf{}&\textbf{Mean(SE) or Prop. in \%\tablefootnote{These values were calculated using weighted and imputed data.}} & \textbf{Range} \\
      \toprule
\textbf{x} & 3.157  (0.044) & {0-12} \\
\textbf{Life x} & 7.281 (0.035) &{0-12} \\
\textbf{x} & 62.2\%  &  \\
\textbf{x} & 33.571 (0.156) & {18-83} \\
\textbf{Overall x} & 3.909 (0.017) & 30-4 \\
\textbf{Low x} & 61.8\%  &  \\
\textbf{Medium x} & 21.1\%    &  \\
\textbf{High x} & 17.1\%    &  \\
\textbf{x} & 24.56 (0.058) & 3-24 \\
\textbf{x-x} & 6.264 (0.018) & 30-6 \\
\textbf{Time in x} & 1.687 (0.02) & {1 mo - 32 yrs} \\
\textbf{Status x x x} & 51.7\%  &  \\
\textbf{Status x} & 4.5\%    &  \\
\textbf{Status x x x.} & 3.7\%    &  \\
\textbf{Status x x} & 34.6\%  &  \\
\textbf{Status x x} & 5.4\%    &  \\
\textbf{Not x} & 90.7\%  &  \\
\textbf{x x x } & 9.3\%    &  \\
\textbf{x x} & 33.5\%  &  \\
\textbf{x x w/ other x} & 32.4\%  &  \\
\textbf{x x w/o other x} & 34.1\%  &  \\
\textbf{x not in x} & 94.5\%  &  \\
\textbf{x in x} & 94.4\%    &  \\
\textbf{x not x} & 81.6\%  &  \\
\textbf{x x} & 10.7\%    &  \\
\textbf{x x x} & 7.7\%    &  \\
\textbf{x of x courses x} & 0.843 (0.01) & {0-5} \\
\textbf{Time with others from country o. origin} & 3.847 (0.028) & 31-5 \\
\textbf{Time x x} & 3.661 (0.028) & 31-5 \\
\textbf{Time x x x x x. } & 2.871 (0.029) & 31-5 \\
\textbf{x lang. x} & 2.582 (0.015) & 30-4 \\
\textbf{No x x x} & 74.2\%  &  \\
\textbf{x x x} & 25.8\%    &  \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}
\end{document}

Best Answer

You are telling your table that it's allowed to go to the next page by using the [htbp] This means it's allowed to go ([h]ere, [t]op, [b]ottom or on it's own special figures-[p]age). However, if you change it to [h!] (here!) then it works as expected. Sharelatex has a good introduction to float specifiers, as they're called. Below is the working example you gave. Just with the [h!] instead of [htbp].

Note that the reason it wants to move it to the next page is probably because the table is very long, and doesn't really fit on the page. So a heads up: we're forcing it to fit on the page!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e}
\usepackage{siunitx}
\usepackage{tablefootnote}
\begin{document}

\begin{table}[h!]
   \centering
  \caption{Descriptives Table}
    \begin{tabular}{lll}
      \textbf{}&\textbf{Mean(SE) or Prop. in \%\tablefootnote{These values were calculated using weighted and imputed data.}} & \textbf{Range} \\
      \toprule
\textbf{x} & 3.157  (0.044) & {0-12} \\
\textbf{Life x} & 7.281 (0.035) &{0-12} \\
\textbf{x} & 62.2\%  &  \\
\textbf{x} & 33.571 (0.156) & {18-83} \\
\textbf{Overall x} & 3.909 (0.017) & 30-4 \\
\textbf{Low x} & 61.8\%  &  \\
\textbf{Medium x} & 21.1\%    &  \\
\textbf{High x} & 17.1\%    &  \\
\textbf{x} & 24.56 (0.058) & 3-24 \\
\textbf{x-x} & 6.264 (0.018) & 30-6 \\
\textbf{Time in x} & 1.687 (0.02) & {1 mo - 32 yrs} \\
\textbf{Status x x x} & 51.7\%  &  \\
\textbf{Status x} & 4.5\%    &  \\
\textbf{Status x x x.} & 3.7\%    &  \\
\textbf{Status x x} & 34.6\%  &  \\
\textbf{Status x x} & 5.4\%    &  \\
\textbf{Not x} & 90.7\%  &  \\
\textbf{x x x } & 9.3\%    &  \\
\textbf{x x} & 33.5\%  &  \\
\textbf{x x w/ other x} & 32.4\%  &  \\
\textbf{x x w/o other x} & 34.1\%  &  \\
\textbf{x not in x} & 94.5\%  &  \\
\textbf{x in x} & 94.4\%    &  \\
\textbf{x not x} & 81.6\%  &  \\
\textbf{x x} & 10.7\%    &  \\
\textbf{x x x} & 7.7\%    &  \\
\textbf{x of x courses x} & 0.843 (0.01) & {0-5} \\
\textbf{Time with others from country o. origin} & 3.847 (0.028) & 31-5 \\
\textbf{Time x x} & 3.661 (0.028) & 31-5 \\
\textbf{Time x x x x x. } & 2.871 (0.029) & 31-5 \\
\textbf{x lang. x} & 2.582 (0.015) & 30-4 \\
\textbf{No x x x} & 74.2\%  &  \\
\textbf{x x x} & 25.8\%    &  \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}
\end{document}