TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

Say I want to look for occurances of a variable Y in a .tex file in texniccenter. Then it would make sense to restrict the search to occurances of Y that occur in a math environment. Thus the Y in


should be found, but the Y in

Ay, ay, sir!

should not. Is this possible?

share|improve this question
up vote 4 down vote accepted


\mathcode`Y = "8000 % cap Y
\mathcode`y = "8000 % small y

and you get an error in the line containing math Y (y).

share|improve this answer
Aah, this is a way to make LaTeX give you the locations of the variables. Not exactly what I asked, but useful anyway – willem Jun 28 '11 at 10:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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