4

I have the following problem: My tables are formatted via caption[title]{long description...}. Now I need to add the sources to some of them as a footnote added to the caption, like in the following example:

enter image description here

I tried this: Using \footnote in a figure's \caption, but the problem is that the footnotes also show up in the list of tables at the beginning of the document.

Note that 'The red fox - attributes' is the [title] and the rest of the text is the {long description}, used as here: Add table titles from captions in scrreprt class

Also I am not using footnotes for every single caption, so the solution would have to be flexible in that it provides the option to add one (but not mandatory).

Is the above format possible?

Looking for a solution which works safely without undesired results.

MWE:

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\setlength\myindention{1em} 
\usepackage{chngcntr}
\counterwithout{table}{chapter}

\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}

\begin{document}

\listoftables

\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}

\end{document} 

Thanks.

1

If the only difference is that you sometimes need a \footnotemark at the end of the title, you can define a toggle (generalization of the starred macros) + that add it.

\documentclass{scrreprt}

\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,
    singlelinecheck=false,format=plain, parindent=1em]{caption}


\usepackage{xparse}

\newlength\myindention
\setlength\myindention{1em} 

\let\oldcaption\caption
\RenewDocumentCommand { \caption } { t{+} O{} m } {%
    \oldcaption[#2]{%
        #2%
        \IfBooleanT{#1}{\footnotemark}
        \\%
        \hspace*{\myindention}#3
    }%
}

\begin{document}

\listoftables

\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}

\begin{table}[h]
\caption+[title table 2]{description table 2}
\fbox{content}
\end{table}
\footnotetext{Source.}

\end{document}

Then \caption works as in your MWE and \caption+ does the same but adds \footnotemark at the end of the title (that is the \IfBooleanT line). To make it clear:

  • table with source: \caption+[title]{description} and \footnotetext afterwards
  • table without source: \caption[title]{description} only
  • Thanks it works. Did I get this right, I need to use \caption+ for the tables I want to add sources too, and regular \caption for the rest? That is exactly what I needed! – TomM Jan 3 '14 at 13:51
  • Yep I have just seen the + as part of the \caption+ command, which I have missed first ;) See my edited comment. – TomM Jan 3 '14 at 13:57
  • 1
    You get it right :-) See also my edit on the answer (at the end of it) – Tobi Jan 3 '14 at 13:58
4

Not very elegant but it does seem to work:

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\setlength\myindention{1em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\usepackage{xparse}

\let\oldcaption\caption
\RenewDocumentCommand\caption{D [] {} D [] {} m}{%
  \def\tempa{}%
  \def\tempb{#1}%
  \def\tempc{#2}%
  \ifx\tempa\tempb\def\tempb{#3}\fi%
  \ifx\tempa\tempc\let\tempc\tempb\fi%
  \oldcaption[\tempb]{\tempc\\\hspace*{\myindention}#3}%
  }

\begin{document}

\listoftables

\chapter{Introduction}
\begin{table}[h]
\caption[title table 1][title table 1\footnotemark]{description table 1}
\fbox{content}
\end{table}

Anywhere on the same page where the float appears\footnotetext{blah}
but at least before the next footnote\footnote{the nextone}

\end{document}

enter image description here

I expect that somebody else will be able to suggest something better, though, so I'd only recommend this if time is of the essence!

  • Alright thank you. Let's see if there is more coming or not. From your answer I am not sure, is this safe to use? I need a solution for a huge document ;) – TomM Jan 1 '14 at 22:57
  • 1
    I don't think it is probably unsafe. It is much like the other solution you linked to. It is just rather messy to use because you need to type the heading out twice - once with and once without the footnote marker - when you want a footnote mark. I considered trying to avoid this but I wasn't convinced I could do that without introducing fragility which might break in unforeseen ways. That isn't a guarantee, of course, as there is a very great deal I don't know. But it is not doing anything especially hair raising as far as I know. – cfr Jan 1 '14 at 23:38
  • @karlkoeller May I ask for your opinion, as the old solution stems from you :) – TomM Jan 2 '14 at 13:25
  • Do you know that D [] {} = O {}? ;-) Furthermore here the o type in combination with \IfNoValueT seems more appropriate :-) – Tobi Jan 3 '14 at 13:08
  • @cfr Ok I really appreciate your help. Although still looking for a solution which works without doubt ;) – TomM Jan 3 '14 at 13:08

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.