How to write "y^2" in latex ? I need that hook in mathmode. The error says to put the expression within $...$.
Asked
Active
Viewed 899 times
3
2 Answers
13
Here are several methods for showing the ^ character -- in math mode, text mode, and "verbatim" ("monospaced font") mode. (The third text mode variant and the verbatim variant courtesy of cmhughes and Johannes_B...)

\documentclass{article}
\begin{document}
$y\string^2$ --- math mode
y\string^2 --- text mode, variant 1 (same as math mode)
y\^{}2 --- text mode, variant 2
y\textasciicircum 2 --- text mode, variant 3
\verb|y^2| --- monospaced (``verbatim'') font mode
\end{document}
Mico
- 506,678
-
-
@HenriMenke - Not really. For sure, the output of
$y\hat{}2$is downright awful. – Mico Jun 08 '19 at 04:20 -
1
1
Here's a little experiment of what you are asking --
\documentclass{article}
\usepackage{tipa}
\usepackage{upgreek}
\begin{document}
$y\string^2$ \\
y\string^2 \\
y\^{}2 \\
y\textasciicircum2\\
\verb!y^2!\\
y\textsuperscript{\^{}}2 \\
$y \mathbin{\char`\^} 2$ \\
$y ^\wedge 2$\\
$y^\bigwedge 2$\\
% requires `tipa` package
y {\textturnv} 2 \\
% one bad idea: use \Lambda
$y ^\Lambda 2$ \\
% update #1: requires `upgreek` package
$y ^\Uplambda 2$
\end{document}
UPDATE
I found this, you may like to have a look.
hola
- 4,026
- 3
- 35
- 72
% arara: pdflatex: { shell: yes } \documentclass{article} \begin{document} y\textasciicircum2 \verb!y^2! $y\string^2$ \end{document}– Johannes_B Jun 29 '14 at 19:06^and not use the standard exponent? – egreg Jun 29 '14 at 19:34