I do not know if this question has more to do with the editor I use (which is LaTeXShop, on Mac) or some clever LaTeX package, but I am typesetting some notes for a course and I would like to systematically use a command, say
\variable
for the variable of functions so that I can write
$f(\variable)$
and get $f(x)$ or $f(Y)$ consistently in the whole document by simply choosing once and for all in the preamble the value of \variable. The reason is that in a first version $f(x)$ might be good, but I think I will eventually want to move to different variable names. The problem is that I have been typing $f(x)$ automatically for ages now, and I fear that here and there I will write $f(x)$ instead of $f(\variable)$ getting the same visual effect if \variable is set to $x$, so that I will never catch the error while proof reading, but creating a mess the day I will rename my \variable. So comes my question: is there a systematic way to ask LaTeX to warn me whenever I use $x$ "although I wanted to use \variable"? Of course, I do not want it to warn me each time I use the letter x. (I will be writing in French, and there are a lot of x's here and there in text) nor to warn me about $f(x)$ and forget about $g(x)$.)

\newcommand*{\variable}{x}and later change it to\newcommand*{\variable}{Y}. There are ways to warn about anxin math-mode by making it active but is this really something you want? Why don’t you search once forxs in math-mode and get rid of them? See A lightweight editor that supports search and replace in math mode – Qrrbrbirlbel Aug 19 '13 at 03:10