2

Using Lyx. Is there a way to produce table with both caption and footnotes?

Use of footnotes in a float is not recommended (both footnotes and tabular are float environments, footnote text is not produced/printed), adding table manually (not in a float) forbids me from adding caption (the Senseless!!! error).

Is the tabularx package the way to go?

1

1 Answer 1

2

Without using the LaTeX preamble to insert some packages like threeparttable or ctable and without edit the whole table in an ERT box in order to use alternatives to the standard tabular environment, a simple solution is insert in the table float a minipage as wide as the table must be, then make a normal table with normal footnotes. The problem is that the normal footnote rule have no sense at the bottom of a table, but this can be solved with a ERT box with \renewcommand\footnoterule{...}.

Screenshot of LyX and the resulting PDF are self explanatory. (To see at original size open the image in another browser window. Spanish version, sorry):

MWE

Complete LaTeX source generated by Lyx:

% Vista preliminar del código fuente

%% LyX 2.1.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

    \makeatother

    \usepackage{babel}
    \begin{document}
    \begin{table}
    \protect\caption{A table}


    \renewcommand\footnoterule{ \kern -1ex}

    \begin{minipage}[t]{1\columnwidth}%
    \begin{center}
    \begin{tabular*}{1\linewidth}{@{\extracolsep{\fill}}>{\centering}p{0.3\linewidth}c>{\centering}p{0.3\linewidth}}
    \hline 
    Aaa & Bbb & Cccc\tabularnewline
    \hline 
    11%
    \footnote{A footnote about 11%
    } & 12 & 13\tabularnewline
    21 & 22%
    \footnote{Another footnote%
    } & 23\tabularnewline
    \hline 
    \end{tabular*}
    \par\end{center}%
    \end{minipage}
    \end{table}

    \end{document}

If you want table footnotes as normal footnotes with continuous numeration, one option could be the footnote package (insret \usepackage{footnote} in Document > Configuration LaTeX preamble and the savenotes environment (use ERT boxes to insert \begin{savenotes} and \end{savenotes}).

MWE in LaTeX:

enter image description here

\documentclass[a5paper,w]{article}
\usepackage{footnote}
\begin{document}

Some text\footnote{A text footnote} 

\begin{savenotes}
    \begin{table}[!h]
    \centering
    \caption{A table}
    \renewcommand\footnoterule{ \kern -1ex}
    \begin{tabular}{lll}
    \hline  Aaa & Bbb & Cccc\\
    \hline  11  \footnote{A table note about 11 cell} & 12 & 13\\
    21 & 22 \footnote{A table note about  22} & 23\\
    \hline 
    \end{tabular}
    \end{table}
\end{savenotes}

\begin{savenotes}
    \begin{table}[!h]
    \centering
    \caption{A table}
    \renewcommand\footnoterule{ \kern -1ex}
    \begin{tabular}{lll}
    \hline  Aaa & Bbb & Cccc\\
    \hline  31  \footnote{A table note about 31} & 32 & 33\\
    41 & 42 \footnote{One more table note about 42}  & 43\\
    \hline 
    \end{tabular}
    \end{table}
\end{savenotes}

Some more text\footnote{Another text footnote} 

\end{document}
4
  • Great, thanks for the effort, however... another problem is, that this creates separate structure of footnotes - i.e. if there is another table with a footnote, the numbering is not correct. Right now, I have to tables, both with a, b footnotes. Can this be solved as well? Commented Jun 26, 2015 at 6:42
  • Also, since you mentioned it - is it possible to past parts of the code copied from Lyx (source pane) in ERT? I tried that several times ("caveman reverse-engineering") for tables as I found several solutions for the footnotes+tables+caption, but none of them really work and produce errors such as "cannot use \hline, expected \noalign" etc. etc. This was very odd, because I just copied the damn code from what Lyx produced... Commented Jun 26, 2015 at 7:00
  • @Birimaratoa IMHO this is just the usual and best practice. As tables footnotes are always for the table just above, it have no sense to maintain the same counter for all the tables footnotes as mix with tables and text footnotes. Hovewer, see here for other options.
    – Fran
    Commented Jun 26, 2015 at 19:29
  • @Birimaratoa Respect the ERT, yes, you can use these boxes to insert any LaTeX code at any place, but always being careful of the LaTeX syntax. Copy & pate chunk of code without knowing what are you doing is the best way to get into troubles. Check that the result of use ERT boxes in the source pane result in a compilable LaTeX file without using Lyx (for example with pdflatex file.tex),
    – Fran
    Commented Jun 26, 2015 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .