Fraction in LaTeX (\frac{a}{b})

ab\frac{a}{b}
LaTeX command
\frac{a}{b}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Typesets a built-up fraction with numerator a over denominator b, separated by a horizontal rule.

\frac takes two arguments, the numerator and the denominator, so \frac{a}{b} is just a placeholder for any ratio such as \frac{dy}{dx} or \frac{n(n+1)}{2}. In inline math it shrinks to text size, which can be cramped; \dfrac forces display size and \tfrac forces text size. For simple inline ratios a slash, a/b, often reads better than a stacked fraction. Binomial coefficients use \binom{n}{k}, not \frac with no rule. Continued fractions look cleaner with \cfrac, which keeps every level at full size. When a fraction sits inside parentheses, use \left( and \right) so the brackets grow to match its height.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

ddx(1x)=−1x2\frac{d}{dx}\left(\frac{1}{x}\right) = -\frac{1}{x^2}
\documentclass{article}
\begin{document}
Fraction: $\frac{a}{b}$

\[ \frac{d}{dx}\left(\frac{1}{x}\right) = -\frac{1}{x^2} \]
\end{document}

Related symbols

All 수학 기호 →

Frequently asked questions

How do I write Fraction in LaTeX?
Type \frac{a}{b} in math mode, for example $\frac{d}{dx}\left(\frac{1}{x}\right) = -\frac{1}{x^2}$. It works in plain LaTeX without loading any package.
Which package do I need for \frac{a}{b}?
None. \frac{a}{b} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \frac{a}{b} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\frac{a}{b}$ in running text.
Math poweredAI로 LaTeX 작성

최고의 AI LaTeX 편집기, Overleaf 대안

Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움

  • AI로 아름다운 TikZ 다이어그램 생성
  • 이미지를 업로드하고 LaTeX로 원활하게 변환
  • 논문 작성 및 서식에 대한 즉각적인 지원 받기