How To Write Ceil And Floor In Latex?


Answer :

Using \DeclarePairedDelimiter from mathtools, you could define macros \ceil and \floor, which will scale the delimiters properly (if starred):

\documentclass{minimal}\usepackage{mathtools}\DeclarePairedDelimiter\ceil{\lceil}{\rceil}\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}\begin{document}  \begin{equation*}    \floor*{\frac{x}{2}} < \frac{x}{2} < \ceil*{\frac{x}{2}}  \end{equation*}\end{document}

Result:

Scaling delimiters with <code>\floor</code> and <code>\ceil</code>


  1. You can define your own macro via the \def command anywhere inyour document. For example

    \def\lc{\left\lceil}   \def\rc{\right\rceil}

    and then just write \lc x \rc.

  2. Or you use the \providecommand in the preamble, e.g.

    \providecommand{\myceil}[1]{\left \lceil #1 \right \rceil }

    to simply use \myceil{x} in your document.

  3. Use an editor, like vim, that allows for defining shortcuts forquick and efficient editing.
  4. And, finally, don't forget about readability of your tex document. Check out thisthreadfor some instructive comments on how to write efficient and readabletex math docs.

This will also work fine without using mathtools.

\newcommand{\floor}[1]{\lfloor #1 \rfloor}

Belum ada Komentar untuk "How To Write Ceil And Floor In Latex?"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel