# \DeclaredPairedDelimiter vs \newcommand

When should I use \DeclarePairedDelimiter and when should I use \newcommand?

For example I have defined

%Ceiling function
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
%Floor function
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

Is this the best way to do it?

\DeclarePairedDelimiter is a very specific command in the mathtools package for opening and closing delimiters (e.g. parentheses, brackets, braces) where you want the option to automatically resize them.

For example, it allows you to replace \lfloor...\rfloor with \floor{...} and \left\lfloor...\right\rfloor with \floor*{...}.

Other common examples are:

\DeclarePairedDelimiter\paren{(}{)}           % (parentheses)
\DeclarePairedDelimiter\ang{\langle}{\rangle} % <angle brackets>
\DeclarePairedDelimiter\abs{\lvert}{\rvert}   % |absolute value|
\DeclarePairedDelimiter\norm{\lVert}{\rVert}  % ||norm||
\DeclarePairedDelimiter\bkt{[}{]}             % [brackets]
\DeclarePairedDelimiter\set{\{}{\}}           % {braces}

As in the other example, I get commands that have fixed size, or that scale with the expression. See the mathtools documentation for more information about this command.


You can also declare commands with arguments: for example, \newcommand{\dfr}[2]{d #1/d #2} defines a command for derivatives; then, I can call \dfr{f}{x} to get df/dx and \dfr{f}{y} to get df/dy. See the Wikibooks page on macros for more information.


Finally, for, "is this the best way to do it?" I would say that since you want to use the functionality that \DeclarePairedDelimiter offers, you may as well use it, so yes, you're doing it right.


• I hope you mean \newcommand{\term}{\textit}, as you use it like \term{word being defined}. – Henri Menke Dec 15 '15 at 9:49
• @HenriMenke and Mico: whoops, I ought to have known that. Thank you for your corrections; I have edited my post to fix it. – Arun Debray Dec 15 '15 at 18:18