How to combine superscript, math symbols together? For instance, Trex1−/−

math-modesuperscriptssymbols

I was using this command to have my output "Trex1−/−", where -/- will be in a superscript and TREX emphasized/italic.
My command is \emph{Trex1} $^${\num{-}}$/$ $^${\num{-}}
I get error message saying," undefined control sequence" and "missing { inserted"-what does this mean and how can I solve this? I noticed, even though overleaf makes the output fine, but any text following this symbol becomes italic and skips the margin and alignment.

Best Answer

It should be $^{-/-}$, because you want a single superscript, albeit composed of multiple characters.

But you possibly don't want math mode at all: \textsuperscript is your friend. Anyway, here are four proposals, take your pick.

\documentclass{article}

\newcommand{\trex}{\textit{Trex1}\textsuperscript{--/--}}

\newcommand{\trexA}{%
  \textit{Trex1}%
  \textsuperscript{--\negthinspace/\negthinspace--}%
}

\newcommand{\trexM}{\textit{Trex1}$^{-/-}$}

\newcommand{\trexMM}{\textit{Trex1}$^{-\!/\!-}$}

\begin{document}

\trex\ good?

\trexA\ better?

\trexM\ good?

\trexMM\ better?

\end{document}

enter image description here

Related Question