Redefining Commands Using DeclareRobustCommand

I am trying to create the following commands. I want to replace \exp by a command that takes an input and outputs \exp(#1). Trying to copy something that I was shown before, I tried the following

\let\EXP\relax
\DeclareRobustCommand{\EXP}{\exp}
\rewnewcommand{\exp}[1]{\EXP(#1)}

However, upon compiling, I get a TeX capacity exceeded, sorry error. If I don't redefine exp, but call it something like expm, then there are no issues. I'd prefer to redefine it though. How can I get around this?

• This cannot work: TeX will chase its tail trying to substitute \exp with \exp. – egreg Oct 26 '17 at 14:38
• What should \EXP(1) give you? – Manuel Oct 26 '17 at 14:40
• Yes, so I have discovered. How can I get around this? I don't know the code for the \exp function (I know it has automatic spacing, but I don't know what) – Sam T Oct 26 '17 at 14:40
• @Manuel \EXP(1) is (/should be) just the same as what \exp(1) would normally do – Sam T Oct 26 '17 at 14:41
• \DeclareRobustCommand{\EXP}[1]{\exp(#1)} – Manuel Oct 26 '17 at 14:41

You shouldn't do this: I see no advantage in typing \exp{3} over \exp(3), unless you want to do something more, that is, adding the possibility of sizing the parentheses.

This can be done with mathtools.

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter{\paren}{(}{)}
\let\originalexp\exp

\renewcommand\exp{\originalexp\paren}

\begin{document}

\begin{equation*}
\end{equation*}

\end{document}

However, I'd avoid this and rather define \expp:

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter{\paren}{(}{)}
\newcommand\expp{\exp\paren}

\begin{document}

\begin{equation*}