17

I wonder if there is a tex library that can create an equation like this (found in this paper and the authors actually create a figure for this, not in tex) enter image description here With some research, I see that the arrows can be made using witharrows but I am not sure about the colored part, specifically the I_i(D) part where the two colors (dark green & light green) overlap. Any pointer will be highly appreciated! Thanks!

2
  • 3
    You could try with annotate-equations or tikzmark package, though I think the figure (figs/equation.pdf in the .tar.gz archive 2307.06290) in that arXiv paper is actually produced by MS Office Word (the almost Office-specific math font Calibri Math is embedded in the PDF) and then annotated by Quartz PDFcontext (see the PDF producer). Jul 23, 2023 at 4:13
  • 1
    Hi @muzimuzhiZ thanks for the quick response! I will take a look into these two packages. Seems like they can do exactly this. Jul 23, 2023 at 5:03

1 Answer 1

24

An attempt using annotate-equations package.

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .