[Tex/LaTex] How to obtain even space between variables in math mode

amsmathequationsspacing

When I combine numbers and several variables in an equation, the spacing between the numbers and variables are not even. What is the correct way to display the equation? The red box highlight the "problem"!

\documentclass{article}
\usepackage{amsmath}    
\begin{document}

$G$, $P$, $Z$, $R$, $T$ are all some variables.

Default:
\begin{equation*}
    a = \frac{8GP}{ZRT}
\end{equation*}

Small space (\textbackslash!):
\begin{equation*}
    a = \frac{8G\!P}{Z\!RT}
\end{equation*}

Large space (\textbackslash,):
\begin{equation*}
    a = \frac{8\,GP}{ZR\,T}
\end{equation*}
\end{document}

images of code

Best Answer

TeX adds no space between letters and digits in this context however the font may (and does) specify inter-letter kerns, the spacing around and between letters in text and in math is a choice of the font designer and not generally settable within TeX other than manual spacing, as you show

If I modify your example to

\documentclass{article}
\usepackage{amsmath}    
\begin{document}
\showoutput

\begin{equation*}
    a = \frac{8GP}{ZRT}
\end{equation*}


\end{document}

I get

........\OT1/cmr/m/n/10 8
........\OML/cmm/m/it/10 G
........\OML/cmm/m/it/10 P
........\kern1.3889
........\glue 0.0 plus 1.0fil minus 1.0fil
.......\kern4.06508
.......\rule(0.39998+0.0)x*
.......\kern2.3262
.......\hbox(6.83331+0.0)x22.44447
........\OML/cmm/m/it/10 Z
........\kern0.71527
........\OML/cmm/m/it/10 R
........\kern0.07726
........\OML/cmm/m/it/10 T

which shows that there is no space added in the numerator, but the font specifies inter-letter kerns between Z and R and R and T.