0

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?

  • 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 at 0:35
  • That should work, it looks smaller than normal, but should work, thank you! – caleb Aug 30 at 0:38
  • You can consider using \mathtt{h=2*(0.6.\^{}i).*u} – Sigur Aug 30 at 0:47
  • 3
    \verb|h=2*(0.6.^i).*u;|? – Henri Menke Aug 30 at 1:28
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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