21

I have a command \putansline{1}{2} that inserts 1 line of dots and prints the total score as [2]. I want to define a new command that if issued, will redefine this command so that it prints only the score. Here's what I have for this new command:

\newcommand{\hideanslines}{%
  \renewcommand{\putansline}[2]{[#2]}
}% 

I get an illegal parameter number error for this new command though. How can I define this new command hideanslines so that after I issue it, putansline can only print the points and not the lines?

27

Use two #'s.

\newcommand{\hideanslines}{%
  \renewcommand{\putansline}[2]{[##2]}%
}

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.