Posted By

deepsoul on 08/07/09


Tagged

show command macro internal def


Versions (?)

Show / redefine internal LaTeX macros


 / Published in: LaTeX
 

URL: http://www.volkerschatz.com/tex/show.html

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.

  1. \scrollmode
  2.  
  3. \obeyspaces
  4.  
  5. \def\shown#1{\expandafter\show\csname\string#1\endcsname}
  6. \def\showthen#1{\expandafter\showthe\csname\string#1\endcsname}
  7. \def\don#1{\csname\string#1\endcsname}
  8. \def\defn#1{\expandafter\def\csname\string#1\endcsname}
  9.  
  10. % example usage:
  11.  
  12. % show listing of \x@protect
  13. \shown{@startsection}
  14.  
  15. % show the value of the skip \@tempskipa
  16. \showthen{@tempskipa}
  17.  
  18. % execute control sequence "\\ "
  19. \don{\ }
  20.  
  21. % redefine \@startsection (works like \def)
  22. \defn{@startsection}{\relax}
  23.  
  24. % use at your own risk. user forfeits all rights to data integrity, mental health, world order, cookies.

Report this snippet  

You need to login to post a comment.