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'm trying to redefine \rule to make cleaner underscores, but my book file (in memoir class) is having problems with the following:


I get an "undefined control sequence" on \LetLtxMacro{\oldrule}{\rule}.

share|improve this question
It's a very bad idea to redefine an important command of LaTeX, which is used in many places with a different syntax. – egreg Dec 2 '11 at 20:29
It was suggested to me here: [tex.stackexchange.com/a/36922/9757]. If there's a better way of doing this, though, that would be helpful too. Thanks! – jamaicanworm Dec 2 '11 at 20:30
The suggestion was bad. You won't be able to typeset footnotes, for example. Why not defining a command as I suggested you? \newcommand{\blank}[1]{\rule{#1}{0.4pt}} – egreg Dec 2 '11 at 20:36
@egreg: Note that in my answer to @ jamaicanworm's question there was no mention of using memoir. Moreover, the example given had no mention of the scope. Using something else (like your suggestion) would work fine. – Werner Dec 2 '11 at 20:38
@Werner It doesn't matter much what class is being used: don't ever advise to redefine kernel commands other than those that simply produce text; for instance \let\phi\varphi is OK, but redefining \parbox would be disastrous. – egreg Dec 2 '11 at 20:42
up vote 9 down vote accepted

The purpose of \newcommand in LaTeX is exactly to protect users from redefining a command that can be very important for the system.

For instance, if one tries to redefine \fi, all sorts of strange things will happen, starting from LaTeX throwing an error when finding \begin{document} and telling

Missing \begin{document}.

Really. :)

The command \rule is used in the LaTeX kernel when typesetting footnotes and redefining it will break the feature. Classes and packages may use \rule as well: it appears 14 times in memoir.cls.

In some cases it's good to redefine also kernel commands; Heiko Oberdiek's packages do it frequently and for this the package letltxmacro has been devised. However users should know precisely what they're doing, and never change the command syntax (the number and nature of arguments).

It's quite strange that you get an error, because your code works for me. However, don't use it. Rather define a personal command such as


You'll have only benefits from this: you give semantic value to your code.

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.