I have trying to use new command to represent math, and this is what I type in:

\newcommand\mylim[2][x]{lim_{#1\to #2}}

I'm trying to create a new command which represent $frac{\pi}{2}$ Is it possible for me to use \mylim{${\fpi2}^-$}?

  • Unless you use a \csname ... \endcsname workaround method, you can't have a non-letter (such as the numeral 2) be part of a command name. Use a command name such as \fpi or \fpitwo instead.
    – Mico
    Commented Sep 11, 2013 at 16:58
  • You have posted several questions in the last few days repeating the same error every time: you need a backslash \frac and \lim not frac and lim (in addition to the point of this question that you can not have a command \fpi2.) Commented Sep 11, 2013 at 18:30

1 Answer 1


The name of a command should contain only letters (not absolutely true, but at the moment let's accept it). Apparently your command doesn't require arguments, since you are interested in a constants string:


\newcommand\mylim[2][x]{\lim_{#1\to #2}}





enter image description here

  • 1
    @HuangElizabeth You're welcome! Don't forget that (after a sensible wait) you can accept answers by clicking the checkmark to their left :-) Commented Sep 11, 2013 at 17:03

Not the answer you're looking for? Browse other questions tagged .