0

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.

6
  • Not sure I understand what you desire, but to get "-/-" as a subsript you can use \emph{Trex1}${}^{-/-}$. What is \num{-} supposed to be? Dec 3, 2021 at 7:37
  • I used \num{-} to add the minus sign, isn't it how we add mathematical symbols like plus or minus? Dec 3, 2021 at 7:39
  • 1
    For a minus sign, just use - in math mode. That will have the proper spacing based on if it is a unary negtive $-5$ or a binary operator $7-5$. Dec 3, 2021 at 7:39
  • This makes sense, many thanks! but what about these symbols without a number before or after these (+,-. ~)? Dec 3, 2021 at 7:44
  • 1
    For the tilde see Correctly typesetting a tilde. The + and - can just be used directly in math mode. If you want to enforce unary spacing on those you can use {-} and {+}. Dec 3, 2021 at 7:52

2 Answers 2

2

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

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.