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.
2 Answers
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}
You should not surround each symbol with $
. Use $
to enter or leave inline math, so surround the entire expression. \num
isn't a standard command it isn't clear what you intend it to do. (The siunitix
package has a command of that name but unrelated to this I think) so I think you want
some text $\mathit{Trex1}^{-/-}$ some more text
but it is hard to be sure as you provided little context about the intended use here.
\emph{Trex1}${}^{-/-}$
. What is\num{-}
supposed to be?-
in math mode. That will have the proper spacing based on if it is a unary negtive$-5$
or a binary operator$7-5$.
+
and-
can just be used directly in math mode. If you want to enforce unary spacing on those you can use{-}
and{+}
.