[Tex/LaTex] What are semantically correct alternatives to \text in math mode

math-modesemantics

I have used \text{something} several times in math mode. The result is rendered like I want it to be rendered, but I think this might not the best way to do it in LaTeX.

What I currently do

Hopefully correct usage of \text

A longer one:

\begin{align*}
    U \subseteq \mathbb{R}^n \text{ offen} \Leftrightarrow 
       &\text{ für jedes } x \in U \text{ gibt es } r > 0,\\
       &\text{ sodass } \fB_r(x) = \Set{y \in \mdr^n | d(x,y) < r} \subseteq U
\end{align*}

Probably incorrect

  • $g \circ f = \text{id}_X$: Donote the identity function.
  • $\text{Isom}(X)$: Isometry group
  • $\text{grad}(F)(x) \neq 0$: Degree of a function
  • $\text{conv}(v_0, \dots, v_k): Convex hull of some points

Alternatives to \text

I've searched for alternatives and found the following:

  • \[ \text{Let } x = \text{ number of cats} \]: Provided by the amsmath package.
  • \[ \mbox{Let } x = \mbox{ number of cats} \]
  • \[ \textrm{Let } x = \textrm{ number of cats} \]
  • \operatorname{sgn} and \DeclareMathOperator{\sgn}{sgn}: Provided by amsmath. I think I should use this for my currently incorrect usages. But I'm not sure if this is semantically correct.
  • $\mathrm{Gal}(f)$

\newcommand{\x}[1]{\text{#1}} might also be interesting. This would at least give me a command for groups / the identity. At the end, it will also be text, but it lets me switch easier to better variants.

Questions

  • Are the two examples which I labeled as correct actually correct? Are there better alternatives?
  • How do the "Alternatives to \text" differ? Did I miss some good ones?
  • What should I use for my "Probably incorrect" ones?

Related questions

I've read the following questions and answers (which did only partially help):

Best Answer

I'm afraid you hit no correct choice. ;-)

  • $\fT_\text{triv} = \Set{\emptyset, X}$: incorrect. Define

    \newcommand{\ts}[1]{\textnormal{#1}} % textual subscript
    

    and use $\fT_{\ts{triv}}. You can later change your mind about the typesetting of \ts. With \text you're not guaranteed to get upright shape, for example in the statement of a theorem.

  • $g \circ f = \text{id}_X$: incorrect. Define

    \newcommand{\id}{\textnormal{id}}
    

    (or with \textit, which I'd prefer).

  • $\text{Isom}(X)$: incorrect. It's an operator, so $\operatorname{Isom}(X)$. Defining a command with \DeclareMathOperator is of course a good choice. The same considerations hold for “grad”, “cov”, ”sgn” and ”Gal”.

  • \[ \text{Let } x = \text{ number of cats} \]: incorrect. “Let” should not go in the displayed equation. So

    Let
    \[
    x=\text{number of cats}
    \]
    

    with no space before “number”.

The longer one should be

\begin{align*}
U \subseteq \mathbb{R}^n \text{ offen} \Leftrightarrow 
  &\text{für jedes $x \in U$ gibt es $r > 0$,}\\
  &\text{sodass $\fB_r(x) = \Set{y \in \mdr^n | d(x,y) < r} \subseteq U$}
\end{align*}

so you don't have to think where spaces are necessary.

I wouldn't use a macro \Set with delimited argument, preferring

\newcommand{\Set}[2]{\{\,#1\mid #2\,\}}

and \Set{y \in \mdr^n}{d(x,y) < r}. This is more consistent with LaTeX syntax. If your \Set macro has just one normal argument, then use \mid and not |.

Related Question