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.

1
  • 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, 2015 at 13:44

2 Answers 2

10

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}
4
  • Very much I thank you. :) That works perfectly well.
    – Yes
    Oct 20, 2015 at 13:43
  • @GudsonChou you're welcome :) Oct 20, 2015 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, 2015 at 13:46
  • 2
    @egreg Have you a way to avoid this using \newcommand? I don't have it :/ Oct 20, 2015 at 13:49
9

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

2
  • Thank you! What in your opinion is the most flexible command without sacrificing spacing? Thanks.
    – Yes
    Oct 20, 2015 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, 2015 at 14:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .