# Following code not working in LaTeX : $\{f^'_n\}$

Why does the following code does'nt work when i am using PDFLaTeX or just LaTeX ? I tried it in different editors as well.

This is the code

 $\{f^'_n\}$


Surprisingly it works on Math.SE site

-

In math mode, ' is active and is defined as ^\prime. Thus you should not use ^': just ' will work:
\documentclass{article}
$\{f'_n\}$

Well, almost: Some trick is done (at least in LaTeX) to allow human-readable input such as $f''(x)$; if ' simply meant ^\prime this would lead to "double superscript" error. –  Villemoes Apr 23 '11 at 17:25
@Villemoes: An ' active does not expand directly to ^\prime but to some look-ahead code that deals with this case. –  Joseph Wright Apr 23 '11 at 17:39
As an aside, I tried (once) to get ^' style input working in unicode-math, but it ended up breaking the syntax in other places :( –  Will Robertson Apr 24 '11 at 11:41