![防止字体大小命令调整公式数字的大小](https://linux22.com/image/429605/%E9%98%B2%E6%AD%A2%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F%E5%91%BD%E4%BB%A4%E8%B0%83%E6%95%B4%E5%85%AC%E5%BC%8F%E6%95%B0%E5%AD%97%E7%9A%84%E5%A4%A7%E5%B0%8F.png)
我正在编辑一篇论文,其中作者曾经\fontsize
调整过方程的大小:
\documentclass[11pt]{article}
\usepackage{amsmath}
\pagestyle{empty}
\begin{document}
Normal size equation and equation number:
\begin{equation}
x+y=z
\end{equation}
Resized size equation and equation numbers
{\fontsize{8pt}{0}
\begin{align}
\widehat{P}_1 & = 3 {\left(N + 3\right)} {\left(N + 2\right)} {\left(N + 1\right)}^{2} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_{mult} Q_{1} \label{EQ1}\\
\widehat{P}_2 & = 3 {\left(N + 1\right)} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_{mult} Q_{2}
\label{EQ2}\end{align}}
\end{document}
在大多数情况下,调整大小是可以接受的(虽然丑陋,但可以接受),但我需要方程式数字不调整大小。我可以让方程式数字不调整大小吗?
答案1
我不确定这在印刷上是否正确。
\documentclass{article}
\usepackage{amsmath}
\usepackage{xpatch}
\makeatletter
\let\nicolardi@align@preamble\align@preamble
\xpatchcmd{\nicolardi@align@preamble}
{&\hfil}
{&\nicolardi@size\hfil}
{}{}
\xpatchcmd{\nicolardi@align@preamble}
{&\setboxz@h}
{&\nicolardi@size\setboxz@h}
{}{}
\newenvironment{sizedalign}[1]
{\def\nicolardi@size{#1}\let\align@preamble\nicolardi@align@preamble\align}
{\endalign}
\makeatother
\begin{document}
\begin{align}
a &= b \\
c &= ddddddddd
\end{align}
\begin{sizedalign}{\footnotesize}
a &= b \\
c &= ddddddddd
\end{sizedalign}
\end{document}
这是您的示例,包含所需的更正:我删除了所有\left
和\right
命令以及无用的括号;此外,mult
下标需要\mathrm
。
\begin{sizedalign}{\footnotesize}
\widehat{P}_1 & = 3(N+3)(N+2)(N+1)^{2}N^{2}(N-1)(N-2)(N-3)Q_{\mathrm{mult}}Q_{1}
\label{EQ1}\\
\widehat{P}_2 & = 3(N+1)N^{2}(N-1)(N-2)(N-3)Q_{\mathrm{mult}} Q_{2}
\label{EQ2}
\end{sizedalign}
解释。align
环境使用\halign
存储在 中的合适前导码,\align@preamble
其中定义了可重复的列对。复制宏并修补副本以在每个单元格的开头添加作为 参数给出的大小声明sizedalign
。这个新环境在本地重新定义\align@preamble
为修补的副本,然后调用\align
以完成工作。
答案2
我提出了一种使用 medmath
命令的变体解决方案nccmath
,它将数学公式的大小减少了约 20%(因此结果不会正好是 8 pt,但差别也不大):
\documentclass[11pt]{article}
\usepackage{amsmath, nccmath}
\pagestyle{empty}
\begin{document}
Resized size equation and equation numbers
{\fontsize{8pt}{0}
\begin{align}
\widehat{P}_1 & = 3 {\left(N + 3\right)} {\left(N + 2\right)} {\left(N + 1\right)}^{2} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{1} \label{EQ1}\\
\widehat{P}_2 & = 3 {\left(N + 1\right)} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{2}
\label{EQ2}\end{align}}
With the medmath command:
\begin{align}
\medmath{\widehat{P}_1} & = \medmath{3 {\left(N + 3\right)} {\left(N + 2\right)} {\left(N + 1\right)}^{2} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{1} }\label{EQ1}\\
\medmath{\widehat{P}_2 }& = \medmath{3 {\left(N + 1\right)} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{2}}
\label{EQ2}
\end{align}
Normal size:
\begin{align}
\widehat{P}_1 & = 3 {\left(N + 3\right)} {\left(N + 2\right)} {\left(N + 1\right)}^{2} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{1} \label{EQ1}\\
\widehat{P}_2 & = 3 {\left(N + 1\right)} N^{2} {\left(N - 1\right)} {\left(N - 2\right)} {\left(N - 3\right)} Q_\text{mult} Q_{2}
\label{EQ2}
\end{align}
\end{document}
答案3
正如 Ulrike Fischer 在评论中所建议的那样,我解决了以下问题:
\makeatletter
\def\my@tag@font{\normalsize}
\def\maketag@@@#1{\hbox{\m@th\normalfont\my@tag@font#1}}
\let\amsmath@eqref\eqref
\renewcommand\eqref[1]{{\let\my@tag@font\relax\amsmath@eqref{#1}}}
\makeatother
此处提供:https://tex.stackexchange.com/a/100148/33634
我也从 egreg 和 Bernard 的回答中学到了很多东西。