在下面的 MWE 中,我想要让公式显示下括号和指向文本的线条,如下所示:
这是我的代码:
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\begin{document}
\begin{equation}
L_{\omega_{m}}=\frac{1}{8}\dfrac{FkT}{P_{s~av}}\dfrac{\omega_{o}^{2}}{\omega_{m}^{2}}\left(\dfrac{P_{in}}{\omega_{o}W_{e}}%
+ \dfrac{1}{Q_{unl}}+\dfrac{P_{sig}}{\omega_{o}W_{e}} \right)^{2} \left(1 + \dfrac{\omega_{c}}{\omega_{m}} \right)
\end{equation}
\end{document}
答案1
这可以通过tikzmark
库(编译文档两到三次以使元素到达其最终位置):
代码:
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}
\begin{document}
\begin{equation}
L_{\omega_{m}}=\frac{1}{8}\dfrac{FkT}{\tikzmark{starta}P_{s~av}\tikzmark{enda}}\dfrac{\omega_{o}^{2}}{\omega_{m}^{2}}\left(\dfrac{P_{in}}{\tikzmark{startb}\omega_{o}W_{e}\tikzmark{endb}}%
+ \dfrac{1}{\tikzmark{startc}Q_{unl}\tikzmark{endc}}+\dfrac{P_{sig}}{\tikzmark{startd}\omega_{o}W_{e}\tikzmark{endd}} \right)^{2} \left(1 + \dfrac{\omega_{c}}{\tikzmark{starte}\omega_{m}\tikzmark{ende}} \right)
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\foreach \Value/\Length/\Text in {%
a/15pt/{Phase\\perturbation},%
b/40pt/{Input power\\over\\reactive power},%
c/20pt/{Resonator $Q$},%
d/40pt/{Signal power\\over\\reactive power},%
e/20pt/{Flicker\\effect}%
}
{
\draw[decorate,decoration={brace,mirror,raise=5pt}]
({pic cs:start\Value}) -- coordinate (aux-\Value) ({pic cs:end\Value}|-{pic cs:start\Value});
\draw
([yshift=-7pt]aux-\Value) -- ++(0pt,-\Length)
node[below,align=center] {\Text};
}
\end{tikzpicture}
\end{document}