3

How to write "y^2" in latex ? I need that hook in mathmode. The error says to put the expression within $...$.

marked as duplicate by clemens, Mico, doncherry, Stefan Kottwitz Jun 29 '14 at 20:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @Suman: Beware, all methods provide different output: % 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
  • The main question is: why do you want to print the ^ and not use the standard exponent? – egreg Jun 29 '14 at 19:34
  • 3
    @egreg - "[Ours is] not to reason why" (Alfred Lord Tennyson, The Charge of the Light Brigade, 1855). :-) – Mico Jun 29 '14 at 20:57
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...)

enter image description here

\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}
  • \hat{}?....... – Henri Menke Jun 7 at 23:55
  • @HenriMenke - Not really. For sure, the output of $y\hat{}2$ is downright awful. – Mico Jun 8 at 4:20
  • 1
    $y\hat{~}2$.. – Henri Menke Jun 8 at 4:30
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.