# Best way to write an xml tag

I'm writing a document about an XML schema, and I will be talking a lot of times about that <tag1> or that other <tag2>. Since I'm only mentioning them and not printing a whole XML file, it doesn't feel like a job for listings.

I suppose using $<tag1>$ wouldn't fit well either. So... which would be the best way of writing isolated XML tags in a document?

-

The definition of a new command would be the easiest way to go.

\newcommand*{\xml}[1]{\texttt{<#1>}}

Use it in your document as \xml{tag}.

-

With listings you can do the following:

\lstMakeShortInline{|}

And then use it thus: |<tag1>| and it will be printed using the listings style, and syntax highlighting and so on. You could use a symbol other than | if you so wished.

-
\def\<#1>{$\langle\texttt{#1}\rangle$}