我有以下乳胶,
\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}
输出结果如下
为什么解开声明的运算符会给我 n 上的数学字体,而运算符本身却没有?如何让运算符给我正确的 n?
答案1
使用\mathop
,您可以定义:
\newcommand{\nin}{\mathop{n_{\mathrm{in}}}}
\newcommand{\nout}{\mathop{n_{\mathrm{out}}}}
或使用\DeclareMathOperator
(amsmath):
\DeclareMathOperator{\nin}{\mathit{n}_{in}}
\DeclareMathOperator{\nout}{\mathit{n}_{out}}