[Tex/LaTex] ‘Floor’ and ‘ceiling’ functions

symbols

Is there a convenient way to typeset the floor or ceiling of a number, without needing to separately code the left and right parts? For example, is there some way to do $\ceil{x}$ instead of $\lceil x \rceil$?

Best Answer

\usepackage{mathtools}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}

The command \ceil will do; if called as \ceil*{x} it will add \left and \right; you can also call it as

\ceil[\big]{x} \ceil[\Big]{x} \ceil[\bigg]{x} \ceil[\Bigg]{x}

to state explicitly the size of the delimiters.