目前,我的 tikzmark 註釋與 fancyhdr 包定義的頁腳重疊。
目前我的方程式與註解定義如下
\begin{equation}
\tikzmarknode{A}{2}
\end{equation}
\begin{tikzpicture}[overlay,remember picture, shorten <= 1mm, font=\footnotesize]
\draw[red,<-] (A.south) -- ++ (-0.3,-1) node[below] {2 spin states};
\end{tikzpicture}
我想我必須將方程式和 tikzmark 註釋放在同一個框框中,以便 LaTeX 知道將整個框放在下一頁。執行此操作的正確方法是什麼?
編輯:我的方程式看起來更像這樣
\begin{equation}
\tikzmarknode{A}{2}\left[\frac{\tikzmarknode{B}{(2k_{F})}}{\tikzmarknode{C}{\left(\frac{2\pi}{Na}\right)}}\right]=\tikzmarknode{D}{n}\tikzmarknode{E}{(Na)}
\end{equation}
\begin{tikzpicture}[overlay,remember picture,shorten <=1mm,font=\footnotesize]
\draw[red,<-] (A.south) -- ++ (-0.3,-0.3) node[left,xshift=0.1cm,yshift=-0.1cm] {2 spin states};
\draw[red,<-] (B.east) -- ++ (1,0.6) node[right] {volume of Fermi sea};
\draw[red,<-] (C.south) -- ++ (0.2,-0.4) node[below right,xshift=-0.1cm,yshift=0.2cm] {volume corresponding to a single $k$ since $k$ is quantized as $k=\frac{2\pi m}{Na}$, $m\in\mathbb{Z}$};
\draw[red,<-] (D.south) -- ++ (0.3,-0.3) node[right,xshift=-0.1cm,yshift=-0.1cm] {number density};
\draw[red,<-] (E.east) -- ++(0.8,0.2) node[right] {length of chain};
\end{tikzpicture}
答案1
您可以測量註釋的尺寸並在方程式中添加相應的空間。它仍然不如人們所希望的那樣自動。
\documentclass[fleqn]{article}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\begin{document}
\lipsum[1]
\begin{equation}
\tikzmarknode{A}{2}\left[\frac{\tikzmarknode{B}{(2k_\mathrm{F})}}{\tikzmarknode{C}{\left(\frac{2\pi}{Na}\right)}}\right]=\tikzmarknode{D}{n}\tikzmarknode{E}{(Na)}
\begin{tikzpicture}[overlay,remember picture,shorten <=1mm,font=\footnotesize]
\begin{scope}[local bounding box=annotations]
\draw[red,<-] (A.south) -- ++ (-0.3,-0.3) node[left,xshift=0.1cm,yshift=-0.1cm] {2 spin states};
\draw[red,<-] (B.east) -- ++ (1,0.6) node[right] {volume of Fermi sea};
\draw[red,<-] (C.south) -- ++ (0.2,-0.4) node[below right,xshift=-0.1cm,yshift=0.2cm] {volume corresponding to a single $k$ since $k$ is quantized as $k=\frac{2\pi m}{Na}$, $m\in\mathbb{Z}$};
\draw[red,<-] (D.south) -- ++ (0.3,-0.3) node[right,xshift=-0.1cm,yshift=-0.1cm] {number density};
\draw[red,<-] (E.east) -- ++(0.8,0.2) node[right] {length of chain};
\end{scope}
\path let \p1=($(annotations.north)-(annotations.south)$),
\p2=($(annotations.center)-(A.center)$),\n1={\y1-\baselineskip} in
\pgfextra{\xdef\myht{\n1}\xdef\mylift{\y2}};
\end{tikzpicture}
\raisebox{\mylift}{$\begin{array}{@{}c@{}}\vspace{\myht}\end{array}$}
\typeout{\myht}
\end{equation}
\lipsum[2]
\end{document}
答案2
tikzmark
可能會因其本身的含義和動機而與頁面上的任何內容重疊。例如,為了避免重疊,您可以手動新增一個\vspace{8mm}
(後面跟著一個空白行)。
\documentclass{article}
\usepackage{tikz,lipsum}
\usetikzlibrary{tikzmark}
\begin{document}
\lipsum[1]
\begin{equation}
\tikzmarknode{A}{2}=1+1
\end{equation}
\begin{tikzpicture}[overlay,remember picture, shorten <= 1mm, font=\footnotesize]
\draw[red,<-] (A.south) -- ++ (-0.3,-1) node[below] {2 spin states};
\end{tikzpicture}
\vspace*{8mm}
\lipsum[1]
\end{document}