I get:

! LaTeX Error: Command \endash already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.3 \newcommand{\endash}{\emrule{.5}}


So my first question is what manual---see p.192 of the manual.? Through experimentation I believe that what is going on here is a name clash. The processor sees \end and hits the brake with an attendent error message. For instance \EMdash and \enrule both work without error. Since I lack sufficient macro-foo, could someone with greater knowledge than I please clarify? BTW if I comment out the definition of \endash it fails with a message about \endash not defined:

! Undefined control sequence.
l.5 2000\endash

Which leads me back to my contention that this is a name clash with just \end.

  • You could try just changing the name. I tend to start my macros with an uppercase letter and a prefix -- although this is not guaranteed to always work, I haven't had a problem yet. So for example something like \HSEndash, \HSEmdash, \HSMyMacro, etc. – Peter Grill Jan 22 '13 at 18:52
  • @PeterGrill note that I said that \EMdash or for that matter ENdash both work. I'm not looking for a fix, just an explanation, thanks though. – hsmyers Jan 22 '13 at 18:54
  • :-) I guess I really should read the question. :-) – Peter Grill Jan 22 '13 at 18:59
  • @PeterGrill Slashdot idiom would be RTFQ, but I've always found that a bit rude :) – hsmyers Jan 22 '13 at 19:11

\newcommand explicitly refuses to define macros whose name begins with end. This may have been a disputable design decision, but the LaTeX kernel is kind of frozen and changing this behavior after so many years would open big problems. With \NewDocumentCommand from the xparse package you're freed from this restriction:


Another way can be to test if the command already exists in a different way:


relying on lower level TeX constructions.

Are there any problems with this? Yes, there are. If you later on say

 {something maybe related to cricket at the start}
 {something else at the end}

you'd find yourself in big trouble, because this declaration would silently redefine your \endash command: indeed the ash environment uses \ash and \endash at start and finish.

  • Extremely good to know! I've suffered from this disease in virtually every compiler I've used---And I've used a lot. Can't quite see why folks seem to miss the notion that they shouldn't place restrictions on users particularly by accident! <sigh/> BTW, I not particularly happy about no numbers is macro names either... – hsmyers Jan 22 '13 at 19:00
  • 1
    @hsmyers Numbers in macro names would pose difficult problems; remember that TeX is primarily a language for typesetting, so some limitations are present for reasons related to this primary task (or because of Knuth's view of it). The "end" restriction is due to how environments are implemented. If later you define an ash environment, you'd be in big troubles. – egreg Jan 22 '13 at 19:03
  • Also good to know. Could you explain what manual the reference mentions? I'd guess LaTeX Companion, but I'd like to know for sure (likewise what edition). – hsmyers Jan 22 '13 at 19:07
  • 1
    @hsmyers The manual referred to is "LaTeX, a document preparation system" by L. Lamport (the original author of LaTeX). – egreg Jan 22 '13 at 19:10
  • That would explain why the page didn't seem to be in context. Good thing I've got both :) – hsmyers Jan 22 '13 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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