6
\documentclass{amsart}
\DeclarePairedDelimiter{\pr}{\left(}{\right)}

\begin{document}
$\pr{x,y}$

\end{document}

I found the commands \left( \right) quite flexible and hence useful; but I am not sure how to write them in one command. The attempt shown above has proved wrong.

  • Use \pr*{x,y} if you want \left and \right, after properly defining \DeclarePairedDelimiter{\pr}{(}{)}. Of course you don't need \left and \right in this case. And there are several reasons for not generally using them: use them only when they are really necessary, which means quite rarely. – egreg Oct 20 '15 at 13:44
11

You can use \newcommand to define new command and fit with what you want:

\documentclass{amsart}
\newcommand{\pr}[1]{\left(#1\right)}

\begin{document}
\pr{x,y}

\end{document}
  • Very much I thank you. :) That works perfectly well. – Megadeth Oct 20 '15 at 13:43
  • @GudsonChou you're welcome :) – Romain Picot Oct 20 '15 at 13:44
  • 1
    @GudsonChou It doesn't work perfectly; look at the spacing when you use \pr{x,y} in context. – egreg Oct 20 '15 at 13:46
  • 2
    @egreg Have you a way to avoid this using \newcommand? I don't have it :/ – Romain Picot Oct 20 '15 at 13:49
10

Contrary to your opinion, \left and \right are quite rigid and unflexible: they don't provide the right size in many cases. The usual example is a summation, where

\[
\left( \sum_{k=1}^{n} x_{k} \right)
\]

produces too large delimiters. The right size in this case is obtained with

\[
\biggl(\, \sum_{k=1}^{n} x_{k} \biggr)
\]

Here's a visual comparison: left the \left-\right version; note the \, for avoiding the clash, which should also be used after \left( anyway.

enter image description here

This said, you're free not to follow the advice. In this case, define properly \pr and use the *-variant

\documentclass{amsart}
\usepackage{mathtools}

\DeclarePairedDelimiter{\pr}{(}{)}

\begin{document}
$\pr*{x,y}$

\end{document}

Of course in this case the parentheses don't grow, so there's no point in using \pr* instead of \pr. Here's the output of $\pr*{x,y}\quad\pr{x,y}$:

enter image description here

  • Thank you! What in your opinion is the most flexible command without sacrificing spacing? Thanks. – Megadeth Oct 20 '15 at 13:58
  • @GudsonChou Using \pr as defined is good; just don't use the * when it's not necessary. You also have \pr[\big] for slightly bigger parentheses, for instance. – egreg Oct 20 '15 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.