My document has a base font size of 12pt, but I want the figures to be typeset as if the base font size were 10pt (some of the figures use graphics packages that hardwire font size commands rather than offering \foosize indirections, so I can't just fix it that way).
I have found Switching to different font size(s) locally, so my goal is to wrap that up in a \newenvironment. EDIT: It is not quite as simple as using How do I create a macro which reads the content of a file when the macro is defined?, but I now have this:
\usepackage{catchfile}
\CatchFileDef{\tenpointdecl}{size10.clo}{\makeatletter}
\newenvironment{fontsizeten}{%
\let\saveendinput\endinput
\let\endinput\relax
\let\savenewcommand\newcommand
\let\newcommand\renewcommand
\tenpointdecl
\let\newcommand\savenewcommand
\let\endinput\saveendinput
}{}
This works, but strikes me as inelegant. It would be better if there were a way to rewrite the contents of \tenpointdecl so that the \lets every time it is invoked were unnecessary. Suggestions?
\letare necessary and take up a negligible amount of time. – egreg Nov 13 '11 at 20:24\newcommandwith\renewcommand, but this is not possible; etoolbox's\patchcmdcan do only a one shot search and replace at a time and one should know how many\newcommandare to be changed. It might be used to cut off the\endinput, but it's like using a gun to kill a fly. – egreg Nov 13 '11 at 20:39