We use a number as a quotient that includes a numerator and denominator in arithmetic. Fraction is originally a Latin word, and the word’s meaning is to divide. Fraction plays an essential role in the equations that represent the divisible relation between two numbers.
Therefore, the document processors like LaTeX also provide an easy way to write fractions. However, most users have no idea how to denote the fractions through source codes. This tutorial illustrates how to write a fraction in LaTeX.
How to Write a Fraction in LaTeX
Let’s start with the basic source code that you can use to write a fraction expression in LaTeX:
\usepackage[utf8]{inputenc}
\begin{document}
$\frac{Num}{Den}$
\end{document}
Output:
Similarly, you can write a huge number of fractional expressions through the \frac source. Here is another example:
\usepackage[utf8]{inputenc}
\begin{document}
$\frac{f(x+h)-f(x)}{(x+h)-x}$ = $\frac{f(x+h)-f(x)}{h}$
\end{document}
Output:
You can also add the fractions in the sentence, but make sure to use them correctly as we did in the following source code:
\usepackage[utf8]{inputenc}
\begin{document}
In arithmetic, we use a number as a quotient that includes a numerator and denominator. In LaTeX, 5/2 is represented as $\frac{5}{2}$.
Output:
Conclusion
This is a brief information on the easy source code to write a fraction in LaTeX. We used the different examples to help you understand everything about fractions in LaTeX. Make sure you use the source codes correctly. Otherwise, you may get some errors while compiling the document in LaTeX.