Timeline for Can I redefine a command to contain itself?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 21, 2024 at 8:17 | comment | added | PaulProgrammerNoob | @egreg Thank you. :) I posted a new question here. | |
| Mar 20, 2024 at 21:21 | comment | added | egreg |
@PaulProgrammerNoob Yes, but using just \NewCommandCopy and similar commands is clumsy. You can make a new question. Leave a comment here when you do it.
|
|
| Mar 20, 2024 at 20:39 | comment | added | PaulProgrammerNoob |
I wonder if there is a way to abstract this pattern with NewCommandCopy to a new command. Imagine I would like to redefine a couple of commands and not just one (e.g., to add a new textcolor to them or make them italic). Could we make a macro \colorize{\llbracket}{blue} that redefines \llbracket to be wrapped in \textcolor but so we do not have to spell out the two lines again and again? I tried something like \expandafter\NewCommandCopy\csname old#1\endcsname{\csname #1\endcsname} to generate the name for the old macro but it didn't work.
|
|
| Nov 24, 2023 at 9:01 | comment | added | egreg |
@zgc \let\oribfseries\bfseries\DeclareRobustCommand\bfseries{\oribfseries\itshape}
|
|
| Nov 24, 2023 at 8:54 | comment | added | An5Drama | Although you say "it's not very difficult to imagine situations where this can lead to infinite loops", it is a bit difficult to think of one MWE to make the infinite loop. Could you please offer one with some comments about how the loop is caused? Thanks in advance. | |
| Mar 23, 2021 at 15:01 | history | edited | egreg | CC BY-SA 4.0 |
Update with \NewCommandCopy
|
| Sep 19, 2012 at 17:05 | history | edited | egreg | CC BY-SA 3.0 |
Fixed mistake
|
| Mar 9, 2012 at 14:01 | history | edited | egreg | CC BY-SA 3.0 |
Missing brace
|
| Mar 9, 2012 at 10:18 | history | answered | egreg | CC BY-SA 3.0 |