I'm writing things like 2/3 or 1/4 in my text and I'd like to make them appear as they do automatically in a processor like Word where they are slightly smaller and have the diagonal separation if that makes sense, instead of being placed on top of each other like it would appear in math mode.

# [Tex/LaTex] Small in-text fractions

fractions

#### Related Solutions

Given the lack of answers other than the comments, here is a summary of the critiques which have come from the comments. By increasing the visibility of these comments, I'm hoping that I may get a solution to the portability problem noted so far, and provoke further critiquing of my macro generally.

**Technical/æsthetic obstacle:**

Brent.Longborough, with further elaboration by TH., noted that this macro is not necessarily very robust to a change in font, which may have different dimensions for*e.g.*its`ex`

-size relative to the size of the actual letters. It would seem that a different choice of parameters in the`\raisebox`

-es, and possibly the`\scalefont`

-s as well, may be necessary for each different font used.**Technical improvement:**

TH. suggested (if I understand correctly) that I should modify the macro using`\m@th`

(or equivalent): a little research indicates that this is probably to improve the horizontal spacing of the result. Thus, a minor improvement would be\makeatletter

\newcommand\sfrac[2]{% \dfrac{\text{\raisebox{-0.5ex}{\scalefont{0.85}{$\m@th#1$}}}}% {\text{\raisebox{0.35ex}{\scalefont{0.85}{$\m@th#2$}}}}% }

\makeatother

[**EDIT:** I am 'accepting' this answer for now, but if anyone comes along and provides useful insights, I will change the accepted answer.]

# Fractions

I'd just use the normal `\frac`

or `\tfrac`

. For display style maths they still look the best. I would use `\nicefrac`

(or similar) only (if at all) in text maths.

## Code

```
\documentclass{article}
\usepackage{amsmath}
\def\frstfrac{\frac{2}{\sqrt{2y+1}\sqrt{2 \pi}}} % just a shortcut
\begin{document}
\begin{align*}
&= \frstfrac \exp \left( -y - \frac{1}{2}\right) && \forall y \in \left[- \frac{1}{2}, \infty\right) \\
&= \frstfrac \cdot e^{ -y - \frac{1}{2}} && \forall y \in \left[-\tfrac{1}{2}, \infty\right) \\
&= \frstfrac \cdot e^{ - \left(y + \frac{1}{2}\right)} && \forall y \in \left[-\tfrac{1}{2}, \infty\right) \\
&= \frstfrac \cdot e^{\textstyle -\!\left(y + \frac{1}{2}\right)} && \forall y \in \left[-\tfrac{1}{2}, \infty\right) \\
&= \frstfrac \exp \left( -y - 1/2 \right) && \forall y \in \left[- 1/ 2 , \infty\right)
\end{align*}
\end{document}
```

## Output

`\smash`

Also, consider using `\sqrt{\smash[b]{2y+1}}\sqrt{\smash[b]{2 \pi}}`

in your denominator for better roots.

To quote from the `amsmath`

documentation:

With the amsmath package

`\smash`

has optional arguments`t`

and`b`

, because occasionally it is advantageous to be able to “smash” only the top or only the bottom of something while retaining the natural depth or height.

Compare:

## Code

```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\frac{2}{\sqrt{\smash[b]{2y+1}}\sqrt{\smash[b]{2 \pi}}} = \frac{2}{\sqrt{2y+1}\sqrt{2 \pi}}
\end{equation*}
\end{document}
```

## Output

The top bar of the root is aligned different and even the lower point is not on equal heights.

*LaTeX Companion*

The *LaTeX Companion* has a very elaborated text about `\smash`

and its uses. The first two examples (licensed under the LPPL) are shown here. Take a close look at the root's lower end and the top bar.

### Code

```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$ \sqrt{x} + \sqrt{y} + \sqrt{z} $ \par
$ \sqrt{x} + \sqrt{\mathstrut y} + \sqrt{z} $ \par
$ \sqrt{x} + \sqrt{\smash{y}} + \sqrt{z} $ \par
$ \sqrt{x} + \sqrt{\smash[b]{y}} + \sqrt{z} $
\[
\sqrt{ \frac{a+b}{ x_j } } \quad
\sqrt{ \frac{a+b}{ \smash{x_j }} } \quad
\sqrt{ \frac{a+b}{{}\smash{x_j }} } \quad
\sqrt{ \frac{a+b}{ \smash{x_j+b}} }
\]
\end{document}
```

### Output

## Best Answer

I suggest you load the

`xfrac`

package and write`$\sfrac{1}{2}$`

to achieve your formatting objective by hand.If you want to fully automate the process of typesetting all inline-math fractions with the

`\sfrac`

macro, the following, LuaLaTeX-based solution may be of interest to you.