Floor (⌊x⌋) and Ceiling (⌈x⌉) function in LaTeX

In this tutorial, you will learn how to get the responsive Floor and Ceiling function (brackets) in LaTeX.

Floor function (brackets) in LaTeX

In Mathematics the Floor function is used to rounds number to lower integer. To print this symbol in LaTeX you can use $ \lfloor x \rfloor $ command, and to get responsive Floor brackets you have to use the $ \left\lfloor x \right\rfloor $ command.

\documentclass{article}
\begin{document}

  $$ \lfloor x \rfloor $$
  
  $$ \lfloor \frac{1}{x} \rfloor $$
  
  $$ \left\lfloor \frac{1}{x} \right\rfloor $$

\end{document}

Output:

floor brackets.

Ceiling function (brackets) in LaTeX

In Mathematics, the Ceiling function is used to rounds number to upper integer. To print this symbol in LaTeX you can use the $ \lceil x \rceil $ command and for responsive ceiling brackets use $ \lceil \frac{1}{x} \rceil $ command.

\documentclass{article}
\begin{document}

  $$ \lceil x \rceil $$
  
  $$ \lceil \frac{1}{x} \rceil $$
  
  $$ \left\lceil \frac{1}{x} \right\rceil $$

\end{document}

Output:

ceiling brackets.

Create custom command for Floor and ceiling function

You can also create a custom command for the Floor and ceiling function with \newcommand to condense the process. Take a look.

\documentclass{article}
\newcommand{\floor}[1]{\left\lfloor {#1} \right\rfloor}
\newcommand{\ceil}[1]{\left\lceil {#1} \right\rceil}
\begin{document}

  $$ \floor{x} \quad \ceil{x} $$
  
  $$ \floor{\frac{1}{x}} \quad \ceil{\frac{1}{x}} $$

\end{document}

Output:

floor and ceilinf bracketes.

Leave a Reply

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