Floor and ceiling (⌊x⌋ ⌈x⌉) in LaTeX
The floor of x, ⌊x⌋, is the largest integer not above x, and the ceiling, ⌈x⌉, the smallest integer not below it; in LaTeX write \lfloor x \rfloor and \lceil x \rceil.
LaTeX command
\lfloor x \rfloorNot the symbol you meant? Draw it to find the command →
Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →
The four brackets are built into LaTeX and KaTeX, with no package: \lfloor and \rfloor for the floor, \lceil and \rceil for the ceiling. They are delimiters like ( and ), so the spacing around them is right and they can grow.
For a fraction or anything tall inside, put \left and \right in front: \left\lfloor \frac{n}{2} \right\rfloor. In running text the fixed sizes \bigl and \bigr often look better than a full stretch.
Rounding to the nearest integer is sometimes written by mixing the two, ⌊x⌉, with \lfloor x \rceil. If you write floors and ceilings often, the mathtools package can define \floor and \ceil commands that size themselves, as below.
\floor and \ceil commands (mathtools)
Declare the commands once in the preamble. \floor{x} prints ⌊x⌋, and the starred \floor*{\frac{n}{2}} grows with its contents.
\usepackage{mathtools}\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}Other forms
\lceil x \rceilceiling\left\lfloor \frac{n}{2} \right\rfloorbrackets that grow\lfloor x \rceilnearest integer (rounding)Examples
$\lfloor 3.7 \rfloor = 3$the floor of 3.7
$\lceil 3.2 \rceil = 4$the ceiling of 3.2
$\lfloor -2.5 \rfloor = -3$the floor of a negative number goes down
$\left\lfloor \frac{n}{2} \right\rfloor$brackets that grow around a fraction
$\lceil \log_2 n \rceil$a ceiling in an algorithm's step count
Tips and common mistakes
- Always pair the brackets:
\lfloorwith\rfloor,\lceilwith\rceil. - Use
\leftand\right, or\bigland\bigr, when a fraction sits inside. - No package is needed for the brackets; mathtools only adds the
\floorand\ceilshortcuts. - Do not draw floor brackets from [ and _: the result neither looks nor spaces like the real symbol.
- Remember the floor of a negative number goes down: ⌊-2.5⌋ is -3.
Working from handwritten notes?
LatexNotes turns a photo or PDF of handwritten mathematics into LaTeX, graphs and all. It is built with real pdflatex before you see it, and the .tex file is yours to edit or take to Overleaf. Free to try, no sign-up.
See how handwriting to LaTeX works, step by step, or go from GoodNotes to LaTeX if you write on an iPad (Notability works the same way).
Convert your maths to LaTeX →FAQ
How do I write the floor function in LaTeX?
Write \lfloor x \rfloor, which prints ⌊x⌋. No package is needed.
How do I write the ceiling function in LaTeX?
Write \lceil x \rceil, which prints ⌈x⌉.
How do I make floor brackets bigger?
Put \left and \right in front: \left\lfloor \frac{n}{2} \right\rfloor.
Is there a \floor command?
Not built in. Define one with mathtools: \DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}.