由于我的 Tikz 图中定义的标签,“图形列表”的序列未定义

由于我的 Tikz 图中定义的标签,“图形列表”的序列未定义

我得到了一些 Tikz 图,并将它们包含在我的 LaTeX 源中。这些 Tikz 图包含\label{labelnamel}我随后在图表标题中使用的内容:

 \begin{figure} 
 \input{Figs/tikzplot.tex}
 \caption{plot a \ref{labenameA}. plot b \ref{labelnameB} }
 \end{figure}

现在,当我的 LaTeX 项目尝试制作图形列表时,出现错误:

我收到错误,它有未定义的序列(\pgfplots@show@ref@labelnameA),它直接引用与我的 Tikz 中的标签相对应的序列。我可以从我的 PDF 文件中看到表格无法理解该引用是什么。我有时甚至在我的标题中\ref看到\cite作品非常适合数字列表。

最小示例


\documentclass[a4paper]{report}
% Some useful packages for including images, colored font, etc.
\usepackage[dvips]{graphicx}
\usepackage{listings}
\usepackage{color}
\usepackage{url}


\RequirePackage{natbib}
% Global bibliography style


% Set margins in all document to 3.5cm as per guidelines for binding
\usepackage[includeheadfoot,margin=3.5cm]{geometry}
\usepackage{pdfpages}
\usepackage{fancyhdr}
\pagestyle{fancyplain}
\usepackage{titlesec}
\linespread{1.3}
\fancyhf{}
\lhead{\leftmark}
% Center on all pages
\fancyhead[C]{---Draft---}
% Page number placed on right side on odd pages and left side on even pages
\fancyfoot[RO, LE] {\thepage}
\usepackage{amsmath} % required by declare math operator
\usepackage[capitalise]{cleveref} %Referencing without need to explicitly state fig /table
% TIKZ
\usepackage{pgfplots,filecontents}
\usepackage{tikzscale}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\pgfplotsset{plot coordinates/math parser=false}
\newlength\fheight
\newlength\fwidth 
%to color a row by using \rowcolor{gray}
\usepackage{color, colortbl}
%define light gray
\definecolor{lightGray}{gray}{0.9}
%% language algo
\usepackage{listings}
\usepackage{subcaption}
\usepackage[ruled,vlined]{algorithm2e}
\begin{document}
% Set page numbers to roman numerals for front matter
\pagenumbering{roman}
% Include a list of figures
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
% Set page numbering to arabic for body of Thesis
\pagenumbering{arabic}
% For example
\chapter{Test}
\begin{figure}[t] 
    \setlength\fheight{0.5\columnwidth}
    \setlength\fwidth{0.4\columnwidth}
    \centering
    %   
    \input{nitvali_all}
    %   
    %
    \caption{
        (\ref{ref1}) reef1
        (\ref{ref2}) reef2}
    \label{fig:validation}
    %
\end{figure} 
\end{document}

Tikz文件nitvali_all.tex


% This file was created by tikzplotlib v0.9.1.
\begin{tikzpicture}

\begin{groupplot}[group style={group size=1 by 1}]

\nextgroupplot[
height=\fheight,
%legend cell align={left},
%legend columns=4,
%legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black,at={(-1, 1.10)}, anchor=north},
tick align=outside,
tick pos=left,
title={(c): Case 3},
width=\fwidth,
x grid style={white!69.0196078431373!black},
xlabel={Time [ms]},
xmajorgrids,
xmin=0, xmax=8.2,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ymajorgrids,
ymin=0, ymax=12.8,
ytick style={color=black}
]
\addplot [semithick, black, mark=*, mark size=1.5, mark options={solid}, only marks]
table {%
7.50304269790649 8.61112403869629
7.73022317886353 8.7830286026001
7.98580121994019 8.92600917816162
}; \label{ref1}
\addplot [semithick, black, mark=square*, mark size=1.5, mark options={solid}, only marks]
table {%
0.0701577663421631 0.345906138420105
0.106774091720581 0.548678278923035
0.216410160064697 0.89439582824707
};\label{ref2}
\end{groupplot}

\end{tikzpicture}


相关内容