|
134 | 134 | % Use this to set the font family for headers and other decor: |
135 | 135 | \newcommand{\py@HeaderFamily}{\sffamily} |
136 | 136 |
|
| 137 | +% Set up abstract ways to get the normal and smaller font sizes that |
| 138 | +% work even in footnote context. |
| 139 | +\newif\ifpy@infootnote \py@infootnotefalse |
| 140 | +\let\py@oldfootnotetext\@footnotetext |
| 141 | +\def\@footnotetext#1{% |
| 142 | + \bgroup% |
| 143 | + \py@infootnotetrue |
| 144 | + \py@oldfootnotetext{#1}% |
| 145 | + \egroup% |
| 146 | +} |
| 147 | +\def\py@defaultsize{% |
| 148 | + \ifpy@infootnote\footnotesize\else\normalsize\fi% |
| 149 | +} |
| 150 | +\def\py@smallsize{% |
| 151 | + \ifpy@infootnote\scriptsize\else\small\fi% |
| 152 | +} |
| 153 | + |
137 | 154 | % Redefine the 'normal' header/footer style when using "fancyhdr" package: |
138 | 155 | \@ifundefined{fancyhf}{}{ |
139 | 156 | % Use \pagestyle{normal} as the primary pagestyle for text. |
|
817 | 834 | \newcommand{\csimplemacro}[1]{\code{#1}} |
818 | 835 | \newcommand{\kbd}[1]{\code{#1}} |
819 | 836 | \newcommand{\samp}[1]{`\code{#1}'} |
820 | | -% This weird definition of \var{} allows it to always appear in roman |
821 | | -% italics, and won't get funky in code fragments when we play around |
822 | | -% with fonts. This also works directly in math mode. |
823 | | -% XXX \normalsize is bad in footnotes, though; we need a way to |
824 | | -% determine when we're in a footnote. |
825 | 837 | \newcommand{\var}[1]{% |
826 | 838 | \ifmmode% |
827 | | - \hbox{\normalsize\textrm{\textit{#1\/}}}% |
| 839 | + \hbox{\py@defaultsize\textrm{\textit{#1\/}}}% |
828 | 840 | \else% |
829 | | - \normalsize\textrm{\textit{#1\/}}% |
| 841 | + \py@defaultsize\textrm{\textit{#1\/}}% |
830 | 842 | \fi% |
831 | 843 | } |
832 | 844 | \renewcommand{\emph}[1]{{\em #1}} |
833 | 845 | \newcommand{\dfn}[1]{\emph{#1}} |
834 | 846 | \newcommand{\strong}[1]{{\bf #1}} |
835 | 847 | % let's experiment with a new font: |
836 | | -\newcommand{\file}[1]{`{\small\textsf{#1}}'} |
837 | | -\newcommand{\filenq}[1]{{\small\textsf{#1}}} |
| 848 | +\newcommand{\file}[1]{`\filenq{#1}'} |
| 849 | +\newcommand{\filenq}[1]{{\py@smallsize\textsf{#1}}} |
838 | 850 |
|
839 | 851 | % Use this def/redef approach for \url{} since hyperref defined this already, |
840 | 852 | % but only if we actually used hyperref: |
|
843 | 855 | \noindent% |
844 | 856 | \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% |
845 | 857 | \py@LinkColor% color of the link text |
846 | | - \small\sf #1% |
| 858 | + \py@smallsize\sf #1% |
847 | 859 | \py@NormalColor% Turn it back off; these are declarative |
848 | 860 | \pdfendlink}% and don't appear bound to the current |
849 | 861 | }% formatting "box". |
850 | 862 | \else |
851 | | - \newcommand{\url}[1]{\mbox{\small\textsf{#1}}} |
| 863 | + \newcommand{\url}[1]{\mbox{\py@smallsize\textsf{#1}}} |
852 | 864 | \fi |
853 | | -\newcommand{\email}[1]{{\small\textsf{#1}}} |
854 | | -\newcommand{\newsgroup}[1]{{\small\textsf{#1}}} |
| 865 | +\newcommand{\email}[1]{{\py@smallsize\textsf{#1}}} |
| 866 | +\newcommand{\newsgroup}[1]{{\py@smallsize\textsf{#1}}} |
855 | 867 |
|
856 | 868 | \newcommand{\py@varvars}[1]{{% |
857 | 869 | {\let\unspecified=\py@unspecified% |
|
887 | 899 | \newcommand{\ctype}[1]{\texttt{#1}} % C struct or typedef name |
888 | 900 | \newcommand{\cdata}[1]{\texttt{#1}} % C variable, typically global |
889 | 901 |
|
890 | | -\newcommand{\mailheader}[1]{{\small\textsf{#1:}}} |
891 | | -\newcommand{\mimetype}[1]{{\small\textsf{#1}}} |
| 902 | +\newcommand{\mailheader}[1]{{\py@smallsize\textsf{#1:}}} |
| 903 | +\newcommand{\mimetype}[1]{{\py@smallsize\textsf{#1}}} |
892 | 904 | % The \! is a "negative thin space" in math mode. |
893 | 905 | \newcommand{\regexp}[1]{% |
894 | 906 | {\tiny$^{^\lceil}\!\!$% |
895 | | - {\normalsize\code{#1}}% XXX should use \footnotesize in footnotes |
| 907 | + {\py@defaultsize\code{#1}}% |
896 | 908 | $\!\rfloor\!$% |
897 | 909 | }} |
898 | 910 | \newcommand{\envvar}[1]{% |
|
0 commit comments