[Tex/LaTex] Best way to write an xml tag

fontslistingsxml

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?

Best Answer

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}.