答案1
我认为你最好的选择是彩色盒子.从下面我的例子开始。
其他选择可能是蒂克兹马克随着蒂克兹或者一个简单的\fcolorbox
宏彩色但后者只画出方形框。
以下是示例:
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\NewDocumentCommand\xfbox{sO{black}m}{%
\tcboxmath[
size=fbox,
arc=1.25mm,
colback=white,
colframe=#2,
]{\IfBooleanF{#1}{\vphantom{X}}#3}}
\begin{document}
\[
f(x) =
\xfbox[Red]{ax^2 + bx}
+ \xfbox[Blue]{c}
+ \xfbox{D}
+ \xfbox*[Green]{e}.
\]
\end{document}
编辑。\tcboxmath
来自彩色盒子并且该库theorems
接受大量参数,因此我将其包含在宏中以简化代码。非星号版本将绘制最小尺寸的框,而星号版本将在其内容周围绘制一个紧密的框。
答案2
使用纯 TikZ:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{mwe}% <-- for testing purpose only
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{positioning}
\tikzset{every picture/.style={remember picture}}
\newcommand{\fromhere}[3]{\tikz[baseline]{\node[anchor=base, draw=#1, shape=ellipse, inner xsep=-1pt, inner ysep=2pt, outer sep=0pt] (#2) {#3};}}
\begin{document}
\blindtext% <-- for testing purpose only
\[
\mathrm{D}_{\overline{\mathrm{PLT}}}-
\fromhere{orange}{f1}{$\mu_{\mathrm{D}_{\overline{\mathrm{PLT}}}}$}+
\fromhere{green}{f2}{$Z(SL)-\sigma_{\mathrm{D}_{\overline{\mathrm{PLT}}}}$}
\]\vspace{1.8cm}% necessary to leave to space for the overlay
\begin{tikzpicture}[overlay]
\node[orange, below left =.4cm of f1, text width=4cm, align=flush center] (d1) {quantity belongs to operating conditions (OPERATING SHOCKS)};
\draw[->, orange] (f1) -- (d1);
\node[green, below right=.5cm and -.2cm of f2, text width=4cm, align=flush center] (d2) {SAFETY STOCK: quantity that etc.};
\draw[->, green] (f2) -- (d2.160);
\draw ([xshift=3mm]f2.west) to[out=-90, in=-110] coordinate(f3) ([xshift=-1mm,yshift=-1.5mm]f2.center);
\node[below=1cm of f3, text width=2cm, align=flush center] (d3) {function of service level};
\draw[->] (f3) -- (d3);
\end{tikzpicture}
\blindtext% <-- for testing purpose only
\end{document}