How to have a switch to turn on/off the raising of punctuating commas inside the math mode so that (when the switch is true) they are typeset by \newcommand{\CommaPunct}{\mathpunct{\raisebox{0.5ex}{,}}} as suggested by this answer?
\documentclass{article}
\usepackage{amsmath}
\newcommand{\CommaPunct}{\mathpunct{\raisebox{0.5ex}{,}}}
\begin{document}
\noindent
\verb|\mathpunct|: $\frac{1}{2} \CommaPunct \frac{3}{4} \CommaPunct \dfrac{1}{2} \CommaPunct \dfrac{3}{4}$\\
Here, after setting the automatic raise to true, the commas should be printed as above\\
$\frac{1}{2} , \frac{3}{4} , \dfrac{1}{2} , \dfrac{3}{4}$
\end{document}


\usepackage[tuenc,no-math]{fontspec}
\usepackage[bold-style=TeX,math-style=french]{unicode-math}
\setmainfont[ Ligatures={NoRequired, NoCommon, NoContextual} ]{Latin Modern Roman}
\setmathfont{Latin Modern Math}[version=LM] \setmathfont{TeX Gyre Pagella Math}[version=TG] \setmathfont[math-style=ISO]{Cambria Math}`
– Diaa Dec 20 '23 at 11:40\raisebox{0.5ex}{$\commaorig$}– David Carlisle Dec 20 '23 at 11:50