4

I like to change a/b to be

a
- 
b

how to do that?

3
  • yes,I only can use / now.
    – sam
    Jun 18, 2011 at 13:34
  • 5
    See my answer below. But really, since you ask this very elementary question, I guess you do not have access to any form of documentation? You need to remedy that. LaTeX is too complex to use without documentation. Jun 18, 2011 at 13:36
  • Or have a look at this one: en.wikibooks.org/wiki/LaTeX Jun 18, 2011 at 13:42

2 Answers 2

12

\frac{a}{b}, in math mode of course.

6

For fractions use $\frac{a}{b}$, like Harald Hanche-Olsen said. For inline-math I still like fractions that use / because a \frac is often too tall. Here is a definition for a nicer fraction that uses /:

\def\nicefrac#1#2{\leavevmode%
    \raise.5ex\hbox{\small #1}%
    \kern-.1em/\kern-.15em%
    \lower.25ex\hbox{\small #2}}

It is used like this:

\nicefrac{a}{b}
6
  • The nicefrac package, or the units package, also offer a \nicefrac command. Jun 18, 2011 at 13:46
  • 5
    The xfrac package seems to be the better choice. Jun 18, 2011 at 13:51
  • Is this kind of command can be used on MathJaX? Because I can't try success on Statistical Analysis board.
    – sam
    Jun 18, 2011 at 13:52
  • You can also use $\dfrac{a}{b}$ if you want a larger fraction in inline math mode. Jun 18, 2011 at 14:51
  • 1
    @Peter: using \dfrac in inline math is not very good because it changes the space between lines and by default LaTeX uses smaller fractions in inline math just to avoid this.
    – Spike
    Jun 18, 2011 at 15:16

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.