脚注在 TikZ 中不起作用

脚注在 TikZ 中不起作用

这是我的代码:

\documentclass[oneside,a4paper]{book}

%draw
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{shapes.multipart}

\begin{document}

\begin{figure}[h!]
    \centering
    \resizebox{\textwidth}{!}{%
    \begin{tikzpicture}[text centered]
        \foreach \x in {-8, -7.4, -6.8, -6.2}
        \foreach \y in {1.8, 1.2, ..., -2.4}
            \draw[thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        \foreach \x in {7, 6.4, 5.8}
        \foreach \y in {0, -0.6, -1.2, -1.8}
            \draw[blue, thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        %\draw[red, thick] (-7.45, -0.05) rectangle (-5.65, -1.85);
        \draw[red, thick] (-6.85, -0.05) -- (-5.65, -0.05);
        \draw[red, thick] (-5.65, -0.05) -- (-5.65, -1.85);
        \draw[red, thick] (-5.65, -1.85) -- (-7.45, -1.85);
        \draw[red, thick] (-7.45, -1.85) -- (-7.45, -0.65);
        \draw[red, thick] (-7.45, -0.65) -- (-6.85, -0.65);
        \draw[red, thick] (-6.85, -0.65) -- (-6.85, -0.05);
        \draw[red, thick] (-8.05, 2.35) rectangle (-5.65, 1.75);
        \node (sprints) {Sprints};

        \draw[->,latex-,line width=0.1em] (175:5em) node[above left=1em and 0.5em] {Stand-up Meeting\footnote{Daily}} arc (175:95:5em);
        \draw[->,latex-,line width=0.1em] (85:5em) arc (85:5:5em) node[above right=1em and 0.5em] {Development\footnote{Sprint burn down}};
        \draw[->,latex-,line width=0.1em] (265:5em) arc (265:185:5em) node[below left=1em and 0.1em] {Retrospective\footnote{After each Sprint}};
        \draw[->,latex-,line width=0.1em] (355:5em) node[below right=1em and 0.5em] {Planning} arc (355:275:5em);

        \draw[->,-latex,line width=0.1em] +(-20em,-5em) -- +(-2em,-5em);
        \draw[->,-latex,line width=0.1em] +(2em,-5em) -- +(20em,-5em);

        \node (start) [below left=4.5em and 10em of sprints] {Spring Backlog};
        \node (end) [below right=4.5em and 10em of sprints] {Workable Release};
    \end{tikzpicture}
    }%
    \caption{Working flow}
\end{figure}

\end{document}

但没有显示脚注输出。如何让它工作?

答案1

也许这个方法可行。请注意每个脚注后面括号内的脚注编号\footnotetext

在此处输入图片描述 在此处输入图片描述

\documentclass[oneside,a4paper]{book}

%draw
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{shapes.multipart}
\pgfplotsset{compat=1.15}%        <--- added too

\begin{document}

\begin{figure}[h!]
    \centering
    \resizebox{\textwidth}{!}{%
    \begin{tikzpicture}[text centered]
        \foreach \x in {-8, -7.4, -6.8, -6.2}
        \foreach \y in {1.8, 1.2, ..., -2.4}
            \draw[thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        \foreach \x in {7, 6.4, 5.8}
        \foreach \y in {0, -0.6, -1.2, -1.8}
            \draw[blue, thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        %\draw[red, thick] (-7.45, -0.05) rectangle (-5.65, -1.85);
        \draw[red, thick] (-6.85, -0.05) -- (-5.65, -0.05);
        \draw[red, thick] (-5.65, -0.05) -- (-5.65, -1.85);
        \draw[red, thick] (-5.65, -1.85) -- (-7.45, -1.85);
        \draw[red, thick] (-7.45, -1.85) -- (-7.45, -0.65);
        \draw[red, thick] (-7.45, -0.65) -- (-6.85, -0.65);
        \draw[red, thick] (-6.85, -0.65) -- (-6.85, -0.05);
        \draw[red, thick] (-8.05, 2.35) rectangle (-5.65, 1.75);
        \node (sprints) {Sprints};

        \draw[->,latex-,line width=0.1em] (175:5em) node[above left=1em and 0.5em] {Stand-up Meeting\footnotemark} arc (175:95:5em);
        \draw[->,latex-,line width=0.1em] (85:5em) arc (85:5:5em) node[above right=1em and 0.5em] {Development\footnotemark};
        \draw[->,latex-,line width=0.1em] (265:5em) arc (265:185:5em) node[below left=1em and 0.1em] {Retrospective\footnotemark};
        \draw[->,latex-,line width=0.1em] (355:5em) node[below right=1em and 0.5em] {Planning} arc (355:275:5em);

        \draw[->,-latex,line width=0.1em] +(-20em,-5em) -- +(-2em,-5em);
        \draw[->,-latex,line width=0.1em] +(2em,-5em) -- +(20em,-5em);

        \node (start) [below left=4.5em and 10em of sprints] {Spring Backlog};
        \node (end) [below right=4.5em and 10em of sprints] {Workable Release};

    \end{tikzpicture}
    }%
    \caption{Working flow}
\end{figure}

\footnotetext[1]{Daily}
\footnotetext[2]{Sprint burn down}
\footnotetext[3]{After each Sprint}

\end{document}

答案2

您可以\footnote用一对\footnotemark和替换每一个\footnotetext。由于有多个脚注,您可以自动执行复制footnote计数器的过程:

\documentclass[oneside,a4paper]{book}

%draw
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{shapes.multipart}

\begin{document}

\begin{figure}[h!]
    \centering
    \resizebox{\textwidth}{!}{%
    \begin{tikzpicture}[text centered]
        \foreach \x in {-8, -7.4, -6.8, -6.2}
        \foreach \y in {1.8, 1.2, ..., -2.4}
            \draw[thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        \foreach \x in {7, 6.4, 5.8}
        \foreach \y in {0, -0.6, -1.2, -1.8}
            \draw[blue, thick] (\x,\y) rectangle (\x+0.5,\y+0.5);

        %\draw[red, thick] (-7.45, -0.05) rectangle (-5.65, -1.85);
        \draw[red, thick] (-6.85, -0.05) -- (-5.65, -0.05);
        \draw[red, thick] (-5.65, -0.05) -- (-5.65, -1.85);
        \draw[red, thick] (-5.65, -1.85) -- (-7.45, -1.85);
        \draw[red, thick] (-7.45, -1.85) -- (-7.45, -0.65);
        \draw[red, thick] (-7.45, -0.65) -- (-6.85, -0.65);
        \draw[red, thick] (-6.85, -0.65) -- (-6.85, -0.05);
        \draw[red, thick] (-8.05, 2.35) rectangle (-5.65, 1.75);
        \node (sprints) {Sprints};

        \newcounter{tfn}
        \stepcounter{footnote}
        \setcounter{tfn}{\value{footnote}}
        \draw[->,latex-,line width=0.1em] (175:5em) node[above left=1em and 0.5em] {Stand-up Meeting\footnotemark[\value{tfn}]\stepcounter{tfn}} arc (175:95:5em);
        \draw[->,latex-,line width=0.1em] (85:5em) arc (85:5:5em) node[above right=1em and 0.5em] {Development\footnotemark[\value{tfn}]\stepcounter{tfn}};
        \draw[->,latex-,line width=0.1em] (265:5em) arc (265:185:5em) node[below left=1em and 0.1em] {Retrospective\footnotemark[\value{tfn}]\stepcounter{tfn}};
        \draw[->,latex-,line width=0.1em] (355:5em) node[below right=1em and 0.5em] {Planning} arc (355:275:5em);

        \draw[->,-latex,line width=0.1em] +(-20em,-5em) -- +(-2em,-5em);
        \draw[->,-latex,line width=0.1em] +(2em,-5em) -- +(20em,-5em);

        \node (start) [below left=4.5em and 10em of sprints] {Spring Backlog};
        \node (end) [below right=4.5em and 10em of sprints] {Workable Release};
    \end{tikzpicture}
    }%
    \caption{Working flow}
\end{figure}
\footnotetext[\value{footnote}]{Daily}\stepcounter{footnote}
\footnotetext[\value{footnote}]{Sprint burn down}\stepcounter{footnote}
\footnotetext[\value{footnote}]{After each Sprint}\stepcounter{footnote}

\end{document}

您可能需要将每个额外的脚注\footnotemark[\value{tfn}]\stepcounter{tfn}放在适当的位置并\footnotetext[\value{footnote}]{<Text of the footnote>}\stepcounter{footnote}放在之后\end{figure}

相关内容