1

I have the following latex,

\documentclass{article} \usepackage{amsmath}

\DeclareMathOperator{\nin}{n_{\textrm{in}}} \DeclareMathOperator{\nout}{n_{\textrm{out}}}


\begin{document}
     I want my declared math operators to look like this: \[
    n_{\textrm{in}}, n_{\textrm{out}} \] But when I use them, they look like this: \[
    \nin, \nout \]


\end{document}

Which produces the following output

enter image description here

Why is it that unwrapping the declared operator gives me the math font on the n, while the Operator itself does not? How do I get the operator to give me the correct n?

1
  • One of the effect of \DeclareMathOperator is precisely to use the "operators" Symbol Font which by default is Computer Modern upright. Are you sure you want an "operator" here. They look more like being variables, so why not \newcommand? – user4686 Apr 25 '18 at 7:58
2

With \mathop, you can define:

\newcommand{\nin}{\mathop{n_{\mathrm{in}}}} 
\newcommand{\nout}{\mathop{n_{\mathrm{out}}}} 

or using \DeclareMathOperator (amsmath):

\DeclareMathOperator{\nin}{\mathit{n}_{in}} 
\DeclareMathOperator{\nout}{\mathit{n}_{out}}

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.