This question already has an answer here:

I want to create a macro \dom (for domain) that behaves similarly to \sin in the sense that it has spacing \, if it is followed by a letter such as in \dom a and that is has no spacing if followed by parentheses such as in \dom (a). What I want to do is to have something like \newcommand{\dom}{\mathrm{dom} \, } whenever what follows is not a parentheses and \newcommand{\dom}{\mathrm{dom}} whenever it is.

marked as duplicate by egreg macros May 20 at 12:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \DeclareMathOperator{dom} (requires \usepackage{amsmath}). This is a duplicate. – egreg May 20 at 12:35

Browse other questions tagged or ask your own question.