GeneralProblems with \footnote in \caption (in table or figure env)

LaTeX specific issues not fitting into one of the other forums of this category.
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Problems with \footnote in \caption (in table or figure env)

Post by balf »

Try that code :

\ctable[caption = {Typer av undesirable aircraft states samt exempel\tmark[1]}, botcap, label =
table_bakgrund_tem_uas_exempel]{c}{\tnote[1]{\cite{defensive-flying}}}
{\begin{tabulary}{\textwidth}{|C|L|}
\hline
\rowcolor[gray]{.75}
\vphantom{\rule{0pt}{10pt}}typer av undesirable aircraft states & \vphantom{\rule{0pt}{10pt}}Exempel \\[5pt]
\hline
flygplanshantering & vertikal, laterala eller hastighets-deviationer\newline
onödiga väderpenetreringar\newline
unstabler approaches\newline
långa, flytande, bestämda eller icke-centrumlinje-landinga\\\hline
marknavigering & runway/taxiway-intrång\newline
fel taxiway, ramp, gate eller hold spot\newline
taxning över hastighetsbegränsning\\\hline
felaktig flygplanskonfiguration & automation, motor, roder, system eller mass-balans \textcolor{red}{events}\\\hline
\end{tabulary}}

Actually, ctable seems to cooperate with tabulary (even if the footnotemark is inside a cell).

Concerning LaTeX, I think one of the problems is that the more you use it and see what can be done, the more you demand of it (and the more you see at once the imperfections of word and the like).

B.A.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

jimisola
Posts: 22
Joined: Sat Feb 02, 2008 2:54 am

Problems with \footnote in \caption (in table or figure env)

Post by jimisola »

balf wrote:Try that code :

Code: Select all


Actually, ctable seems to cooperate with tabulary (even if the footnotemark is  inside a cell).
[/quote]

Great. However, I use footnotemark in the caption - not the cell. Hopefully, that works as well.
Another problem is that the ctable solution is only for table not for figure and I use both.
I would prefer a solution that is common to the both of them - if possible.

Thanks. I'll have a look at your ctable example later on.

[quote="balf"]
Concerning LaTeX, I think one of the problems is that the more you use it and see what can be done, the more you demand of it (and the more you see at once the imperfections of word and the like).[/quote]

Well, the initial cost of using it is quite high if you are using figures and tables. Plain text and LaTeX rocks!

/J
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Problems with \footnote in \caption (in table or figure env)

Post by balf »

Ctable also works for figures : you just have to use the keyword 'figure'.

Footnotes work as well in the caption; actually I first tested that case. The only drawback is that the default label for the footnote 'number' is that it is a. Any other value is an optional argument to both \tmark and \tnote. As I suppose usually there is at most one footnote per table, you'll always have to typeset the optional argument, unless you accept the default... or you patch the package.

B.A.
jimisola
Posts: 22
Joined: Sat Feb 02, 2008 2:54 am

Problems with \footnote in \caption (in table or figure env)

Post by jimisola »

balf wrote:Ctable also works for figures : you just have to use the keyword 'figure'.
Great!
balf wrote:Footnotes work as well in the caption; actually I first tested that case.
Perfect.
balf wrote:The only drawback is that the default label for the footnote 'number' is that it is a. Any other value is an optional argument to both \tmark and \tnote. As I suppose usually there is at most one footnote per table, you'll always have to typeset the optional argument, unless you accept the default... or you patch the package.
Yes, I've seen this behavior with footnotes already in my regular environments. It's a little bit irritating, but I'm no position (knowledge- or timewise) to patch the package so I have to accept that if I want to use it.

If I use an optional argument to \tmark and \tnote will the "foot counter" count up itself or will there be a mismatch with "regular" footnotes then? If I use the regular footnotemark and footnotetext then this is handled automatically.

I really appreciate you taking time to find a solution, but as you know (from the thread) I now have three solutions:
    • capt-of
      • nonfloat
        • ctable
        Which do you guys think I should use? And why?

        /J
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Problems with \footnote in \caption (in table or figure env)

Post by Juanjo »

sommerfee wrote:I do not recommended the usage of the nonfloat package... I recommend the usage of the capt-of package instead, it simply defines \captionof, if that is all you need, this is the perfect package for you.
Thanks for the advice about the capt-of package, that I did't know.
jimisola wrote:I really appreciate you taking time to find a solution, but as you know (from the thread) I now have three solutions:
  • capt-of
    • nonfloat
      • ctable
        Which do you guys think I should use? And why?
To start with, forget the nonfloat package. For the use I suggested, it suffices the \captionof command defined in the capt-of package, as pointed out by sommerfee. I see three alternatives:
  • Treat the table as a non-float object. In this case, you write the tabulary environment and add a caption with \captionof. You get the footnote with \footnotemark-\footnotetext. The footnote text goes at the bottom of the page.
  • Treat the table as a float object. Now, you use the \ctable command. However, I find odd, in this case, to put the footnote text above the caption (in the example of balf, you have the table, below the footnote and below the caption). So I would write the caption above the table (removing the botcap key from the argument of \ctable). Note that the footnote text, consequently, is not at the bottom of the page.
  • Avoid completely the cite in the caption. This allows to use the standard float mechanism of LaTeX. This option is also quite logical. You are writing a thesis. The table illustrates some concept that you explain in the text. Hence, it is simple, when talking about the contents of the table, to add a line or a footnote in order to provide the reader the source of the data. Put there the corresponding cite.
Choose the option you find the best.

Off topic_1: I've been trying to compile your tabulary environment and I get some odd things. Please, could you attach a pdf file showing the table you get? I would like to have a look.

Off topic_2: I suggested to use a class different from article for writing a thesis. Most thesis (if not all) theses I've seen look like a book. I find simpler to start from a book class, instead of modifying the layout of the article class. Anyway, if you feel comfortable with the latter, go ahead.
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Problems with \footnote in \caption (in table or figure env)

Post by balf »

I added the botcap option because Jimisola asked me if with ctable I could get exactly the same result as he had. I also tried without this option, which is the normal layout for a table,but the result when I compiled was the caption above and the footnote below.

B.A.
airblaster
Posts: 4
Joined: Wed Jul 15, 2009 11:49 am

Problems with \footnote in \caption (in table or figure env)

Post by airblaster »

Sorry for pushing this old topic, but its the only one talking about using tabulary inside ctable, so I guess this is the best place.

I adopted the code at the beginning of the second page for use in my thesis, and noticed there is a flaw when using tabulary inside ctable: the whole table is shifte to the right by a few millimeters.

E.g. compare the output of the following snippets:
tabulary within ctable:

Code: Select all

\rowcolors[]{1}{lightgray!20}{lightgray!10}
\ctable[
caption  = Software zum erstellen von QR-Codes TabularY,
label    = nowidth,
width = \textwidth,
doinside = \footnotesize,
]{l}{
}{ \begin{tabulary}{\textwidth}{LLLL} \FL
\rowcolor{gray!20}
Produkt &  Betriebssystem & Tags & Webseite \ML
ZXing Generator &  n/a (Webdienst)  &  Kontakt, Kalender, URL, Notiz, E-Mail, Ort, Tel., SMS& \url{http://zxing.appspot.com/generator/} \NN
%\midrule
Mobile Barcoder &  n/a (Firefox Add-In) &  URL & \url{http://sample.org.uk/blog/tag/barcode} \LL
\end{tabulary}
}
ctable w/o tabulary

Code: Select all

\rowcolors[]{1}{lightgray!20}{lightgray!10}
\ctable[
caption  = Software zum erstellen von QR-Codes TabularX,
label    = nowidth,
maxwidth = \textwidth,
doinside = \footnotesize,
]{XXXX}{
}{ \FL
\rowcolor{gray!20} Produkt &  Betriebssystem & Tags & Webseite \ML
ZXing Generator &  n/a (Webdienst)  &  Kontakt, Kalender, URL, Notiz, E-Mail, Ort, Tel., SMS& \url{http://zxing.appspot.com/generator/} \NN
Mobile Barcoder &  n/a (Firefox Add-In) &  URL & \url{http://sample.org.uk/blog/tag/barcode} \LL
}
The background colors are also a bit messed up.

The following is the preample I used - its a bit strange since I use LyX.

Code: Select all

% Quellcode vorschauen
%% LyX 1.6.4 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,a4paper,oneside,ngerman,headinclude=true,footinclude=false,headsepline,footnotes=multiple,listof=totoc,paper=a4,pagesize,intoc]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{babel}

\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true, pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=true,pdfborder={0 0 1},backref=false,colorlinks=false]
 {hyperref}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{tabulary}
\usepackage[table]{xcolor}
\usepackage{breakurl}
\usepackage{ctable}

\makeatother

\begin{document}
Is there any way to fix this? I'd prefer to use tabulary with ctable, but not like this.
Post Reply