2

I currently have two tables made with the tabularx package, side by side. I put them side by side using the subfloat command of the subfig package (as suggested here), that allows me to write a title (and to reference) each table separately as 1.1a and 1.1b.

My problem is the following: in these tables there are some values that have to share a common footnote. When I try to use the \footnote{text} command the number of the footnote appears, but the text does not.

How can I solve this? If possible, I would like the text to appear at the bottom of the table, but it's not so terrible if it appears at the bottom of the page.

Thank you very much in advance. I add a MWE, in which the numbers with asterisk should have the footnote I mentioned.

\documentclass[letterpaper]{article}

\usepackage{subfig}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\begin{document}

\begin{table}[ht]
    \centering
    \caption{Title of the two-table-environment.}
    \label{table:environment}
    \subfloat[Title of the first table]{
    \label{table:first_table}
    \begin{tabularx}{0.5\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns yay!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $100*$    & $0.5336$\\
        Context 2   & $100$     & $0.2109$\\
        Context 3   & $100*$    & $0.3897$\\
        Context 4   & $100*$    & $-0.1376$\\
        Context 5   & $100*$    & $-0.7640$\\
        Context 6   & $100$     & $-0.0792$\\
        Context 7   & $100*$    & $-11.4119$\\
        \bottomrule
    \end{tabularx}
    }
    \subfloat[Title of the second table]{
    \label{table:second_table}
    \begin{tabularx}{0.5\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns hooray!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $40.7359$ & $53.7044$\\
        Context 2   & --        & -- \\
        Context 3   & $46.6164$ & $16.2185$\\
        Context 4   & --        & -- \\
        Context 5   & $28.4038$ & $70.5398$\\
        Context 6   & $57.4703$ & $59.2224$\\
        Context 7   & --        & -- \\
        \bottomrule
    \end{tabularx}
    }
\end{table}

\end{document}
1

You can cheat a little and put your footnotes in a row below your table. Since you're using tabularx, you can do it with \multicolumn. I tend to put this kind of footnotes in an inline enumeration separated by \quad. With a \label attached to your items, you can \ref them back.

Also note that you have a series of unwanted spaces in your code which you have to hide with % at the end of lines. Also, you define 4 columns lc*{2}{Y} where you only use 3. Code:

\documentclass[letterpaper]{article}

\usepackage{subfig}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage[showframe]{geometry}
\usepackage[inline]{enumitem}

\begin{document}

\begin{table}[ht]
  \centering
  \caption{Title of the two-table-environment.}
  \label{table:environment}
  \subfloat[Title of the first table]{%
    \label{table:first_table}%
    \begin{tabularx}{0.49\textwidth}{@{}l*{2}{Y}@{}}
      \toprule
      & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{%
        Text too long spanning two columns yay!}\\ \cmidrule(l){2-3}
      Column 1    & Metric 1  & Metric 2 \\ \midrule
      Context 1   & $100\ref{tab:fn1}$    & $0.5336$\\
      Context 2   & $100$     & $0.2109$\\
      Context 3   & $100\ref{tab:fn2}$    & $0.3897$\\
      Context 4   & $100\ref{tab:fn1}$    & $-0.1376$\\
      Context 5   & $100\ref{tab:fn2}$    & $-0.7640$\\
      Context 6   & $100$     & $-0.0792$\\
      Context 7   & $100\ref{tab:fn1}$    & $-11.4119$\\
      \bottomrule
      \noalign{\vspace{3pt}}
      \multicolumn{3}{@{}p{0.49\textwidth}@{}}{%
        \raggedright\footnotesize
        \begin{enumerate*}[itemjoin=\quad,ref=\textsuperscript{\arabic*}]
        \item My footnote\label{tab:fn1}
        \item My other referenced footnote which is also longer\label{tab:fn2}
        \end{enumerate*}}
    \end{tabularx}%
  }%
  \hfill
  \subfloat[Title of the second table]{%
    \label{table:second_table}%
    \begin{tabularx}{0.49\textwidth}{@{}l*{2}{Y}@{}}
      \toprule
      & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{%
        Text too long spanning two columns hooray!}\\ \cmidrule(l){2-3}
      Column 1    & Metric 1  & Metric 2 \\ \midrule
      Context 1   & $40.7359$ & $53.7044$\\
      Context 2   & --        & -- \\
      Context 3   & $46.6164$ & $16.2185$\\
      Context 4   & --        & -- \\
      Context 5   & $28.4038$ & $70.5398$\\
      Context 6   & $57.4703$ & $59.2224$\\
      Context 7   & --        & -- \\
      \bottomrule
    \end{tabularx}%
  }%
\end{table}

\begin{table}[ht]
    \centering
    \caption{Title of the two-table-environment with spurious spaces}
    \label{table:environment}
    \subfloat[Title of the first table]{
    \label{table:first_table}
    \begin{tabularx}{0.5\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns yay!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $100*$    & $0.5336$\\
        Context 2   & $100$     & $0.2109$\\
        Context 3   & $100*$    & $0.3897$\\
        Context 4   & $100*$    & $-0.1376$\\
        Context 5   & $100*$    & $-0.7640$\\
        Context 6   & $100$     & $-0.0792$\\
        Context 7   & $100*$    & $-11.4119$\\
        \bottomrule
    \end{tabularx}
    }
    \subfloat[Title of the second table]{
    \label{table:second_table}
    \begin{tabularx}{0.5\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns hooray!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $40.7359$ & $53.7044$\\
        Context 2   & --        & -- \\
        Context 3   & $46.6164$ & $16.2185$\\
        Context 4   & --        & -- \\
        Context 5   & $28.4038$ & $70.5398$\\
        Context 6   & $57.4703$ & $59.2224$\\
        Context 7   & --        & -- \\
        \bottomrule
    \end{tabularx}
    }
\end{table}

\end{document}

enter image description here

  • This is the same solution I suggest in my answer. – Sveinung Jan 4 '17 at 15:18
  • @Sveinung - But I provided code ;-) In this case you should vote to close the question as duplicate. – Arash Esbati Jan 4 '17 at 15:26
  • The question is not a duplicate. – Sveinung Jan 4 '17 at 16:02
  • Thank you for the code! Now I have another doubt: you said that I have a series of unwanted spaces in the code, and that can be hidden with % at the end of lines. How can I know, in a general table, where those spaces are located? I've just applied the % in just one table, compiled, and I can't see a difference. Edit: I zoomed and now I can see the spaces, nevermind. – Ignacio Correa Jan 5 '17 at 18:46
1

I suggest that you use manual footnote, i.e. add an additional row to the first table, and put the footnote text there inside a \multicolumn command spanning the correct number of columns. The footnote mark can be put in a \textsuperscript- command at the correct places in the two tables.

Have look at this answer for further description and code example.

0

You can place the tabular inside a minipage (inside the \subfloat, if not instead of). Note that footnotes behave entirely differently inside minipages. Also note that minipage changes \textwidth.

I added command \repeatfootnote in case you wanted the same footnote on all of them (which seemed likely from context). \footnotemark does not match \footnote inside a minipage.

\documentclass[letterpaper]{article}

\usepackage{subfig}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\makeatletter
\newcommand{\repeatfootnote}[1][\empty]% #1 = \thempfn for this mark (optonal)
 {\ifx\empty#1\relax \@makefnmark
  \else\hbox{\@textsuperscript{\itshape #1}}%
  \fi}
\makeatother

\begin{document}

\begin{table}[ht]
    \centering
    \caption{Title of the two-table-environment.}
    \label{table:environment}
    \subfloat[Title of the first table]{%
    \label{table:first_table}
    \begin{minipage}{0.49\textwidth}
    \begin{tabularx}{\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns yay!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $100\footnote{test}$    & $0.5336$\\
        Context 2   & $100$     & $0.2109$\\
        Context 3   & $100\footnote{another}$    & $0.3897$\\
        Context 4   & $100\repeatfootnote$    & $-0.1376$\\
        Context 5   & $100\repeatfootnote[a]$    & $-0.7640$\\
        Context 6   & $100$     & $-0.0792$\\
        Context 7   & $100\repeatfootnote[b]$    & $-11.4119$\\
        \bottomrule
    \end{tabularx}%
    \end{minipage}%
    }\hfill
    \subfloat[Title of the second table]{%
    \label{table:second_table}
    \begin{tabularx}{0.49\textwidth}{lc*{2}{Y}}
        \toprule
        & \multicolumn{2}{>{\setlength\hsize{2\hsize}}Y}{Text too long spanning two columns hooray!}\\ \cmidrule(l){2-3}
        Column 1    & Metric 1  & Metric 2 \\ \midrule
        Context 1   & $40.7359$ & $53.7044$\\
        Context 2   & --        & -- \\
        Context 3   & $46.6164$ & $16.2185$\\
        Context 4   & --        & -- \\
        Context 5   & $28.4038$ & $70.5398$\\
        Context 6   & $57.4703$ & $59.2224$\\
        Context 7   & --        & -- \\
        \bottomrule
    \end{tabularx}%
    }
\end{table}

\end{document}

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.