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.
- 223,288
2 Answers
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.
- 757,742
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}
- 1,121,712

\emph{Trex1}${}^{-/-}$. What is\num{-}supposed to be? – Peter Grill Dec 03 '21 at 07:37-in math mode. That will have the proper spacing based on if it is a unary negtive$-5$or a binary operator$7-5$.– Peter Grill Dec 03 '21 at 07:39+and-can just be used directly in math mode. If you want to enforce unary spacing on those you can use{-}and{+}. – Peter Grill Dec 03 '21 at 07:52$around every symbol, use it around entire expressions, and don't use\emphfor mathematics, it is for emphasis in text, It isn't clear what you want\numto do (and it isnt defined by default) – David Carlisle Dec 03 '21 at 07:52