I'm trying to write
\texttt{gap> M:=Group(r*u^2*d^-1*b*d^-1);}
exactly this way. But latex return an error because of the powers.
How can I fix this?
\documentclass{article}
\begin{document}
\texttt{gap> M:=Group(ru\^{}2d\^{}-1bd\^{}-1);}
{\ttfamily gap> M:=Group(ru\^{}2d\^{}-1bd\^{}-1);}
\verb|gap> M:=Group(ru^2d^-1bd^-1);|
\end{document}
I believe you are trying to do verbatim text. Therefore, I would suggest using the \verb command.
\documentclass[preview, border=.2cm]{standalone}
\usepackage[utf8]{inputenc}
\begin{document}
Lorem \verb|gap> M:=Group(ru^2d^-1bd^-1);| ipsum
\end{document}