I'm trying to set up a shortcut for writing semantic types. These are usually written inside $\langle$ and $\rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:
I've come up with a macro like the following:
\newcommand{\type}[1]{%
$\langle$\textit{#1}$\rangle$%
}
However, this of course results in the commas being italicized, too, which is not usually done in this context:
Is there a way to exclude commas from being italicized when using this command?
MWE:
\documentclass{article}
\newcommand{\type}[1]{%
$\langle$\textit{#1}$\rangle$%
}
\usepackage[T1]{fontenc}
\usepackage{times}
\begin{document}
\type{e, t} % Don't want comma italicized
$\langle e, t\rangle$ % Don't want math typeface for letters
$\langle$\textit{e}, \textit{t}$\rangle$ % Desired result, but cumbersome
\end{document}
Edit:
To clarify, the reason I don't want to just do $\langle#1\rangle$ is because I want the semantic types to be set in the same typeface as the main text, not the math mode typeface. I've updated the MWE to reflect this, and here's the comparison:






\textitwill pick up tje current text style eg bold, you seem to be just useing the deprecatedtimespackage so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here. – David Carlisle Oct 20 '18 at 23:06