How to create a new LaTeX command that behaves something like \verb?

Posted by NawaMan on Stack Overflow See other posts from Stack Overflow or by NawaMan
Published on 2009-11-20T17:39:00Z Indexed on 2010/03/30 0:13 UTC
Read the original article Hit count: 728

I have been using LaTeX from sometime now, but have never actually gotten my hands dirty declaring a new command, as I try to avoid that.

However, I need to add monospace text often in my document and I use \verb for it which is fine, except that the verb font size is bigger than the normal text font. So I need to change the font size and undo done like \small{}\verb#My monospace code#\normalsize{}. This is not very convenient and mistake-prone.

Is there a better way to do this? Can I define a new command for this? How?

© Stack Overflow or respective owner

Related posts about latex

Related posts about inline-verbatim