[Tex/LaTex] ny way to set up \ceil and \floor macros without installing the mathtools package


I can not install the mathtools package. Is there any way to create the \ceil and \floor macros without this package?

Best Answer

You don't need to load any packages to access the four macros \lfloor, \lceil, \rfloor, and \rceil. It is straightforward to use these macros to create two new macros called, say, \floor and \ceil:


Then, write something such as $\floor{x}$ and $\ceil{y}$ in the body of the document.

Addendum to address @Teepeemm's follow-up comment: To create the option to resize the heights of the symbols produced by \floor and \ceil, I suggest using the \DeclarePairedDelimiter macro of the mathtools package.

enter image description here

$\floor{x}$, $\ceil{y}$, $\floor*{\frac12}$, $\ceil*{\frac12}$