
我目前在將 fleqn 環境與 amsmath 和 nccmath 套件一起使用時遇到交叉引用方程式的問題。我希望我的方程式左對齊,因此使用 fleqn 環境。然而,我注意到,當我嘗試交叉引用方程式時,它似乎是交叉引用節號而不是方程式。不知道為什麼會這樣。
這是一個 MWE:
\documentclass[11pt]{article}
\usepackage{amsfonts, amsmath, amssymb, nccmath}
\begin{document}
\section{Intro}
Yup Yup
\section{Booyah} \label{sec: booyah}
Find Equation \ref{Eq:GGS_distribution_function_2} below Equation \ref{Eq:GGS_distribution_function} in section \ref{sec: booyah}.
\begin{fleqn}
\begin{equation}
R_F(d_p) = \left(\frac{d_p}{d_{p,max}}\right)^m
\label{Eq:GGS_distribution_function}
\end{equation}
\end{fleqn}
\begin{fleqn}
\begin{equation}
R_F(d_p) = 5
\label{Eq:GGS_distribution_function_2}
\end{equation}
\end{fleqn}
\end{document}
答案1
你可以刪除 nccmath:
\documentclass[11pt,fleqn]{article}
\usepackage{amsfonts, amsmath, amssymb}
\setlength{\mathindent}{0pt}
\begin{document}
\section{Intro}
Yup Yup
\section{Booyah} \label{sec: booyah}
Find Equation \ref{Eq:GGS_distribution_function_2} below Equation \ref{Eq:GGS_distribution_function} in section \ref{sec: booyah}.
\begin{equation}
R_F(d_p) = \left(\frac{d_p}{d_{p,max}}\right)^m
\label{Eq:GGS_distribution_function}
\end{equation}
\begin{equation}
R_F(d_p) = 5
\label{Eq:GGS_distribution_function_2}
\end{equation}
\end{document}
之所以斷掉是因為2021年amsmath的變化(https://github.com/latex3/latex2e/issues/652):
\changes{v2.17k}{2021/08/24}{將計數器移至方程式內並使用mathopen 進行保護,以便與hyperref 更好地相容,發出gh/652} 與hyperref 增加計數器一樣,會建立一個框來提升錨點它應該位於不影響間距的地方。符號的影響。如果啟動 fleqn,則它必須位於外部以避免標籤出現問題。此解決方案是暫時的,不一定是最好的。
因此,根據是否fleqn
設定了包選項,方程式的定義有所不同。但由於僅在本地nccmath
設置\@fleqntrue
,因此它不使用正確的定義,因此會中斷。