1

Summary

I would like to have a efficient macro for parenthesis that I can use in all of my documents and macros.


The issues and my attempts

My first solution and its drawback

For parenthesis, I'm using the macro

\newcommand{\pth}[1]{\left(#1\right)}

But, in some cases, this macro induces extra horizontal space. For instance,

\newcommand{\numberOfCycles}[2]{\mathscr{N}_{#1}\left(#2\right)}

produces a extra space after the "N", as shown here enter image description here

My new solution and its drawback

That's why I change my macro \pth to \newPth defined by

\newcommand{\newPth}[1]{\mathopen{}\left(#1\right)\mathclose{}}

But, this macro seems to be not compatible with exponents. See this MWE:

\documentclass{article}

\newcommand{\pth}[1]{\left(#1\right)} \newcommand{\numberOfCycles}[2]{\mathrm{N}_{#1}\left(#2\right)} \newcommand{\newPth}[1]{\mathopen{}\left(#1\right)\mathclose{}}

\begin{document} [ \numberOfCycles{i}{\sigma} ]

[ \newPth{1 + \frac{1}{n}}^n ]

\end{document}

enter image description here

My questions

  • Generally, I would like to receive advice on theses issues.
  • Does someone has a solution that would cover these two cases?
Colas
  • 6,772
  • 4
  • 46
  • 96

2 Answers2

1

I suppose that your \pth macro is for special purposes, not for all accurrences of parentheses. You can try this:

\def\pth#1{\mathopen{}\mathord{\left(#1\right)}}
wipet
  • 74,238
1

Finally, I chose

\DeclarePairedDelimiter\myParentheses{\lparen}{\rparen}
\newcommand{\pth}[1]{\myParentheses*{#1}}

from the package math tools.

Colas
  • 6,772
  • 4
  • 46
  • 96