Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the course of attempting to out-pedant another mathematician, I wanted to \show the catcode of $ to convince myself that it was a "special" character in ordinary TeX as well as LaTeX. I was just using a "dumb tex" session (that is, I invoked tex from the commandline with no file) so what I wanted was to be able to type:

\showcatcode$

but that didn't work. In the end, I did

\count255=\catcode`$
\showthe\count255

but that just doesn't smell right. What's the best way to \show the catcode of a token?

(To be clear, the result of a \showcatcode should go to the terminal and the log, not in the document itself.)

share|improve this question
2  
I believe that \showthe works for any internal integer, even strange ones like \parshape. –  TH. Jun 9 '11 at 12:19
add comment

1 Answer

up vote 14 down vote accepted

Well, it's not complicated:

\showthe\catcode`$
share|improve this answer
1  
Now that is bizarre. I tried that and it gave me nonsense. Yet now when I try it again, it works. Did you invoke M-x quantum-butterfly again? (I suspect that my earlier experiments messed things up so that the above didn't work, but not being used to working with tex on the commandline, I didn't spot it.) –  Andrew Stacey Jun 9 '11 at 10:53
    
I don't know what you met. (And I'm not an Emacser.) It does work for me, plain TeX and LaTeX. –  Leo Liu Jun 9 '11 at 11:52
2  
Otherwise a simple \show $ will indicate that it is the math shift $, whereas \show * (say) gives the character *. –  Bruno Le Floch Jun 9 '11 at 13:25
    
xkcd.com/378 –  Caramdir Jun 9 '11 at 15:10
    
@Caramdir: Yep, I remember that I've seen it. And as a vimer, I hate emacs :) –  Leo Liu Jun 9 '11 at 15:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.