1

The package \nicefrac is a very useful tool for small fractions. In the documentation, it says that a font command optional argument can be given, but no example is provided. Specification:

\nicefrac[<fontcmd>]{<num>}{<denom>}

we only have a reference to fntguide.dvi. However, that guide is a bit cryptic.

Is it possible to have a few examples how fontcmd can be specified? Let's say I would want (a) a fraction using slightly bigger font; (b) a fraction using roman font numbers; (c) a fraction using bold numbers; (d) a fraction using something wild (to your appreciation ;-).

5
  • There are examples on page 3 of the documentation, e.g. \nicefrac[\texttt]{1}{2} or $\nicefrac[\mathcal]{A}{B}$
    – mbert
    Commented Jun 3, 2023 at 22:28
  • @mbert I saw those. I tried \nicefrac[\LARGE]{a}{b} but then alignments are wrong. I though with finer adjustments to the fontcmd, I would get properly aligned components. Commented Jun 3, 2023 at 23:25
  • Perhaps try {\LARGE\nicefrac{a}{b}}. However I think the result with xfrac looks better: {\LARGE\sfrac{a}{b}}
    – mbert
    Commented Jun 4, 2023 at 2:36
  • @mbert thanks for the suggestions. However, it does not show how to use the fontcmd specification more generally. Commented Jun 4, 2023 at 13:30
  • 1
    I think in general the optional argument should just be a formatting command that takes one argument (like \texttt or \mathcal) and does not change the size, since making a size change there won't change the size of the solidus. Hence the size change before \nicefrac
    – mbert
    Commented Jun 5, 2023 at 18:54

0

You must log in to answer this question.

Browse other questions tagged .