1

I am writing MATLAB code into LaTex for a report and I would like to show the power symbol (^). However when I use h=2*(0.6.^i).*u; it raises i to a superscript and gives the message "I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed." Is there anyway it can still compile without math mode?

4
  • Welcome to TeX.SE! If I correctly understood your question, than h=2*(0.6.\^{}i).*u should give what you looking for.
    – Zarko
    Aug 30, 2019 at 0:35
  • That should work, it looks smaller than normal, but should work, thank you!
    – caleb
    Aug 30, 2019 at 0:38
  • You can consider using \mathtt{h=2*(0.6.\^{}i).*u}
    – Sigur
    Aug 30, 2019 at 0:47
  • 4
    \verb|h=2*(0.6.^i).*u;|? Aug 30, 2019 at 1:28

1 Answer 1

1

Hope you are looking for verbatim format in text, as you are not providing any MWE, I assume that you are using standard template, and the codes are follows:

\documentclass{book}

\begin{document}

\verb!h=2*(0.6.^i).*u!
\end{document}

PS: This was already suggested by Henri as in comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .