[Tex/LaTex] How to make a single word look as some code


I would like to be able to make a single word in a text look like a coded word. Is there any command such as \code{...} which allows me to do so?

(basically, I want to produce something like above for the "\code{…}" part)

Best Answer

Normally a monospaced font is used for this. This is accomplished with \texttt{...}. If you want to use code, you can use \def\code#1{\texttt{#1}}. From that point on you can write \code{...} to get monospaced output.

Related Question