答案1
尝试使用annotate-equations
包。
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass{article}
\usepackage{amsmath}
\usepackage{annotate-equations}
\begin{document}
\newcommand\mathstrutX{\vphantom{\widetilde{M}}}
\[
\setlength{\fboxsep}{1pt}
- \eqnmarkbox[orange!50!red]{Q}{Q_{D|M,S} \mathstrutX}
\propto \log \eqnmarkbox[DodgerBlue]{LMD}{L(\widetilde{M},D_{\text{eval}})}
\propto \eqnmarkbox[yellow!50!orange]{L0}{L_0 \mathstrutX}
+ F(
\eqnmarkbox[OliveDrab!40!white]{I1D-InD}{
\{ \tikzmarknode[outer ysep=0pt]{I1D}{I_1(D)}, I_2(D), \cdots
\smash{{\eqnmarkbox[OliveDrab]{IiD}{I_i(D) \mathstrutX}}}, \cdots,
I_n(D) \}
\mathstrutX
}
)
\]
\tikzset{annotate equations/arrow/.append style={semithick}}
\annotate[yshift=-1em]{below, left}{Q}{Instruction Quality}
\annotate[yshift= 1em]{left}{LMD}{Model Evaluation Loss}
\annotate[yshift=-1em]{below, left}{L0}{Minimal Loss Constant}
\annotate[yshift= 1em]{}{IiD}{$i$th indicator on data $D$}
\tikzset{annotate equations/arrow/.append style={color=OliveDrab}}
\annotate[yshift=-1em, color=OliveDrab]{below}{I1D}{Bag of $n$ indicators}
\end{document}