tags:

views:

1310

answers:

2

Is it possible to force latex to use the slash notation for a fraction (i.e., separating the numerator and denominator with a slash instead of stacking them on top of one another)? Just using a slash (/) instead of \frac looks bad because the slash does not size itself properly.

+1  A: 

Try the nicefrac package

Rob Hyndman
Thanks for the reply... this is close to what I want, but shrinks large symbols unnecessarily (everything becomes small enough so that the slash looks reasonable). Occasionally \frac uses the slash even in display mode, and when it does, large symbols stay the same but the slash grows to accommodate them. Is there a way to force it to always use the slash for a given fraction?
Dan
+2  A: 

Here is a command that might work for you:

\newcommand{\slfrac}[2]{\left.#1\right/#2}

It sizes the slash based on the size of the numerator. So it won't work with a small numerator and a big denominator, but you could do something analogous in that case.

Rob Hyndman
Thanks! This works nicely!
Dan
To get it to work with a denominator (or numerator), you could use the following:`\newcommand{\slfrac}[2]{\left.#1\middle/#2\right.}`
godbyk
Thanks godbyk. I didn't know there was a \middle command. Your solution is much better.
Rob Hyndman