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

This question already has an answer here:

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}^-$}?

share|improve this question

marked as duplicate by Werner, egreg, Heiko Oberdiek, lockstep, Stefan Kottwitz Sep 11 '13 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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 Sep 11 '13 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.) – David Carlisle Sep 11 '13 at 18:30

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

share|improve this answer
Thank you so much :D – Huang Elizabeth Sep 11 '13 at 17:00
@HuangElizabeth You're welcome! Don't forget that (after a sensible wait) you can accept answers by clicking the checkmark to their left :-) – Gonzalo Medina Sep 11 '13 at 17:03

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