Forgot password?
 Create new account
View 2504|Reply 0

扯一下 mod

[Copy link]

700

Threads

110K

Posts

910K

Credits

Credits
94177
QQ

Show all posts

kuing Posted at 2018-7-14 16:10:12 |Read mode
加载了 amsmath 之后,关于 mod 有四个命令:
5.2 \mod and its relatives
Commands \mod, \bmod, \pmod, \pod are provided to deal with the special
spacing conventions of “mod” notation. \bmod and \pmod are available in LATEX,
but with the amsmath package the spacing of \pmod will adjust to a smaller value
if it’s used in a non-display-mode formula. \mod and \pod are variants of \pmod
preferred by some authors; \mod omits the parentheses, whereas \pod omits the
“mod” and retains the parentheses.

\bmod  - 最细间距,无括号,不分行间行内
\pmod  - 有括号,行间间距大,行内间距稍小
\mod  - 无括号,其余同 \pmod
\pod  - 无 mod ,其余同 \pmod

测试效果
\begin{align*}
& \gcd(n,m\bmod n)\\
& x\equiv y\pmod b\\
& x\equiv y\mod c\\
& x\equiv y\pod d
\end{align*}$\gcd(n,m\bmod n)$
$x\equiv y\pmod b$
$x\equiv y\mod c$
$x\equiv y\pod d$

代码:
  1. \begin{align*}
  2. & \gcd(n,m\bmod n)\\
  3. & x\equiv y\pmod b\\
  4. & x\equiv y\mod c\\
  5. & x\equiv y\pod d
  6. \end{align*}
  7. $\gcd(n,m\bmod n)$
  8. $x\equiv y\pmod b$
  9. $x\equiv y\mod c$
  10. $x\equiv y\pod d$
Copy the Code
如果想了解得更清楚,可以看看它们在 amsmath.sty 内的定义:
  1. \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
  2.   {\operator@font mod}\penalty900
  3.   \mkern5mu\nonscript\mskip-\medmuskip}
  4. \newcommand{\pod}[1]{\allowbreak
  5.   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
  6. \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
  7. \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
  8.   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
Copy the Code
\nonscript:在标号及小标号中忽略随后的粘连或 kern
\allowbreak:允许断行,其定义为 \penalty0
其余的是字面义就不解释了

手机版Mobile version|Leisure Math Forum

2025-4-21 01:19 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list