7

I am trying to use \renewcommand to change the size of footnotes throughout the main text. I do this by changing \footenotesize to a different command, \scriptsize. Later on, I would like the command \footnotesize to return to its original use. But, using \renewcommand again to do this causes my .tex file to stop compiling, typically on the first \includegraphics command. Even without the \includegraphics command, the .tex file will not compile. I don't understand what's going on, but if I remove the second \renewcommand, the document compiles.

\documentclass{article}
\usepackage{graphicx}   % Graphics package to include figures (need graphicx.sty)

\begin{document}

\renewcommand{\footnotesize}{\scriptsize}

Here is some text. And Here is some text with a footnote.\footnote{Here is the footnote text.}

\renewcommand{\footnotesize}{\footnotesize}

\begin{figure}
\caption{Probability of Leaving within One Year: 1999-2002}
        \begin{center}
   \includegraphics[width=4in]{combined-one-3060-vertical.eps}
   \end{center}
\label{fig:leave1-baseline}
{\footnotesize
Notes:  The top panel plots the average leave probability for one-year age bins for the 2002 sample, while the bottom panel separately plots these probabilities for the 2002 and 1999-2001 samples.
}
\end{figure}

\end{document}
13

Your code doesn't work because you are using the same command as new and as old command in

\renewcommand{\footnotesize}{\footnotesize}

The right way to do it, is to first save the meaning of \footnotesize

\let\oldfootnotesize\footnotesize

and when you want to restore its meaning, use

\renewcommand{\footnotesize}{\oldfootnotesize}

So, modifying your MWE to

\documentclass{article}
\usepackage[demo]{graphicx}   % Graphics package to include figures (need graphicx.sty)

\begin{document}

\let\oldfootnotesize\footnotesize
\renewcommand{\footnotesize}{\scriptsize}

Here is some text. And Here is some text with a footnote.\footnote{Here is the footnote text.}

\renewcommand{\footnotesize}{\oldfootnotesize}

\begin{figure}
\caption{Probability of Leaving within One Year: 1999-2002}
        \begin{center}
   \includegraphics[width=4in]{combined-one-3060-vertical.eps}
   \end{center}
\label{fig:leave1-baseline}
{\footnotesize
Notes:  The top panel plots the average leave probability for one-year age bins for the 2002 sample, while the bottom panel separately plots these probabilities for the 2002 and 1999-2001 samples.
}
\end{figure}

\end{document} 

works.

9

You are creating a circular reference which exhausts TeX's capacity when you do something like

\renewcommand{\footnotesize}{\footnotesize}

The typical way to deal with temporary changes in TeX is to use a localization technique or scoping:

\begingroup
\renewcommand{\footnotesize}{\scriptsize}
% do stuff
\endgroup

This will restore the original meaning of \footnotesize after \endgroup. Alternatively, you would use an intermediate variable in the following way:

\let\oldfootnotesize\footnotesize
\renewcommand{\footnotesize}{\scriptsize}
% do stuff
\let\footnotesize\oldfootnotesize

The use of \let<csname1><csname2> makes an immediate copy of <csname2> into <csname1> at the time of calling. Depending on the type of control sequences, letltxmacro provides a secure alternative. See When to use \LetLtxMacro?

While the above hopefully answers the question, doing this is not suggested nor encouraged. In fact, using

\footnote{\scriptsize Here is the footnote text.}

is probably just as good without the complication(s).

  • Why is this not encouraged? – profj Sep 5 '13 at 5:48
  • 3
    @stanford202: You're temporarily influencing a typographical element in the document, which affects consistency. Also, while you're interested in changing the size of a \footnote's text, other document elements contained within your redefinition might use \footnotesize that you're not aware of. Certainly your example is very small and my discussion provides a general approach to this. – Werner Sep 5 '13 at 5:51
  • 2
    @stanford202 I think "not encouraged" is just Werner being polite: "don't do this!" might be a more accurate description:-) \footnotesize is one of a graded series of sizes that can be (and is) used for all kinds of purposes other than footnotes. Better to simply redefine \footnotetext to use \scriptsize rather than \footnotesize – David Carlisle Sep 5 '13 at 8:29
4

I'd do this in a different way, so \renewcommand can work without redefining kernel commands such as \footnotesize that are rather delicate to deal with.

The choice of the font used in the footnote text is made by \@footnotetext, so our first job is to make an indirect call instead of a direct one:

\usepackage{etoolbox} % this goes among the other instructions of the same type

% the following code should be in the preamble
\makeatletter % we must add to commands with an @ in their name
\patchcmd{\@footnotetext}
  {\footnotesize}
  {\footnotefontsize}
  {}{}
\newcommand{\footnotefontsize}{\footnotesize}
\makeatother

With this code we have made no real change to the font size; but now you're free to say

\renewcommand{\footnotefontsize}{\scriptsize}

or even (hopefully not)

\renewcommand{\footnotefontsize}{\Large}

or, probably

\renewcommand{\footnotefontsize}{\footnotesize}

Complete example

\documentclass{article}
\usepackage{etoolbox} % this goes among the other instructions of the same type

% the following code should be in the preamble
\makeatletter % we must add to commands with an @ in their name
\patchcmd{\@footnotetext}
  {\footnotesize}
  {\footnotefontsize}
  {}{}
\newcommand{\footnotefontsize}{\footnotesize}
\makeatother

\begin{document}
a\footnote{First}

\renewcommand{\footnotefontsize}{\Large}

b\footnote{Second}

\renewcommand{\footnotefontsize}{\footnotesize}

c\footnote{Third}
\end{document}

enter image description here

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.