TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like put picture into table, and my idea is define new command as below>

  • \newcommand{\EJ471}{\includegraphics[scale=0.150]{EJ_471.jpg}}

But compiler reports an error. If I use the command name for example \EJa, everything is all right. I've read similar questions as

But still I don't understand why it does not work.

share|improve this question
What don't you understand? In my opinion the FAQ is really clear: tex.ac.uk/cgi-bin/texfaq2html?label=linmacnames – Marco Daniel Aug 10 '12 at 15:28
@Jafan It's not normal here to include 'thanks' or similar: voting is the best way to indicate that something is helpful. – Joseph Wright Aug 10 '12 at 16:53
up vote 23 down vote accepted

A long time ago in a galaxy far, far away....

someone wrote this:


share|improve this answer
You are impressive! – Marco Daniel Aug 10 '12 at 19:12
Having found that via google (it was removed from ctan in 1996:-) I have put a copy here code.google.com/p/dpctex/source/browse/#svn%2Ftrunk%2Fnumdef – David Carlisle Aug 10 '12 at 20:37
The link appears broken... – barto Jan 9 '15 at 21:15
@barto it seems Ok from here? – David Carlisle Jan 9 '15 at 21:38
The link in your comment does work, but the one in your answer gives a 'URL not found' notification. – barto Jan 9 '15 at 21:41

By the rules of TeX syntax, the "name" of a macro that starts with a \ (backslash) character must either

  • consist of a single non-alphabetical character. Some examples: \, (insert thin space), \% ( the % character), \\ (insert line break), \[ (open display math), and \) (close inline math).


  • contain only uppercase and lowercase alphabetical characters: a-z and A-Z. No numerals, and no other characters belonging to non-letter categories either. (Well, there are certain ways of assigning "letter-category" status to non-letter characters, but that's a topic for a different discussion.)

Therefore, \EJ471 is not a valid macro name.

However, you could define a somewhat more general macro:


and use it as in \EJ{471} to pass EJ_471.jpg to the \includegraphics command. If you needed to process further jpg files that start with EJ_ (and end in .jpg, of course), you could simply keep invoking this macro with the appropriate arguments.

share|improve this answer
Well, there are certain ways of assigning "letter-category" status to non-letter characters, but that's a topic for a different discussion. -- I think this is the correct place ;-). The catcodes are the reasons for this. – Marco Daniel Aug 10 '12 at 17:24
@MarcoDaniel - I have a feeling that the OP isn't all that interested in learning about catcodes just so that he/she can make \EJ471 into a valid TeX macro name after all. However, I may be wrong. :-) Please feel free to provide a separate, longer answer. – Mico Aug 10 '12 at 17:40
@MarcoDaniel As Mico says, the question here seems to be focussed on one part of the story. Catcodes are 'advanced', and moreover we've already got questions about them. – Joseph Wright Aug 10 '12 at 18:14

You can use \usepackage{numdef}:


You can define \num\def\x1{x one} and use it as \x1.

Hope this helps! VIKI

share|improve this answer

Your Answer


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.