I have a problem with a space after a comma in a subscript.
I created a command called \segN
, for intervals with integers. I want a \thinspace
between the first integer and the comma, so I typed #1\,,#2
in my command. The second integer should be separated from the comma by the regular space after a comma. It works fine but not in a subscript.
Here is a MWE:
\documentclass[a4paper,10pt]{article}
\usepackage{mathtools}
\usepackage[frenchmath]{newtxmath}
\makeatletter
\newcommand{\segN}{\@ifstar\segN@star\segN@nostar}
\newcommand*{\segN@star}[2]{\left\dlb#1\,,#2\right\drb}
\newcommand*{\segN@nostar}[3][]{#1\dlb#2\,,#3#1\drb}
\makeatother
\begin{document}
$\segN{1}{2}$,\qquad$\displaystyle\sum_{k\in\segN{1}{2}}x_k$
\end{document}
In the first \segN{1}{2}
, it's ok: the 2 is separated from the comma.
But in the second (with the subscript), the 2 is sticked to the comma and I don't understand why.