latex3
latex3 copied to clipboard
xfrac: make \sfrac (optionally) produce a \mathinner atom
I often find that \sfrac fractions need to be separated from adjacent terms by additional space in math expressions.
Many times, treating the fraction as a \mathinner atom produces pleasing results.
I would like \sfrac to create a \mathinner atom by default when used in math mode.
Currently the only option is to write a wrapper macro that inserts the \mathinner command when in math mode, but that seems a bit clumsy and redundant, since \sfrac checks for math mode anyways. (One could also modify \sfrac, of course, but that should not be encouraged.) A package option that facilitates this would be really nice.
MWE used to produce the examples above:
\documentclass{article}
\usepackage{xfrac}
\begin{document}
\(\sfrac{2}{3} b\)
\(\sfrac{a}{2} (b + c)\)
\vskip 2ex
\(\mathinner{\sfrac{2}{3}} b\)
\(\mathinner{\sfrac{a}{2}} (b + c)\)
\end{document}
The main use cases were always text mode, hence this wasn't thought about much back then. I agree, making it an Inner atom would probably often lead to a more visually pleasing output and would also squarely put in the same category as if using \frac.