2 Answers
2

Also, I'd recommend to create a custom command, like this (this will allow you to change the typesetting of all XML tags at once):

\documentclass[varwidth]{standalone}
\usepackage{xcolor}
\newcommand{\tag}[1]{\texttt{\textbf{\textcolor{red}{<}}#1\textbf{\textcolor{red}{>}}}}
\begin{document}
This is an XML \verb|<tag>| example.
This is an improved \tag{tag} example.
\end{document}

If you're going to have to type up more of these tags, the listings package may be well worth a try (employing colors for operators (or literals, or whatever) is tricky; if you'd like them, usually, one suggests the package minted, which unfortunately does not do inline stuff! catch 22!):

! is a delimiter for the code that goes between its two instances: so, this should be a symbol that does not appear in the code (cf. | that appears in \verb command in m0nhawk's solution). So,

\lstinline<<tag>< % wrong
\lstinline><tag>< % not wrong, but not what you want
\lstinline$<tag>$ % right
\lstinline+<tag>+ % right
\lstinline|<tag>| % right

The delimiter cannot be this [ unless you do the following:

\lstinline[][<tag>[

(What is happening is that, the \lstinline looks for an optional list of key=value pairs, when it first encounters [.)

I am posting this answer, mostly for the reason that, using \verb, you end up with different font family, which may well be your desire! In case, you'd like the same font family, this solution is open.

In this case I'm indifferent about the font or color, but it's good to know the options. It's just for a handful of tags in thi text and the font resulting from using \verb looks fine in the output so I'll stick to using that.
–
LJNielsenDkMay 4 '13 at 13:55

Sure thing! :) As I said, I am posting this mostly for variety, but also we can refer to this later on.
–
kanMay 4 '13 at 13:56