# Mixing font sizes inside the same equation

I would like to use latex to produce math output like this:

Please, no scolding about how this looks like a ransom note, makes your eyeballs bleed, etc. This is for didactic purposes in specific situations in teaching physics. The first one is meant to focus the student's eyes on the main physical relationship, so they're not distracted by the coupling constants. The second one (for students at a much lower mathematical level) is to express the idea that when a force is applied to a small mass, the result is a big acceleration.

I've tried three methods:

(1) It seems that code like this only partly works:

${\Huge a}=F/{\scriptstyle m}$


In the outpout, the "a" isn't enlarged at all, although the "m" is small. I would also like to be able to produce more extreme sizes than Huge and scriptstyle.

(2) I also tried accomplishing this using pdf2svg (which I believe is what textext does under the hood), but the results seemed extremely buggy. I created separate pdf files for the small and large stuff, then converted to svg. But when I cut and pasted from one of the svg files to the other, the results were garbled (completely incorrect text).

(3) I tried using textext in inkscape. However, textext seems to be broken in the version of inkscape I'm using (0.92). With any input (even input not involving math mode) I get a long error message starting with "Error: /undefined in .makeoperator."

You can use \scalebox from the graphicx package for this. The command takes two arguments, the scale (less than one scales down, more than one scales up) and the content. Note that the content needs to be set in math mode even when you are already in math mode. The scale can be set arbitrarily large or small.

For convenience you can define a new command that inserts math mode automatically.

Note that the normal spacing that LaTeX provides for math can no longer be applied between size changes so you may need to insert manual spacing here and there (such as between a and =F in the example below).

MWE:

\documentclass{article}
\usepackage{graphicx}
\newcommand{\mscale}[2]{\scalebox{#1}{$#2$}}

\begin{document}
$\mathrm{div}E=\scalebox{0.5}{$4\pi k$}\rho$

\vspace{1cm}
$\scalebox{4.0}{$a$}\ \scalebox{2.0}{$=F/$}\scalebox{0.7}{$m$}$

\vspace{1cm}
$\mathrm{div}E=\mscale{0.5}{4\pi k}\rho$

\vspace{1cm}
$\mscale{4}{a}\ \mscale{2}{=F/}\mscale{0.7}{m}$
\end{document}


Result:

I'm not really sure about the pedagogical usefulness of this idea. I'm pretty sure the output is as ugly as it can be. ;-)

\documentclass{article}
\usepackage{fourier}
\usepackage{amsmath}

\DeclareMathOperator{\Div}{div}

\newcommand{\ransom}[2]{\mbox{#1$#2$}}

\begin{document}

$\Div\mathrm{E}=\ransom{\tiny}{4\pi k}\rho$

$\ransom{\huge}{\mathrm{a}}=\mathrm{F}/\ransom{\tiny}{m}$

\end{document}