# LaTeX code for text above the $\rightarrow$

Hi I am wondering what code is used to get text above the $\rightarrow$

have tried $\xrightarrow{P}$ but not running on my LaTeX as I do not know which package to install or how to install it.

currently using \usepackage{mathtools} but it wants to load from a random directory and then LaTeX stops working.

-

## migrated from quant.stackexchange.comMay 16 '14 at 4:30

This question came from our site for finance professionals and academics.

Welcome to TeX.sx! Your post was migrated here from Quantitative Finance. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner May 16 '14 at 5:11
mathtools should be part of every distribution out there. I would suggest following the instructions in How do I update my TeX distribution? to make sure you have a compatible and complete distribution, which should make even the most minimal of documents (\documentclass{article} \usepackage{mathtools} \begin{document} $\xrightarrow{P}$ \end{document}) compile. –  Werner May 16 '14 at 5:13

\xrightarrow is provided by package amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\xrightarrow{P}$
\end{document}


LaTeX package amsmath is part of distribution package amsmath in TeX Live and MiKTeX. Usually it should be already installed, because it belongs to the "required" packages: CTAN:macros/latex/required/amslatex/.

Package mathtools loads package amsmath and provides further extensible arrows, see section "3.3 Extensible symbols" in its documentation. It is part of distribution package mh in MiKTeX and TeX Live.

-