Factorial (!) symbol and factorial spacing in LaTeX

In this tutorial, you will learn how to use the factorial symbol perfectly in a LaTeX document.

To print the factorial symbol in LaTeX generally, we use the keyboard ! key. With this, you can easily print the factorial symbol.

\documentclass{article}
\begin{document}

$$ \frac{(n+1)!}{n!} $$

\end{document}

Output:

factorial.

Factorial symbol with cmll package

Also, you can use the cmll package. This package provides a \oc command to get the factorial symbol. But with this command, you will get a little bit of math-mode spacing. Take a look.

\documentclass{article}
\usepackage{cmll}
\begin{document}

$$ a=\oc b \quad VS \quad a=!b$$

\end{document}

Output:

factorial.

Manage space in factorial

First of all, look at this image:

factorial side by side.
You can see in the above image, that there is no space between n! and d!. That’s why it doesn’t look good. So you have to add a little bit of space manually with \, or \;.

\documentclass{article}
\begin{document}

$$ \hat{d}=\frac{(d+n)!}{n!d!} $$
$$ \hat{d}=\frac{(d+n)!}{n!\,d!} $$
$$ \hat{d}=\frac{(d+n)!}{n!\;d!} $$
$$ \hat{d}=\frac{(d+n)!}{n!\:d!} $$

\end{document}

Output:

factorial side by side.

Leave a Reply

Your email address will not be published. Required fields are marked *