[Tex/LaTex] Resizing dynamically the `e` of the exponential function

math-modemath-operators

I've been looking around and found that this question has been asked at least a couple of times, but the solutions are been correct work around.

Let's say that I have a formula with a piece like:

e^{\dfrac {h A_s}{\rho V c_{p}}t}

and for some dumb reason, I'd like to force the argument of the exponential to be shown as a \dfrac… worst!!! I refuse to use the \exp command to denote the exponential, say I just want to define a command \myexp which 'measure' the size of the exponential argument and resize the letter e according to the size of the argument.

Is that even possible? How could be done?

Thank you!

Best Answer

I should probably not be surprised to get negative points for this answer.

Here's something you could do, but I think it results in a very ugly output. Granted, this is a brute-force approach and could probably be a bit more prettified. But even then, I think, it would still be ugly.

\documentclass{article}
\usepackage{booktabs}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}

\newsavebox\myuglybox
\def\mye#1{%%
  \savebox{\myuglybox}{$#1$}%%
  \resizebox{!}{\ht\myuglybox}{$\mathrm{e}$}^{\usebox{\myuglybox}}}

\pagestyle{empty}
\begin{document}

\begin{tabular}{ccc}
  Scaled (Ick!)                                & Unscaled (Ick!)                              & Preferred \\\midrule
$\dfrac{1}{\sqrt{2\pi}}\mye{-\dfrac{1}{2}x^2}$ & $\dfrac{1}{\sqrt{2\pi}}e^{-\dfrac{1}{2}x^2}$ & $\dfrac{1}{\sqrt{2\pi}}\exp\left(-\dfrac{1}{2}x^2\right)$
\end{tabular}

\vspace{3ex}

Monster content

$\mye{\dfrac{1}{\sqrt{2\pi}}\mye{-\dfrac{1}{2}x^2}}$

\end{document}

enter image description here

If this is something that works for you, I'll leave the prettifying to you.