latex3 / xfrac

Split level fractions
LaTeX Project Public License v1.3c
1 stars 0 forks source link

xfrac: make \sfrac (optionally) produce a \mathinner atom #4

Open schtandard opened 4 years ago

schtandard commented 4 years ago

I often find that \sfrac fractions need to be separated from adjacent terms by additional space in math expressions. image Many times, treating the fraction as a \mathinner atom produces pleasing results. image 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}
Hoegholm commented 4 years ago

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.

schtandard commented 4 years ago

and would also squarely put in the same category as if using \frac.

Surprisingly, \frac does not create inner atoms (cf. [1], [2]). This shouldn't discourage this change, though, I think.