I have a macro that defines a new dimension (details have been stripped away for the MWE; in the actual command, I want to store an old value in the new one so I can modify it temporarily and then restore the old value, so defining it outside the command won't work). I can run this command in the title just fine---unless I load the titling package, in which case I get an undefined control sequence error for \x, even if I don't call \maketitle in the document. Is there a way to resolve this?



\usepackage{titling} % Comment this out and it works

    \newdimen\x \x=1pt


  • 2
    If you more \newdimen\x out of the \newcommand, the error is gone. Do you need it inside the command?
    – user194703
    Mar 26 '20 at 4:07
  • 1
    To expand on the comment by @Schrödinger'scat, it's inadvisable to use \newdimen in a command that will be called more than once. Instead, create \newdimen independently, then set it inside the "active" command definition. Mar 26 '20 at 13:25

Your Answer

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

Browse other questions tagged or ask your own question.