我尝试在文中引用如下方程编号:
see equation \ref{eqdesign2}
该方程为:
\sbox{\myendhook}{%
\begin{footnotesize}%
\begin{tabular}{@{}ll}
$\mu_m$ & Magnetic permeability [$H/m$]\\
$N$ & Number of windings [-]\\
$A$ & Area of the coil [$m^2$]\\
$l$ & Length of the coil [$m$]
\end{tabular}
\end{footnotesize}
}
\begin{fleqns}[2em]
\begin{equation}
L_1 = \frac{\mu_m N^2 A}{l}
\label{eqdesign2}
\end{equation}
\end{fleqns}
结果是
如您所见,对方程的引用不正确。我尝试使用“gather”来解决这个问题,这样代码就变成了:
see equation \ref{eqdesign3}
\sbox{\myendhook}{%
\begin{footnotesize}%
\begin{tabular}{@{}ll}
$\mu_m$ & Magnetic permeability [$H/m$]\\
$N$ & Number of windings [-]\\
$A$ & Area of the coil [$m^2$]\\
$l$ & Length of the coil [$m$]
\end{tabular}
\end{footnotesize}
}
\begin{fleqns}[2em]
\begin{gather}
L_1 = \frac{\mu_m N^2 A}{l}
\label{eqdesign3}
\end{gather}
\end{fleqns}
现在参考已经很好了,但是带有表格的 \sbox 不再显示。
该盒子由以下代码制作:
\makeatletter
\@fleqntrue
\let\old@mathmargin=\@mathmargin
\@mathmargin=-1sp
\let\oldmathindent=\mathindent
\let\mathindent=\@mathmargin
\newsavebox{\myendhook} % for the tabulars
\def\tagform@#1{{(\maketag@@@{\ignorespaces#1\unskip\@@italiccorr)}
\makebox[0pt][r]{% after the equation number
\makebox[0.4\textwidth][l]{\usebox{\myendhook}}}%
\global\sbox{\myendhook}{}% empty box
}}
\makeatother
有人对如何解决参考或解决盒子显示有什么想法吗?
答案1
我猜你喜欢这样的东西:
由于您没有提供 MWE,我不知道您需要什么新环境。上面的等式图像是通过相当简单的代码获得的:
\documentclass{article}
\usepackage{mathtools}
\usepackage{array}
\begin{document}
see equation \ref{eqdesign3}
\begin{flalign}\label{eqdesign3}
L_1 & = \frac{\mu_m N^2 A}{l}
& & \begin{tabular}{>{\footnotesize $}r<{$:}>{\footnotesize}l}
\mu_m & Magnetic permeability [$H/m$]\\
N & Number of windings [-]\\
A & Area of the coil [$m^2$]\\
l & Length of the coil [$m$]
\end{tabular}
\end{flalign}
\end{document}
笔记:这footnotesize
不是一个环境,所以你的使用是错误的。