# How to create “local” footnotes in block quotes?

I have a block quote, which contains a footnote - but I don't want to put that at the end of the page, but rather at the end of the quote. Like so:

Does footnote command allow this kind of customization? If not - where should I look? Much appreciated!

-
I think the package parnotes is worth reading the documentation. It resulted BTW from this TeX.SX question: tex.stackexchange.com/questions/34746/…. –  Speravir Mar 10 '12 at 2:51
I was so getting ready to pimp my package, but minipages are a better solution if (1) the content is all on one page, and (2) you want to use the default footnote formatting. Personally, though, I'd set the footnotes off with rules on both sides, as in one of the examples I gave – and for that parnotes is much easier than hacking the footnote code. –  rdhs Mar 10 '12 at 15:43
@Speravir does it allow for custom footnote number? In my example both footnotes should be numbered 4, because they are essentially the footnotes from the original work. –  drozzy Mar 10 '12 at 19:47
@drozzy: I honestly do not know, how to do that. Looking into the source of that package there are two counters, and I don’t know which one must be advanced and how. You should BTW have been clearer, that you needed on the customized counter. (Seeing your questions resp. the examples there: You do write a text about Fibonacci, don’t you?) –  Speravir Mar 10 '12 at 22:45
@rdhs: Do you see a way for customizing the parnote counter, such as adding a \theparnote or similar? See my comment to @drozzy, too. –  Speravir Mar 10 '12 at 22:48

Anticipating your follow-up questions based on this question: Change the font of the block quote? here's a solution with minipages that also gets the formatting of the footnote and the marker correct. I've also created a \qfootnote command (adapting Gonzalo's idea) which takes 3 arguments: the first optional argument specifies the formatting for the footnote marker. The second argument is the footnote number. Since the quoted footnotes will be arbitrarily numbered, it makes sense to set them manually inside each quote. The third argument is the footnote text. This command includes Gonzalo's modifications to the footnote marker indentation. This gives you maximum flexibility on the formatting of the footnotes in the quote.

\documentclass{article}

\usepackage{etoolbox}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\quotefont{Linux Biolinum O}
\AtBeginEnvironment{quote}{\quotefont\small}
\makeatletter
\patchcmd{\@mpfootnotetext}{\footnotesize}{\footnotesize\quotefont}{}{}
\newcommand\qfootnote[3][arabic]{%
\defcounter{mpfootnote}{#2-1}%
\renewcommand\@makefntext[1]{\noindent\makebox[.5em][l]{\@makefnmark}##1}%
\renewcommand{\thempfootnote}{\quotefont\csname#1\endcsname{mpfootnote}}%
\footnote{#3}}
% Use of the \qfootnote command:
% \qfootnote[<format>]{<number>}{<text>} (default is arabic)
% example: \qfootnote[alph]{3}{text} will yield 'c' as the footnote marker.
% example: \qfootnote[roman]{4}{text} will yield 'iv' as the marker
% example: \qfootnote{2}{text} will yield '2' as the marker
\begin{document}
Some text. This is the main text.\footnote{This is a footnote in the main text.}
\begin{quote}
\begin{minipage}{\linewidth}
This is a quotation with a footnote in it.\qfootnote[alph]{4}{A footnote in the
minipage} The footnote is numbered independently of the rest of the text.
\end{minipage}
\end{quote}

\end{document}


Simplified version

The first version of this answer had a simpler solution. If you know that your footnotes will always have the same kind of numbering system, then you can just use regular footnote commands inside a minipage and have a simple command \quotefnum to set the footnote number. I've left in the quote font modifications from your previous question. If you don't need a different font for the quote environment, then this can be made even simpler by removing the AtBeginEnvironment line and the \patchcmd line, and removing \quotefont from the redefinition of \thempfootnote.

\documentclass{article}

\usepackage{etoolbox}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\quotefont{Linux Biolinum O}
\AtBeginEnvironment{quote}{\quotefont\small}
\makeatletter
\patchcmd{\@mpfootnotetext}{\footnotesize}{\footnotesize\quotefont}{}{}
\makeatother
\newcommand*\quotefnum[1]{\defcounter{mpfootnote}{#1-1}}

\renewcommand{\thempfootnote}{\quotefont\arabic{mpfootnote}}

\begin{document}
Some text. This is the main text.\footnote{This is a footnote in the main text.}
\begin{quote}
\begin{minipage}{\linewidth}
\quotefnum{4}
This is a quotation with a footnote in it.\footnote{A footnote in the minipage}. The footnote is numbered independently of the rest of the text.
\end{minipage}
\end{quote}

\end{document}

-
That's great - the custom numbering is exactly what I needed. But which parts are actually required to make this work - for example, do I need makeatletter and patchcmd lines? –  drozzy Mar 10 '12 at 3:47
On \makeatletter see What to \makeatletter and \makeatother do. The \patchcmd changes the minipage footnotes to \quotefont to match your quote environment. The first \renewcommand sets the indentation for the footnotes. The second makes the footnote marker numeric. So all are needed, yes. –  Alan Munn Mar 10 '12 at 3:51
So... if I don't want to change the fonts, I can omit the patchcmd? –  drozzy Mar 10 '12 at 3:53
Yes, and remove \quotefont from the second \renewcommand. –  Alan Munn Mar 10 '12 at 3:55
Why do we need the \noindent\makebox commands? I mean, why doesn't it just put the footnote counter into text without spaces around it? –  drozzy Mar 10 '12 at 20:19

A possible simple approach would be to use a minipage inside the quote environment:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1]
\begin{quote}
\begin{minipage}{\linewidth}
\stepcounter{footnote}
\renewcommand\thempfootnote{\arabic{footnote}}
\lipsum[1] text\footnote{this is a footnote} text text text.
\end{minipage}
\end{quote}

\end{document}


Here's an enhanced version of my answer: now everything is dome through a new environment fnquote that redefines and steps appropriately the counter and formats the footnote mark as in the image (suppressing the indentation):

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\newenvironment{fnquote}
{\begin{quote}
\begin{minipage}{\linewidth}\stepcounter{footnote}
\renewcommand\thempfootnote{\arabic{footnote}}
\renewcommand\@makefntext[1]{\noindent\makebox[1.2em][l]{\@makefnmark}##1}}
{\end{minipage}\end{quote}}
\makeatother

\begin{document}

\lipsum[1]
\begin{fnquote}
\lipsum[1] text\footnote{this is a footnote} text text text.
\end{fnquote}

\end{document}


A new version; a new command \qtfootnote is available allowing to manually specify the value for the footnote marker:

\documentclass{article}
\usepackage{lipsum}

\newcounter{tmpfn}

\makeatletter
\newenvironment{fnquote}
{\begin{quote}
\begin{minipage}{\linewidth}
\renewcommand\thempfootnote{\arabic{mpfootnote}}
\renewcommand\@makefntext[1]{\noindent\makebox[1.2em][l]{\@makefnmark}##1}
}
{\end{minipage}\end{quote}}
\makeatother
\newcommand\qtfootnote[2]{%
\setcounter{tmpfn}{\thempfootnote}%
\footnote{#2}%
\setcounter{mpfootnote}{\thetmpfn}}

\begin{document}

\lipsum[1]
\begin{fnquote}
\lipsum[1] text\qtfootnote{5}{this is a footnote} text text text.
\end{fnquote}

\end{document}


And the fourth version, now the code has been greatly simplified by using the features provided by the nccfoots package; now the footnote marker can be freely assigned (arabic, alphabetic, roman, etc.) in an easy way:

\documentclass{article}
\usepackage{nccfoots}

\newcommand\Text{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque.}

\makeatletter
\newenvironment{fnquote}
{\begin{quote}\begin{minipage}{\linewidth}
\renewcommand\@makefntext[1]{\noindent\makebox[1em][l]{\@makefnmark}##1}}
{\end{minipage}\end{quote}}
\makeatother
\newcommand\qtfootnote[2]{\Footnotemark{#1}\Footnotetext{#1}{#2}}

\begin{document}

\Text
\begin{fnquote}
\Text text text text text\qtfootnote{4}{this is a footnote} text text.
\end{fnquote}
\begin{fnquote}
\Text text text text text\qtfootnote{d}{this is a footnote} text text.
\end{fnquote}
\begin{fnquote}
\Text text text text text\qtfootnote{IV}{this is a footnote} text text.
\end{fnquote}

\end{document}


-
Looks cool. What is the minipage(is there a doc for it somewhere)? And what does the linewidth argument do inside of it? –  drozzy Mar 10 '12 at 3:48
A minipage is basically what it says: a small page within a page. The \linewidth argument sets the width of it to the width of the line. You might want to browse through the LaTeX Wikibook for lots of accurate online info. –  Alan Munn Mar 10 '12 at 3:58
@drozzy: I've updated my answer; now you can manually specify the footnote marker. –  Gonzalo Medina Mar 10 '12 at 14:28
@GonzaloMedina Why are you using footnote as the counter and not mpfootnote? –  Alan Munn Mar 10 '12 at 14:43
@AlanMunn: good question! I initially (for some reason I can't remember) redefined \thempfootnote to depend on footnote and I kept using footnote. However, it seems cleaner to use mpfootnote, so I'll do the changes. –  Gonzalo Medina Mar 10 '12 at 14:55

You can place the "insides" of the quote in a minipage of width \linewidth. Footnotes within a minipage will be purged at closure.

Here's a minimal example:

\documentclass{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum laoreet tincidunt convallis. Praesent eu purus
mauris. Aliquam erat volutpat. Vivamus convallis neque
rutrum lorem imperdiet egestas. Suspendisse potenti. Morbi
posuere convallis mauris quis imperdiet.
\begin{quote}
\begin{minipage}{\linewidth}
Nunc suscipit gravida sollicitudin. Donec molestie libero nunc,
sed ante id nisl iaculis sagittis.} nulla vel nunc
blandit dapibus. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus.
\end{minipage}
\end{quote}
Morbi sodales arcu enim, et accumsan ante. Mauris sed ante erat.
Praesent scelerisque metus ac mauris placerat vehicula.
Nam tristique faucibus felis sed consectetur.
\end{document}


Footnote numbering can be modified, as needed. Perhaps more advisable is to define a blockquote environment that is all-inclusive:

\newenvironment{blockquote}[1]
{\list{}{\rightmargin\leftmargin}% \begin{blockquote}
\item\relax\minipage{\linewidth}%
\setcounter{mpfootnote}{\numexpr#1-1}%
\renewcommand{\thempfootnote}{\arabic{mpfootnote}}}
{\endminipage\endlist}% \end{blockquote}


Now you can use

%...
\begin{blockquote}{5}
Nunc suscipit gravida sollicitudin. Donec molestie libero nunc,
sed ante id nisl iaculis sagittis.} nulla vel nunc
blandit dapibus. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus.
\end{blockquote}
%...


which yields a number-specific footnote:

Specifying such specific references might not mesh well with hyperref. Additional definitions can now be included in the blockquote environment.

-
I like your example because it's simple... but I also want to specify the footnote number to be 4. –  drozzy Mar 10 '12 at 20:00
@drozzy: I've updated my answer to now take an optional number-specific argument. –  Werner Mar 10 '12 at 22:04

Thank you for everyone for their answers! Here is what I did in the end - which was a simplification and unification of some of the ideas expressed in the answers.

My class defines a custom command:

% Set the footnote number inside a minipage to a custom number
\newcommand*\footnoteNum[1]{%
\defcounter{mpfootnote}{#1-1}
% Set numbering to arabic
\renewcommand{\thempfootnote}{\arabic{mpfootnote}}}


and then I use it in text as follows:

\begin{quote}
\begin{minipage}{\linewidth}\footnoteNum{4}
“C douzième siècle,\footnote{Publicus scriba.''}
que le célèbre mathématicien Léonard Bonacci de
l’arithmétique, de l’algèbre et de la géométrie.
\end{minipage}
\end{quote}


The reason I like this approach is:

1. It leaves the usual environments like quote unmodified. No need to remember a weird sounding name.
2. It calls the footnote command by it's original name - again, no need to remember a custom command name.
3. It follows the common sense of a regular footnote: if the user does not wrap it up in a minipage, footnote will appear at the bottom of the page.
4. footnoteNum command, while not obvious, will be an easy to figure out, since, after compiling the document and finding that the footnote number is a, the user will suspect that he missed something, and remember to set the footnote number.

Again, thanks to everyone for answering - but there was no one answer that exactly what I needed, so for future generations I wanted to provide my own version. :-)

-
You don't need \makeatletter, \makeatothe (you missed an r), since you do not use the @ sign for a letter. –  Peter Grill Mar 13 '12 at 2:18
Thanks, corrected! –  drozzy Mar 13 '12 at 3:02
So essentially this is the first version of my answer. Glad I could help. –  Alan Munn Mar 13 '12 at 3:21
Hm... you are right! Could you add that to the answer? I knew it took it from somewhere, but in my drunken state forget from where. –  drozzy Mar 13 '12 at 4:00