I'm trying to typeset some computer code which involves a caret (for powers); for example
\verb!x^3+x^2-1!
The trouble here is that the caret produced is rather flat. I could use a wedge instead:
\newcommand{\pwr}{${}^\wedge}$}
\texttt{x\pwr 3+x\pwr 2-1}
but the wedge here is too pointy, as well as being the wrong weight for the typewriter font. What I want to know is: is there a symbol, which comes halfway between caret and wedge in shape, and is the same weight as a typewriter caret (so can be used within \texttt{}
)?
I've tried replacing \verb!^!
with {{}\large\textasciicircum}
and this sort of works, but is still clearly not an optimum solution.
Best Answer
The appearance of the care symbol depends on the used font. For example,
Courier
orTeX Gyre Cursor
has a symbol that is something between the caret of the Computer Modern fonts and the\wedge
solution.The following example uses
\lstinline
instead of\verb
, because a symbol can more easily be replaced via optionliterate
: