![如何在 Tikzpicture 环境中协调 \footnotemark 和 \footnotetext 的多种用途](https://linux22.com/image/432227/%E5%A6%82%E4%BD%95%E5%9C%A8%20Tikzpicture%20%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%8D%8F%E8%B0%83%20%5Cfootnotemark%20%E5%92%8C%20%5Cfootnotetext%20%E7%9A%84%E5%A4%9A%E7%A7%8D%E7%94%A8%E9%80%94.png)
考虑
\documentclass[12pt]{book}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\thispagestyle{empty}
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=2pt,amplitude=1pt}
} %
]
\node[
preaction={fill=black,opacity=.5,transform canvas={xshift=1mm,yshift=-1mm}},
pencildraw,draw,fill=blue!25,text width=0.94\textwidth,inner sep=5mm,align=justify]
{\fontsize{13}{18}\selectfont \textbf{First sentence.\footnotemark \, Second sentence.\footnotemark \, Third sentence.\footnotemark}};
\end{tikzpicture}
\end{center}
\footnotetext{first footnote}
\footnotetext{second footnote}
\footnotetext{third footnote}
\end{document}
生成 tikzpicture
附有脚注
问题:我该如何修正上述代码,以便正确的脚注标记(1 后跟 2 后跟 3)以垂直顺序出现?
谢谢。
答案1
您可以像这样明确设置脚注的编号:
\footnotetext[1]{first footnote}
\footnotetext[2]{second footnote}
\footnotetext[3]{third footnote}
答案2
您可以使用可选参数\footnotetext
,并“向后”计数(而不是硬编码1
和2
)。
\documentclass[12pt]{book}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\thispagestyle{empty}
\begin{center}
\begin{tikzpicture}[pencildraw/.style={ %
decorate,
decoration={random steps,segment length=2pt,amplitude=1pt}
} %
]
\node[
preaction={fill=black,opacity=.5,transform canvas={xshift=1mm,yshift=-1mm}},
pencildraw,draw,fill=blue!25,text width=0.94\textwidth,inner sep=5mm,align=justify]
{\fontsize{13}{18}\selectfont \textbf{First sentence.\footnotemark \, Second sentence.\footnotemark \, Third sentence.\footnotemark}};
\end{tikzpicture}
\end{center}
\footnotetext[\numexpr\value{footnote}-2]{first footnote}
\footnotetext[\numexpr\value{footnote}-1]{second footnote}
\footnotetext{third footnote}
\end{document}