My old way of redefining a command no longer works.

Steve Litt slitt at troubleshooters.com
Thu May 4 08:10:39 CEST 2023


Steve Litt said on Thu, 4 May 2023 02:00:51 -0400

>Hi all,
>
>For years when wanting to redefine \whatever, I've done:
>
>\let\oldwhatever = \whatever
>\def\whatever{\whatever\newstuff}

Ooops, I meant \def\whatever{\oldwhatever\newstuff}

>
>But now the following doesn't work:
>
>=====================================
>\let\oldbeginsection=\beginsection
>\def\beginsection{\oldbeginsection}
>\bye
>=====================================
>
>The preceding code yields the following error:
>
>#####################################
>[slitt at mydesk plaintex]$ ./jj
>rm: cannot remove 'junk.pdf': No such file or directory
>This is LuaTeX, Version 1.17.0 (TeX Live 2023) 
> restricted system commands enabled.
>(./junk.tex
>Runaway definition?
>->  
>! Forbidden control sequence found while scanning definition of
>\beginsection. <inserted text> 
>}
><to be read again> 
>\oldbeginsection 
>l.2 \def\beginsection{\oldbeginsection
>                                    }
>? 
>#####################################
>
>Anyone know why the preceding code yields the preceding error?
>
>Thanks,
>
>SteveT
>
>Steve Litt 
>Autumn 2022 featured book: Thriving in Tough Times
>http://www.troubleshooters.com/bookstore/thrive.htm


SteveT

Steve Litt 
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm


More information about the texhax mailing list.