[Tex/LaTex] Smaller font size in quote environment relative to context

conditionalsfontsizefootnotesquoting

I want to have all quotes in the quote-environment in a smaller font. This is possible with the etoolbox-package and the command:

\AtBeginEnvironment{quote}{\small}

But if I use a quote-environment in a footnote, the quotation is set to fontsize 'small' and therefore larger than the footnote-size. In the footnote I would like it better to have the same size as the footnote-text.

Is it possible to redefine the quote-environment relative to the context?

Best Answer

It may be better to stick to a scaled version of the quote, regardless of the location of use (body text or footnote). In that regard, you were two letters and a package too short:

enter image description here

\documentclass{article}
\usepackage{relsize,etoolbox}% http://ctan.org/pkg/{relsize,etoolbox}
\AtBeginEnvironment{quote}{\smaller}% Step font down one size relative to current font.
\begin{document}
Here is some text.
\begin{quote}
This is a quote.
\end{quote}
Here is some more text\footnote{Some text.
\begin{quote}
This is a quote in a footnote.
\end{quote}
Some more text.}
\end{document}

relsize uses \smaller to step the font down one size from the current font size. For scalable fonts at any size, also include lmodern.


Alternatively, conditional scaling is also possible for quote. The following assumes you're using a default document class (like article, book or report) or one that doesn't alter the footnote printing mechanise \@makefntext:

enter image description here

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\newif\if@in@footnote@
\renewcommand\@makefntext[1]{%
    \parindent 1em%
    \noindent\@in@footnote@true
    \hb@xt@1.8em{\hss\@makefnmark}#1}
\AtBeginEnvironment{quote}{\if@in@footnote@\else\small\fi}
\makeatother
\begin{document}
Here is some text.
\begin{quote}
This is a quote.
\end{quote}
Here is some more text\footnote{Some text.
\begin{quote}
This is a quote in a footnote.
\end{quote}
Some more text.}
\end{document}

\if@in@footnote@ is set to true inside when creating the footnote, which is picked up inside the quote environment. If true, then no font change occurs, otherwise it uses \small.


Under the KOMA-script classes, you could use

\makeatletter
\newif\if@in@footnote@
\renewcommand{\@footnotetext}[1]{%
  \scr@saved@footnotetext{\@in@footnote@true #1}%
  \csname FN@mf@prepare\endcsname
}
\AtBeginEnvironment{quote}{\if@in@footnote@\else\small\fi}
\makeatother
Related Question