37

What solution do you think is more elegant for a simple fraction that should be displayed in just one line?

My examples are

  1. $x_F \equiv \frac{p_z}{p^{\rm MAX}_{z}} = \frac{p_z}{\sqrt{s}/2}$
  2. $x_F \equiv \frac{p_z}{p^{\rm MAX}_{z}} = \frac{p_z}{\sfrac{\sqrt{s}}{2}}$
  3. $x_F \equiv \frac{p_z}{p^{\rm MAX}_{z}} = \frac{p_z}{^\sqrt{s}/_2}$

This generates the following (using the xfrac package).

enter image description here

I don't like 2, but I also think that 3 is not very elegant.

2
  • How is \sfrac defined? Do you enable this command by loading a package?
    – Mico
    Aug 16, 2013 at 12:43
  • Sorry @Mico I should have put the package link
    – leoredi
    Aug 16, 2013 at 15:01

2 Answers 2

55

It is nearly always best to use the slashed form for fractions in the text:

Sample output

\documentclass{article}

\begin{document}
\( x_F \equiv p_z^{}/p^{\mathrm{MAX}}_z = p_z/(\sqrt{s}/2) = 2p_z/\sqrt s \)
\end{document}

Note that I have added brackets to the second fraction.

2
  • For some reason, the slash does not display as large as it shows in this solution (it doesn't have the same size as the surrounding elements). Have no idea why...
    – capadocia
    May 11, 2021 at 10:31
  • 1
    @capadocia Hard to tell. Compiling the displayed document under pdflatex or lualatex on my computer gives the shown output. If you have loaded other packages, then the output is can be different as they may change the fonts. It might be relevant to ask a new question, showing the set-up you are using. May 11, 2021 at 14:26
50

There is also nicefrac package which provides \nicefrac{<Nr>}{<Dr>}:

\documentclass{article}
\usepackage{nicefrac}

\begin{document}
\( x_F \equiv \nicefrac{p_z}{p^{\mathrm{MAX}}_z} = \nicefrac{p_z}{(\nicefrac{\sqrt{s}}{2})} = \nicefrac{2p_z}{\sqrt s} \)

\vspace{.5cm}        %% Andrew's method for comparison purpose.
\( x_F \equiv p_z^{}/p^{\mathrm{MAX}}_z = p_z/(\sqrt{s}/2) = 2p_z/\sqrt s \)
\end{document}

enter image description here

1
  • 8
    I think, the slashed form looks better. In particular, it does not require to reduce the font size.
    – Konstantin
    May 2, 2016 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.