Take the 2-minute tour ×
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.

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:

\documentclass‎{article‎}‎
\begin{document}‎‎‎
\[‎ ‎f^‎\prime ‎(x)=y‎ ‎\]‎
\[‎ ‎f'‎ ‎(x)=y‎ ‎\]‎‎
\end{document}
share|improve this question
18  
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

1 Answer 1

up vote 45 down vote accepted

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

\def\active@math@prime{^\bgroup\prim@s}
{\catcode`\'=\active \global\let'\active@math@prime}
\def\prim@s{%
  \prime\futurelet\@let@token\pr@m@s}
\def\pr@m@s{%
  \ifx'\@let@token
    \expandafter\pr@@@s
  \else
    \ifx^\@let@token
      \expandafter\expandafter\expandafter\pr@@@t
    \else
      \egroup
    \fi
  \fi}
\def\pr@@@s#1{\prim@s}
\def\pr@@@t#1#2{#2\egroup}

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

Your Answer

 
discard

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.