I apologize in advance if this question has already been asked, and if it is a dumb question: my knowledge of LaTeX is very limited.
I'm doing a thesis in mathematics, and I've some problems regarding formulas, which sometimes appear upright -like using \text{}-, sometimes in italic -like using \emph{}-.
I divided the claims in two groups: \theoremstyle{plain} -for theorems, propositions, etc- and \theoremstyle{definition} -for definitions, remarks-.
Now, I use many times the letter $\text{H}$ to denote the cohomology: I therefore defined a new command
\newcommand{\coh}{\emph{H}}
but unfortunately, when is used in a definition, it is in italic, while in a theorem environment it is straight: how can I impose to LaTeX to always print this letter upright, no matter the environment in which is used? I tried \newcommand{\coh}{\text{H}} but it still doesn't work.

\usepackage{mathtools}(which includesamsmath) and then using\DeclareMathOperator{\coh}{H}should give you the desired results. FYI, instead of descrbing the problem, it is always best to compose a fully compilable MWE that illustrates the problem including the\documentclassand the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Oct 13 '20 at 07:37\DeclareMathOperatoris one of the best solution, can you make this asanswerfor this topic? So that it will help all to find solution in future... – MadyYuvi Oct 13 '20 at 07:49