[Tex/LaTex] how to scale math font only

fontsmath-modescaling

I am trying to mimic our institute's PPt-template for presentation foils using the beamer-class. The corporate quidelines prescribe the use of Helvetica as the main font. However, package helvet does not provide a good mathematical font. Therefore I want to replace it with the math font from the cmbright package:

\documentclass{beamer}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

%main font Helevtica
\renewcommand{\familydefault}{\sfdefault}
\usepackage{helvet}

%prevent beamer from meddling with math fonts
\usefonttheme{professionalfonts}

%following lines borrowed from cmbright.sty
\DeclareSymbolFont      {operators} {OT1}{cmbr}{m}{n}
\DeclareSymbolFont        {letters} {OML}{cmbrm}{m}{it}
\SetSymbolFont      {letters}{bold} {OML}{cmbrm}{b}{it}
\DeclareSymbolFont        {symbols} {OMS}{cmbrs}{m}{n}
\DeclareMathAlphabet{\mathit} {OT1}{cmbr}{m}{sl}
\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}
\DeclareMathAlphabet{\mathtt} {OT1}{cmtl}{m}{n}
\DeclareMathAlphabet{\mathbold}{OML}{cmbrm}{b}{it}
\DeclareMathSymbol{\alpha}{\mathalpha}{letters}{11}
\DeclareMathSymbol{\beta}{\mathalpha}{letters}{12}
\DeclareMathSymbol{\gamma}{\mathalpha}{letters}{13}
\DeclareMathSymbol{\delta}{\mathalpha}{letters}{14}
\DeclareMathSymbol{\epsilon}{\mathalpha}{letters}{15}
\DeclareMathSymbol{\zeta}{\mathalpha}{letters}{16}
\DeclareMathSymbol{\eta}{\mathalpha}{letters}{17}
\DeclareMathSymbol{\theta}{\mathalpha}{letters}{18}
\DeclareMathSymbol{\iota}{\mathalpha}{letters}{19}
\DeclareMathSymbol{\kappa}{\mathalpha}{letters}{20}
\DeclareMathSymbol{\lambda}{\mathalpha}{letters}{21}
\DeclareMathSymbol{\mu}{\mathalpha}{letters}{22}
\DeclareMathSymbol{\nu}{\mathalpha}{letters}{23}
\DeclareMathSymbol{\xi}{\mathalpha}{letters}{24}
\DeclareMathSymbol{\pi}{\mathalpha}{letters}{25}
\DeclareMathSymbol{\rho}{\mathalpha}{letters}{26}
\DeclareMathSymbol{\sigma}{\mathalpha}{letters}{27}
\DeclareMathSymbol{\tau}{\mathalpha}{letters}{28}
\DeclareMathSymbol{\upsilon}{\mathalpha}{letters}{29}
\DeclareMathSymbol{\phi}{\mathalpha}{letters}{30}
\DeclareMathSymbol{\chi}{\mathalpha}{letters}{31}
\DeclareMathSymbol{\psi}{\mathalpha}{letters}{32}
\DeclareMathSymbol{\omega}{\mathalpha}{letters}{33}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{letters}{34}
\DeclareMathSymbol{\vartheta}{\mathalpha}{letters}{35}
\DeclareMathSymbol{\varpi}{\mathalpha}{letters}{36}
\DeclareMathSymbol{\varrho}{\mathalpha}{letters}{37}
\DeclareMathSymbol{\varsigma}{\mathalpha}{letters}{38}
\DeclareMathSymbol{\varphi}{\mathalpha}{letters}{39}
\let\upDelta\Delta
\let\upOmega\Omega
\let\upGamma\Gamma
\let\upTheta\Theta
\let\upLambda\Lambda
\let\upXi\Xi
\let\upPi\Pi
\let\upSigma\Sigma
\let\upUpsilon\Upsilon
\let\upPhi\Phi
\let\upPsi\Psi

%doesn't seem to have an effect
%\DeclareMathSizes{12}{12.5}{10}{10}

\begin{document}
\begin{frame}
 Some Math E$E$
\end{frame}
\end{document}

This works quite well, except that the math letters are somewhat smaller than the normal Helvetica text. Is there a way to scale the fontsize, say by 1.1, if the typesetter is in math mode?

Best Answer

You can try,

\DeclareMathSizes{10}{10.5}{7}{7}

the format of the command is:

\DeclareMathSizes {t-size} {mt-size} {s-size} {ss-size}

Basically, we instruct the use of a <mt-size> as the math text size, <s-size> as the script size and <ss-size> the scriptscript size to be used in math, when <t-size> is the current text size. You can adjust the parameters to suit. You can also find more information at http://tex.loria.fr/general/new/fntguide.html

You can also scale down the helvetica font if you wish

\usepackage[scaled=0.95]{helvet}

This is probably a better solution than scaling up the maths fonts.

When using the \DeclareMathSizes the first parameter for the text font must be exactly what is used in the class declaration. For example with Beamer rather declare \documentclass[10pt]{beamer}, otherwise the command will appear as it is not working. It is also normal when you declare math sizes to provide a range of math font sizes for all the text fonts:

\DeclareMathSizes{9.8}{17}{7}{7}
\DeclareMathSizes{10.0}{17}{7}{7}
\DeclareMathSizes{10.95}{10}{7}{7}   % For size 10 text
\DeclareMathSizes{11}{19}{13}{9}      % For size 11 text
\DeclareMathSizes{12}{20}{14}{10}     % For size 12 text

You can test the above with the minimal example below, which is somewhat reduced from that originally posted:

\documentclass[10pt]{beamer}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

%main font Helevtica
\renewcommand{\familydefault}{\sfdefault}
\usepackage{helvet}

%prevent beamer from meddling with math fonts
\usefonttheme{professionalfonts}

%following lines borrowed from cmbright.sty
\DeclareSymbolFont      {operators} {OT1}{cmbr}{m}{n}
\DeclareSymbolFont        {letters} {OML}{cmbrm}{m}{it}
\SetSymbolFont      {letters}{bold} {OML}{cmbrm}{b}{it}
\DeclareSymbolFont        {symbols} {OMS}{cmbrs}{m}{n}
\DeclareMathAlphabet{\mathit} {OT1}{cmbr}{m}{sl}
\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}
\DeclareMathAlphabet{\mathtt} {OT1}{cmtl}{m}{n}
\DeclareMathAlphabet{\mathbold}{OML}{cmbrm}{b}{it}
\DeclareMathSymbol{\alpha}{\mathalpha}{letters}{11}
\DeclareMathSymbol{\beta}{\mathalpha}{letters}{12}
\DeclareMathSymbol{\gamma}{\mathalpha}{letters}{13}
\DeclareMathSymbol{\delta}{\mathalpha}{letters}{14}
\DeclareMathSymbol{\epsilon}{\mathalpha}{letters}{15}

\DeclareMathSizes{9.8}{17}{7}{7}
\DeclareMathSizes{10.0}{17}{7}{7}
\DeclareMathSizes{10.95}{10}{7}{7}   % For size 10 text
\DeclareMathSizes{11}{19}{13}{9}      % For size 11 text
\DeclareMathSizes{12}{20}{14}{10}     % For size 12 text

\begin{document}
\begin{frame}
This is a test $ a^{2}+\gamma\sigma^{\epsilon}$

 \fontsize{9.8pt}{13pt}\selectfont
 This is a test $ a^{2}+\gamma\sigma^{\epsilon}$

%\fontsize{10pt}{13pt}\selectfont
 This is a test $ a^{2}+\gamma\sigma^{\epsilon}$
\end{frame}
\end{document}
Related Question