When I want to print out some common "special meaning" characters, I use the \verb
command, i.e.
\verb?x^2 + 1?
(No, I don't wan't to use the math mode, I want to print out that ^
character.)
Works fine, except then when I want to "box" the text. This: \fbox{\verb?x + 1?}
works fine, but this: \fbox{\verb?x^2 + 1?}
fails: seems that the fbox removes the verbatim-ness, and processes the ^
as math-mode (even though I didn't put any $
...)
Question: is there a "simple" way to (re-)enable the verbatim mode inside a \fbox
?
Note: I also checked this similar question, however I am unable to make the accepted answer work.