Discussion:
Using footnotes in \paragraph{}
(too old to reply)
d***@gmail.com
2006-08-05 20:52:36 UTC
Permalink
Hi all,

I am having troubles using the \footnote command. I wrote a test file
to demonstrate the problem:

\documentclass[a4paper,11pt,oneside]{book}
\begin{document}
\paragraph{Hello world!\footnote{A common phrase in computer science}}
\end{document}

This dies when using pdflatex with this error:

Document Class: book 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/teTeX/share/texmf.local/tex/latex/base/bk11.clo))
(./test.aux)
! Use of \@xfootnote doesn't match its definition.
\@ifnextchar ***@d =#1\def \***@a {#2}
\def \***@b
{#3}\futu...
l.8 \end{document}

I found that removing the \paragraph{} wrapper fixes the problem, but I
found using \paragraph{} more convenient because without it the
paragraph layout is wrong (i.e. zero space between paragraphs).

Any ideas?

Thanks!
--Dave.
Will Robertson
2006-08-06 02:41:15 UTC
Permalink
Post by d***@gmail.com
I found that removing the \paragraph{} wrapper fixes the problem, but I
found using \paragraph{} more convenient because without it the
paragraph layout is wrong (i.e. zero space between paragraphs).
You seem a little confused. The \paragraph command is a fairly
low-ranking sectioning command, used to add structure to your document.
If you want to change the spacing (and indent) between paragraphs,
that's another matter entirely. See the FAQ:
<http://www.tex.ac.uk/cgi-bin/texfaq2html?label=parskip>

Back to your original problem. Because \paragraph is a sectioning
command, its argument is saved for later possible inclusion in the
table of contents. This makes it a "moving argument", which disallows
"fragile" commands within it.

The solution, then, is to \protect it:

\documentclass[a4paper,11pt,oneside]{book}
\begin{document}
\paragraph{Hello world!\protect\footnote{A common phrase in computer
science}}
\end{document}

This is covered in the FAQ:
<http://www.tex.ac.uk/cgi-bin/texfaq2html-gamma?label=protect>

Will
d***@gmail.com
2006-08-06 05:37:26 UTC
Permalink
Thanks! Both of these solutions worked.
Post by Will Robertson
Post by d***@gmail.com
I found that removing the \paragraph{} wrapper fixes the problem, but I
found using \paragraph{} more convenient because without it the
paragraph layout is wrong (i.e. zero space between paragraphs).
You seem a little confused. The \paragraph command is a fairly
low-ranking sectioning command, used to add structure to your document.
If you want to change the spacing (and indent) between paragraphs,
<http://www.tex.ac.uk/cgi-bin/texfaq2html?label=parskip>
Back to your original problem. Because \paragraph is a sectioning
command, its argument is saved for later possible inclusion in the
table of contents. This makes it a "moving argument", which disallows
"fragile" commands within it.
\documentclass[a4paper,11pt,oneside]{book}
\begin{document}
\paragraph{Hello world!\protect\footnote{A common phrase in computer
science}}
\end{document}
<http://www.tex.ac.uk/cgi-bin/texfaq2html-gamma?label=protect>
Will
Ulrike Fischer
2006-08-06 12:06:12 UTC
Permalink
Post by Will Robertson
Back to your original problem. Because \paragraph is a sectioning
command, its argument is saved for later possible inclusion in the
table of contents. This makes it a "moving argument", which disallows
"fragile" commands within it.
No, for paragraph this is ok, as they seldom get in the table of
contents but in general you wouldn't want the footnote to go also in
the table of contents or in the heading, so the correct solution is to
use the optional argument of the sectioning command:

\section[Text for table of contents]{Text with footnote\footnote{...}}

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ftnsect
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Continue reading on narkive:
Loading...