## Posted By

deepsoul on 08/07/09

# Show / redefine internal LaTeX macros

/ Published in: LaTeX

These four LaTeX control sequences are workalikes of the built-ins \show, \showthe and \def and of a command sequence call. Unlike the usual variants, they work on internal macros which contain characters with the "wrong" category code, such as "@". They take the name of the command sequence (without the leading "\") as their argument.

The \scrollmode is not necessary, it just saves you pressing Return for every listing output. The \obeyspaces is needed only if you want to display or manipulate control sequences whose names contain spaces.

Gratuitous use of \don and/or \defn will probably break LaTeX.

\scrollmode \obeyspaces \def\shown#1{\expandafter\show\csname\string#1\endcsname}\def\showthen#1{\expandafter\showthe\csname\string#1\endcsname}\def\don#1{\csname\string#1\endcsname}\def\defn#1{\expandafter\def\csname\string#1\endcsname} % example usage: % show listing of \[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */\shown{@startsection} % show the value of the skip \@tempskipa\showthen{@tempskipa} % execute control sequence "\\ "\don{\ } % redefine \@startsection (works like \def)\defn{@startsection}{\relax} % use at your own risk.  user forfeits all rights to data integrity, mental health, world order, cookies.