为什么我会收到这些 pgfkeys 错误?

为什么我会收到这些 pgfkeys 错误?

突然,大多数图表都没有出现在文档中,第一个错误是

! package pgfkeys error: choice '1.8' unknown in key '/pgfplots/compat/anchors' 

另一个错误:

! package pgfkeys error: choice '1.8' unknown in key '/pgfplots/compat/labels' 

另一个:

! package pgfkeys error: choice '1.8' unknown in key '/pgfplots/compat/empty line' 

问题出在哪里?我在 Windows 上使用 Texnic Center,以下是完整代码

\documentclass{ecsminithesis}  % Use the minithesis Style
\graphicspath{{F:\PhD\Latex}}   % Location of your graphics files
\usepackage{placeins}
\usepackage[utf8]{inputenc}
\usepackage[square,compress]{natbib}            % Use Natbib style for the refs.
%% \removecolourlinks    % Uncomment this command to remove colour from any links

\usepackage{multirow}
\usepackage{tikz}
\usepackage{booktabs}         %to use \toprule and \bottomrule without error message
\usepackage{pgfplots}         %to plot figure
\usepackage{threeparttable}  
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{booktabs}         %to use \toprule and \bottomrule without error message
\usepackage{pgfplots}   
\pgfplotsset{compat=1.9}
\usepackage{subfigure}        % to add subfigures
\usepackage{graphics}
\usepackage{gensymb}
\usepackage[none]{hyphenat}  %to prevent word breaking
\usepackage{siunitx}
\usepackage{caption}
\usepackage{booktabs} 
\newcommand*{\head}[1]{\textbf{#1}}%  to make heads of table in BOLD, it is used with booktabs package and \head
\usepackage{cleveref}
\usepackage{url} \makeatletter \g@addto@macro{\UrlBreaks}{\UrlOrds} \makeatother
\usepackage[justification=centering]{caption}
\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}
\usepackage{float}
\input{Definitions}            % Include your abbreviations
%% ----------------------------------------------------------------


\begin{document}
\frontmatter
\title      {Assessment of the Effectiveness of Fuel Cells as an Alternative Technology for Marine Propulsion Systems}
\authors    {\texorpdfstring
             {\href{mailto:[email protected]}{Ameen Bassam}}
             {Ameen Bassam}
            }
\department  {Engineering and the Environment}
\group       {Fluid Structure Interactions}
\addresses  {\groupname\\\deptname\\\univname}
\date       {\today}
\subject    {}
\keywords   {}
%\supervisor {Mr Beavis}
%\examiner   {Dr Butthead}
\maketitle

\begin{abstract}
\end{abstract}

\tableofcontents

\listoffigures

\listoftables

%% -----------------------
%% lstpatch.sty
%% -----------------------
%% lstpatch cannot be distributed with these files. I believe it is only needed if the
%% \lstlistoflistings is used. So this has been turned off by default. Re-add if required:
%% \usepackage{lstpatch}
%% \lstlistoflistings
%% You will need to download lstpatch, possibly from:
%% http://web.mit.edu/texsrc/source/latex/listings/lstpatch.sty
%% -----------------------



%\acknowledgements{Thanks to no one.}
\include{Nomenclature}
\mainmatter
%% ----------------------------------------------------------------
\include{Introduction}
\include{Chapter2}
\include{Chapter3}
\include{Chapter4}
\include{Chapter5}
\include{Conclusions}
\include{Future}
\appendix
\include{AppendixI}
\backmatter
\bibliography{references}
\bibliographystyle{ieeetr}
\end{document}
%% ----------------------------------------------------------------

答案1

此错误消息表明您的 pgfplots 版本早于 1.8 。根据您的调查,它是 1.5.1 。

这意味着你有两个选择:

  1. 升级 pgfplots。撰写本文时,当前稳定版本为 1.12.1。

  2. 将您的文件更改为包含。与使用和 的compat=1.5旧结果相比,这可能会导致略有不同的结果,但通常应该没问题。compat=1.8pgfplots 1.8

我建议pgfplots使用你的 TeX 包管理器进行升级。

答案2

正如其他人已经提到的,您应该更新此包。在终端中,您可以运行以下命令(可能需要几分钟):

$ sudo tlmgr update --self
$ sudo tlmgr update pgfplots

相关内容