1

I want to overwrite the commands listed in the title with

    \renewcommand{\(}{\left(}
    ...
    \renewcommand{\]}{\right]}

I already tried it in Overleaf and when I click 'compile' it compiles without errors.

However in the editor I get lines highlited in red with error messages, for example using \( I got this: error message

Is there a way to hide these errors without defining a command with a different name?

Edit:

When I wrote this question I specified

without defining a command with a different name

I didn't want to have the 'open round/square/... bracket' and 'close ... bracket' commands, because I found it to be a very ugly solution, and also difficult to read, even if shortened with aa a character. Only after posting here I realized I could write a single 'brackets' command with the formula that should be enclosed by the brackets as a parameter, so that in LaTeX I still see the brackets where they should be, but they are curly instead of round or square.

So basically what I did was adding these commands:

\newcommand{\p}[1]{\left( #1 \right)}
\newcommand{\pp}[1]{\left[ #1 \right]}
\newcommand{\ppp}[1]{\left\{ #1 \right\}}

I found this solution to be the most readable and efficient one.

Edit 2:

The best solution was given by Gaussler in the comments:

\usepackage{mathtools}

\DeclarePairedDelimiter{\p}{(}{)} \DeclarePairedDelimiter{\pp}{[}{]} \DeclarePairedDelimiter{\ppp}{{}{}}

which gives the option to manually specify the desired dimension for the brackets (e.g. \p[\bigg]{...}), or make it automatic with an asterisk (\pp*{...}). And makes it also nicer with better spacing.

1 Answers1

8

Don’t. Just don’t. Seriously...

Gaussler
  • 12,801
  • 3
    And yes, I know this doesn’t follow the guidelines for answers and will probably be removed, but... just don’t. – Gaussler Oct 19 '22 at 17:49
  • 2
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – José Carlos Santos Oct 19 '22 at 19:19
  • 3
    A corollary to your answer: "Only do this if you absolutely want to break lots and lots of things -- and love debugging a slew of guaranteed unintelligible error messages." – Mico Oct 19 '22 at 19:40
  • 3
    @Mico Sometimes, you’re just in that mood, and better to break TeX than the vases around your house. – Gaussler Oct 19 '22 at 19:42
  • 2
    @JoséCarlosSantos it's clearly a frame challenge, and not an ill-advised one at that. – A. R. Oct 19 '22 at 20:53
  • @AndrewRay: It would be a better frame challenge if it explained itself a bit, eg by incorporating Mico’s comment. Slightly less funny for the experts, but much more useful for the OP and anyone else who comes to this question because they’re genuinely tempted to try this. – Peter LeFanu Lumsdaine Oct 23 '22 at 15:20