Ceiling and Floor Function in LaTeX


The floor and ceiling are common mathematical functions. In this post, we will learn how to typeset both in LaTeX!

1. Floor function in \(\LaTeX{}\)

The floor function \(f(x)\) takes a real number \(x\) as an input and returns the greatest integer less than or equal to \(x\).

A floor function is denoted floor(x) or ⌊x⌋. The latter corresponds to square brackets without upper horizontal bars.

In \(\LaTeX{}\), we use the commands \lfloor and \rfloor in math mode to get left and right symbols of the floor function. Check the following illustrative example:

% Floor function in LaTeX
\documentclass{article}


\begin{document}

In \LaTeX{}, the floor function can be typeset using the commands: \verb|\lfloor| and \verb|\rfloor|. Here is an example: floor($x$)=$\lfloor x \rfloor$     

\end{document}

Compiling this code yields:

Floor latex

For an extended size of floor symbol, we can add \left before \lfloor command and \right before \rfloor command. For more details about controlling the size of these brackets, I invite you to read this postOpens in a new tab.!

2. Ceiling function in \(\LaTeX{}\)

The ceiling function \(f(x)\) takes a real number \(x\) as an input and returns the least integer greater than or equal to \(x\). A ceiling function is denoted

A ceiling function is denoted ceil(x) or ⌈x⌉. The latter corresponds to square brackets without lower horizontal bars.

In \(\LaTeX{}\), we use the commands \lceil and \rceil in math mode to get left and right symbols of the ceiling function. Check the following illustrative example:

% Ceiling function in LaTeX
\documentclass{article}


\begin{document}

In \LaTeX{}, the ceiling function can be typeset using the commands: \verb|\lceil| and \verb|\rceil|. Here is an example: ceil($x$)=$\lceil x \rceil$     

\end{document}

This code produces:

For an extended size of ceiling symbol, we can add \left before \lfloor command and \right before \rfloor command. For more details about controlling the size of these brackets, I invite you to read this postOpens in a new tab.!

We reached the end of Today's tutorial, if you find it useful, please share it with your friends!

Recent Posts