I would like to make a deep copy of macro that I don't have control of, because various packages might change it. So I want to take the current meaning of the macro, patching it, but without changing the original macro. Something along the lines of
\deepcopy\mylabel\label \patchcmd{\mylabel}{\thepage}{\thepage+1}{}{} How can I achieve that?
\let\mylabel\label; however,\LetLtxMacrofrom theletltxmacropackage and\xpatchcmdfromxpatchare required if the macro to copy and patch can have optional arguments or has been defined with\DeclareRobustCommand.\let\deepcopy=\let;) However,\letis "exactly one layer deep".\letus close it as a duplicate of What is the difference between \let and \def? or What is the difference between \let and \edef? More information onletltxmacrocan be found in When to use \LetLtxMacro?\letit is difficult to search for it. Having a duplicate asked in a different way may help more people get to the solution, so best to not delete it.