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

Although the two outputs look quite similar, what is the advantage of using $f^\prime$ instead of $f'$? By the way, here is my code:

\[‎ ‎f^‎\prime ‎(x)=y‎ ‎\]‎
\[‎ ‎f'‎ ‎(x)=y‎ ‎\]‎‎
share|improve this question
There's no advantage in using $f^\prime$; it's just more awkward to type than $f'$ and the result is exactly the same. – egreg Dec 15 '12 at 17:14
up vote 62 down vote accepted

' is defined in latex.ltx as active math character:

{\catcode`\'=\active \global\let'\active@math@prime}

The active ' looks for following ' and puts them together as superscript, a''' becomes a^{\prime\prime\prime}. Thus using ' makes the input easier to write.

share|improve this answer

Sometimes you may want to pass LaTeX code as an argument to another program. In that case the code is typically wrapped in quotes. Using quote to mean a prime will confuse the second program. For example to type TeX in graphical output of MATLAB one may use something like


to print $F'$ at location $(0,0)$. Using $F'$ in the code however becomes problematic.

share|improve this answer
use double quotes or escapes for the String? – MaxNoe Jan 26 '15 at 10:21
@MaxNoe Double quotes don't work in Matlab. String escaping is done with a double quote. So you'd have to write things like 'The symbol f'' is used to represent the first derivative of a function', which looks wrong at a first glance. All things considered, f^\prime doesn't look so bad. – Federico Poloni Feb 9 '15 at 22:18

In fact, there's a slight difference when you have two superscripts. For instance:


The first one fits better.

share|improve this answer
Sure, but that's related to ' being the same as ^{\prime}, so if you have foo^{'\dag} your prime symbol is superscripted twice. {\bar{e}_k}'^{\dag} will give identical output as far as my eye can tell, but I agree your input is more elegant. Also fiddling with the my input led me to a double superscript error, which is frankly what I expected to begin with, so using foo^{\prime\dag} is definitely a nice idea here, I think – Au101 Jul 19 at 7:32
You should type \bar{e}_k'^{\dag} (the braces around \bar{e}_k do nothing). – egreg Jul 19 at 13: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.