使用编译简单示例时\addplot
我得到的是简单示例。例如,以下是其文档中一个示例的改编版(来自以下代码:http://pgfplots.sourceforge.net/gallery.html,尽管完整文件对于文档中的图像也会产生同样的错误)
\documentclass[tikz]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=Cost,
ylabel=Error]
\addplot[color=red,mark=x] coordinates {
(2,-2.8559703)
(3,-3.5301677)
(4,-4.3050655)
(5,-5.1413136)
(6,-6.0322865)
(7,-6.9675052)
(8,-7.9377747)
};
\end{axis}
\end{tikzpicture}
\end{document}
运行此操作会导致错误:
! Illegal parameter number in definition of \pgfmaththisrow@.
<to be read again>
1
l.18 };
?
! Illegal parameter number in definition of \pgfmaththisrowno@.
<to be read again>
1
l.18 };
?
基本示例引发错误这一事实表明我的 pgfplots 安装已损坏,但我已经从头开始重新安装了最新的 MiKTeX (2.9.6753 x64),并从其包管理器中引入了最新版本的 pgfplots (打包日期为 2018 年 4 月 8 日),以尝试解决此问题。我还尝试使用 pgfplot 命令的各种最新版本号,\pgfplotsset{compat=1.16}
但没有任何效果。
我应该做什么才能让它正常工作?
编辑:这是完整的日志文件。
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6745 64-bit)
entering extended mode
(C:/Users/Owner/scipy-articles/scipy-1.0/demo.tex
LaTeX2e <2018-04-01> patch level 5
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\standalone\standalone.cls
Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan
dalone
("C:\Program Files\MiKTeX 2.9\tex\latex\tools\shellesc.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\xkeyval\xkeyval.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkvutils.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\keyval.tex"))))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\standalone\standalone.cfg)
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\frontendlayer\tikz.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\basiclayer\pgf.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\utilities\pgfrcs.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfutil-co
mmon.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfutil-co
mmon-lists.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfutil-la
tex.def (C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\ms\everyshi.sty))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfrcs.cod
e.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\basiclayer\pgfcore.sty
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\graphics.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-def\pdftex.def")))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\systemlayer\pgfsys.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgfsys.c
ode.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfkeys.co
de.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfkeysfil
tered.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgf.cfg)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgfsys-p
dftex.def
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgfsys-c
ommon-pdf.def)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgfsysso
ftpath.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\systemlayer\pgfsyspr
otocol.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\xcolor\xcolor.sty
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\color.cfg"))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcore.c
ode.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmath.code.te
x
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathcalc.cod
e.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathutil.cod
e.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathparser.c
ode.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.basic.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.trigonometric.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.random.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.comparison.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.base.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.round.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.misc.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfunction
s.integerarithmetics.code.tex)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmathfloat.co
de.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorepo
ints.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorepa
thconstruct.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorepa
thusage.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoresc
opes.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoregr
aphicstate.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoretr
ansformations.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorequ
ick.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoreob
jects.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorepa
thprocessing.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorear
rows.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoresh
ade.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoreim
age.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoreex
ternal.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorela
yers.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcoretr
ansparency.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\basiclayer\pgfcorepa
tterns.code.tex)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\modules\pgfmodulesha
pes.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\modules\pgfmoduleplo
t.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\compatibility\pgfcomp-
version-0-65.sty)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\compatibility\pgfcomp-
version-1-18.sty))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\utilities\pgffor.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\utilities\pgfkeys.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgfkeys.co
de.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgf\math\pgfmath.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmath.code.te
x))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\utilities\pgffor.cod
e.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\math\pgfmath.code.te
x)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\t
ikz.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\libraries\pgflibrary
plothandlers.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\modules\pgfmodulemat
rix.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\l
ibraries\tikzlibrarytopaths.code.tex))))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\latex\pgfplots\pgfplots.sty
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.revisi
on.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.code.t
ex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotscore.co
de.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\sys\pgfplotssys
generic.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\libs\pgfplotsli
brary.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\oldpgfcompatib\
pgfplotsoldpgfsupp_loader.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\libraries\pgflibrary
fpu.code.tex)
Package pgfplots: loading complementary arithmetics for your pgf version...
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\oldpgfcompatib\
pgfplotsoldpgfsupp_pgflibraryfpu.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\oldpgfcompatib\
pgfplotsoldpgfsupp_pgfmathfloat.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\oldpgfcompatib\
pgfplotsoldpgfsupp_trig_format.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\oldpgfcompatib\
pgfplotsoldpgfsupp_leq.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsut
il.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\liststructure\p
gfplotsliststructure.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\liststructure\p
gfplotsliststructureext.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\liststructure\p
gfplotsarray.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\liststructure\p
gfplotsmatrix.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\numtable\pgfplo
tstableshared.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\liststructure\p
gfplotsdeque.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsbi
nary.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsbi
nary.data.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsut
il.verb.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\libs\pgflibrary
pgfplots.surfshading.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\sys\pgflibraryp
gfplots.surfshading.pgfsys-pdftex.def)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsco
lormap.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\util\pgfplotsco
lor.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotsstacked
plots.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotsplothan
dlers.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotsmeshplo
thandler.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotsmeshplo
timage.code.tex)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.scalin
g.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotscoordpr
ocessing.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.errorb
ars.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.marker
s.code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplotsticks.c
ode.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgfplots\pgfplots.paths.
code.tex)
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\l
ibraries\tikzlibrarydecorations.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\modules\pgfmoduledec
orations.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\l
ibraries\tikzlibrarydecorations.pathmorphing.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\libraries\decoration
s\pgflibrarydecorations.pathmorphing.code.tex))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\l
ibraries\tikzlibrarydecorations.pathreplacing.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\libraries\decoration
s\pgflibrarydecorations.pathreplacing.code.tex)))
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\l
ibraries\tikzlibraryplotmarks.code.tex
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\generic\pgf\libraries\pgflibrary
plotmarks.code.tex)))
No file demo.aux.
ABD: EveryShipout initializing macros
(C:\Users\Owner\AppData\Roaming\MiKTeX\2.9\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) ("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvdefinekeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty")))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty")))
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"))
Package pgfplots notification 'compat/show suggested version=true': document ha
s been generated with the most recent feature set (\pgfplotsset{compat=1.16}).
! Illegal parameter number in definition of \pgfmaththisrow@.
<to be read again>
1
l.18 };
?
答案1
第二次完全重新安装后,错误消失。我最好的猜测是,在我最近的重新安装中,卸载旧版本的 MiKTeX 时遗留了一些文件。卸载当前版本时,请确保正确删除文件(或如果您使用的是 32 位版本,C:/Program Files/MiKTeX 2.9
则为等效目录)和(您的用户名在哪里)。Program Files (x86)
C:/Users/%USERNAME%/AppData/Roaming/MiKTeX
%USERNAME%