4

I want to write a^b in latex where ^ is not a power symbol. If I just write b^a in latex, the latter obliged me to put $. But in fact I don't want to write a to the power b, but just a^b.

How can I solve this issue?

Any help will be very appreciated!

Christina
  • 530

2 Answers2

6

Here, \string can be used to avoid special (catcode induced) interpretations of the token than follows.

Such syntax will work in both text as well as math modes, though, of course, a and b will be rendered in the math font, in such a case.

\documentclass{article}
\begin{document}
a\string^b $a\string^b$
\end{document}

enter image description here

3

This is \textasciicircum in text mode, and can be used in math mode as well with proper wrappers.

\documentclass{article}

\newcommand\mathcaret{\mathbin{\textup{\textasciicircum}}}

\begin{document} a {\textasciicircum} b

(a \mathcaret b ) \end{document}

Computer modern font sample

Davislor
  • 44,045