Text FormattingCustom footnotemark in table in minipage

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
jocom
Posts: 25
Joined: Fri May 07, 2010 4:28 pm

Custom footnotemark in table in minipage

Post by jocom »

Hi,

I've got the following problem.
I'm trying to format a table which needs footnotes. Thats easy.
But I also need multiple references to the same footnote. Not so easy.
At last I would prefer to use custom marks. Not so easy in a minipage.

I produced the following minimal example:

Code: Select all

\documentclass{article}

\usepackage{booktabs}

\begin{document}
Random text\footnote{This is footnote 1}.

\begin{table}[h!]
  \begin{minipage}{\textwidth}
  \centering
  \begin{tabular}{@{}cl@{}}
    \toprule
    Header1 & Header2 \\
    \midrule
    Dummy & Foo\footnotemark[R] \\
    More Dummy & Bar\footnotemark[*] \\
    Even more & FooBar\footnotemark[*]\footnotemark[R] \\
    Last Dummy & Baz\footnotemark[R] \\
    \bottomrule
  \end{tabular}
  \footnotetext[*]{My footnote for *}
  \footnotetext[R]{My footnote for R}
  \end{minipage}
\caption{Caption of table}
\end{table}

Some text\footnote{This is footnote 2}.
\end{document}
Note that this code will not compile at the moment :)

Any ideas? Would be great!

N.B. The part on custom marks isn't the most important. But I don't even get the default (a,b,c,...) marks working.

jocom
Last edited by jocom on Tue Dec 21, 2010 5:11 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom footnotemark in table in minipage

Post by localghost »

Take a look at the threeparttable package.


Thorsten
jocom
Posts: 25
Joined: Fri May 07, 2010 4:28 pm

Re: Custom footnotemark in table in minipage

Post by jocom »

Thanks for that pointer, it solves a lot!

The only problem I', stuck with is that it will not center my table anymore. Any ideas how to solve that?

edit: It actually centers my threeparttable, but it does not center my tabular above my notes (which are wider than the table).

jocom
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom footnotemark in table in minipage

Post by localghost »

Since you are not new to the forum, you should actually know what to do to get specific help [1]. I have no problem with the example below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{threeparttable}

\begin{document}
  \begin{table}[!ht]
    \caption{A table with notes}\label{tab:tablenotes}
    \centering
    \begin{threeparttable}
      \begin{tabular}{*4{c}}\toprule
        Table head\tnote{1} & Table head\tnote{1} & Table head\tnote{2} & Table head\tnote{2} \\ \midrule
        Some values & Some values & Some values & Some values \\
        Some values & Some values & Some values & Some values \\
        Some values & Some values & Some values & Some values \\
        Some values & Some values & Some values & Some values \\ \bottomrule
      \end{tabular}
      \begin{tablenotes}
        \footnotesize
        \item[1] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
        \item[2] The quick brown fox jumps over the lazy dog.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}
The appearance of the table notes can be influenced as described in the package manual.

If something is not working for you, please always clarify that by a minimal example so that others are able to comprehend the problem.

[1] View topic: Avoidable mistakes
jocom
Posts: 25
Joined: Fri May 07, 2010 4:28 pm

Custom footnotemark in table in minipage

Post by jocom »

Thanks for the reply.

Sorry that I didn't give a MWE. I should have built on, on my previous case.

For now I will use the code you provided, but slightly modified.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{threeparttable}
%\def\TPTminimum{30em}

\begin{document}
  \begin{table}[!ht]
    \caption{A table with notes}\label{tab:tablenotes}
    \centering
    \begin{threeparttable}
      \begin{tabular}{*4{c}}\toprule
        Table head\tnote{1} & Table head\tnote{2} \\ \midrule
        Some & values\tnote{1} \\
        Some & values \\
        Some\tnote{1} & values \\
        Some & values\tnote{2} \\ \bottomrule
      \end{tabular}
      \begin{tablenotes}
        \footnotesize
        \item[1] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
        \item[2] The quick brown fox jumps over the lazy dog.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}
For my problem is, that my table is very thin. Hence the default way of displaying the notes looks awkard.

By using

Code: Select all

\def\TPTminimum{30em}
this problem is solved, but then I don't get the table centered above the notes... (which I probably just should not want)

If you have any ideas on how to solve it, that would be great!

jocom
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom footnotemark in table in minipage

Post by localghost »

For this purpose I had the idea of a trick. It consists in principal of two threeparttable environments, one with the actual table, and one with only the notes. Here again a complete example.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs}
\usepackage{threeparttable}

\begin{document}
  \begin{table}[!ht]
    \caption{The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.}\label{tab:tablenotes}
    \centering
    \begin{threeparttable}
      \begin{tabular}{*4{c}}\toprule
        Table head\tnote{1} & Table head\tnote{2} \\ \midrule
        Some & values\tnote{1} \\
        Some & values \\
        Some\tnote{1} & values \\
        Some & values\tnote{2} \\ \bottomrule
      \end{tabular}
    \end{threeparttable}
    \begin{threeparttable}
      \begin{tablenotes}
        \footnotesize
        \item[1] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
        \item[2] The quick brown fox jumps over the lazy dog.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}
The table is centered directly above the notes, which are displayed with text width due to the lack of a predefined width. This can be evaded by putting the second threeparttable environment in to a \parbox.
jocom
Posts: 25
Joined: Fri May 07, 2010 4:28 pm

Re: Custom footnotemark in table in minipage

Post by jocom »

Thanks very much for this trick!

I agree that it isn't the most elegant in some kind; but it definitively gives the desired result!

jocom
Post Reply