0

Just wondering if there is a way to replace the brackets - '(' and ')' within equations with '\left(' and '\right)' but not replace the brackets within general text.

For example, in the body of a latex document

This is normal text (these brackets should not be replaced).
On the other hand, this equation - $(\dfrac{x}{2})$ should have it's brackets replaced, such that it outputs $\left(\dfrac{x}{2}\right)$

I'm assuming I would have to use the \renewcommand to handle the bracket replacement. But not sure how (and if it's possible) to do this bracket replacement conditionally (to only occur within equations)

  • 1
    Welcome to TeX StackExchange! Because parentheses are characters and not commands, you can't really use \renewcommand to redefine them. Would any of these solutions be an acceptable alternative for your needs? Automatic left and right commands – gz839918 Sep 14 '23 at 02:43
  • There’s no reason whatsoever for using \left and \right next to each use of parentheses or brackets. Rather, there are good reasons for not doing it. – egreg Sep 14 '23 at 07:28
  • The reason for using the \left and \right is to help enlarge the brackets so that they don't look awkwardly small, when housing a \dfrac{}{} – Joshua Then Sep 14 '23 at 07:47
  • I'm just trying to find a quick solution (that doesn't require other functions such as br{}) as I have quite a few documents that I need this implemented for, that already have brackets in place! - and don't have time to change them all – Joshua Then Sep 14 '23 at 07:48

0 Answers0