这篇文章是根据找到的帖子构建的这里由 Gonzalo Medina 开发。如何让同一个公式在两个不同的页面上正确显示?在我的代码中,下括号没有放在正确的位置。
这是我的代码:
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}
\usepackage{lipsum}
\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}
\lipsum[1-4]
\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}
答案1
从你的问题来看,正确的位置应该在哪里有点不清楚,但我假设你也希望文本指向第一个方程中的下括号。这在你的例子中没有发生,因为你两次都使用相同的名称来标识所有内容。因此,start\value
和end\value
在第二个方程中被覆盖,你只会得到指向那些下括号的文本。更改标签将解决此问题。
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}
\usepackage{lipsum}
\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}
\vspace{3cm}
\lipsum[1-3]
\begin{equation}
L_{\omega_{m}}=\frac{1}{8}\dfrac{FkT}{\tikzmark{startf}P_{s~av}\tikzmark{endf}}\dfrac{\omega_{o}^{2}}{\omega_{m}^{2}}\left(\dfrac{P_{in}}{\tikzmark{startg}\omega_{o}W_{e}\tikzmark{endg}}%
+ \dfrac{1}{\tikzmark{starth}Q_{unl}\tikzmark{endh}}+\dfrac{P_{sig}}{\tikzmark{starti}\omega_{o}W_{e}\tikzmark{endi}} \right)^{2} \left(1 + \dfrac{\omega_{c}}{\tikzmark{startj}\omega_{m}\tikzmark{endj}} \right)
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\foreach \Value/\Length/\Text in {%
f/15pt/{Phase\\perturbation},%
g/40pt/{Input power\\over\\reactive power},%
h/20pt/{Resonator $Q$},%
i/40pt/{Signal power\\over\\reactive power},%
j/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}
答案2
如何让同一个方程在两个不同的页面上正确显示?
该类book
默认为twoside
排版。因此,在两个不同的页面中,边距不同,并且需要相应地更正标签。使用 xshift 值:
xshift=\dimexpr-\leftmargin-\oddsidemargin+\marginparsep
将在奇数页中对此进行补偿。
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}
\usepackage{lipsum}
\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,xshift=\dimexpr-\leftmargin-\oddsidemargin+\marginparsep]
\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}
\vspace{3cm}
\lipsum[1-4]
\newpage
\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}
以下是来自两个连续页面的两张图片: