我使用 MacTex 2015 和 Texpad 作为 LaTeX 编辑器。当我尝试导入 tzik 包时
\usepackage{tikz}
出现以下3个错误
但奇怪的是,我的文档中的一切看起来都很好。
我的所有软件包也都是最新的。我是否必须导入其他软件包?有人遇到过同样的问题吗?
一份简短的文档(感谢 Zarko):
\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{caption}
\usepackage[english]{babel} % English language/hyphenation
\usepackage{mathtools} % Math packages
\usepackage{amsfonts} % Math packages
\usepackage{bm} % Math packages
\usepackage{array} % Math packages (and fixed column width)
\usepackage[UKenglish]{isodate}
%\cleanlookdateon % Remove ordinal day reference
\usepackage{secdot} % section title dots
\sectiondot{subsection} % subsection title dots
\sectiondot{subsubsection} % subsubsection title dots
\usepackage{grffile} % figure names with spaces
\usepackage{tikz} % block diagrams & control schemes
\usetikzlibrary{arrows,chains,positioning,calc}
\usepackage{sectsty} % Allows customizing section commands
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps
\usepackage[utf8x]{inputenc} %lettere accentate
\usepackage[boxed,linesnumbered,noresetcount]{algorithm2e} %algorithms
%\usepackage{ragged2e} %\justifying
\usepackage{subfigure} % subfigure
\usepackage{float} % stuck figures
\usepackage[labelfont=bf]{caption} %captions in bold
\usepackage{enumitem} % nested numbered lists
\usepackage{fancyhdr} % Custom headers and footers
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[
node distance = 21mm and 11mm,
start chain = going right,
place/.style = {rectangle, draw, thick, minimum size=6mm,
on chain}]
\node[place] (4) {Shrinked Dataset};
\node[place] (5) {Weighting Features};
\node[place] (1) {SVM Classifier};
\node[place] (2) {Model};
\node[place] (3) [below=of 1] {Performances (fitness) Evaluation};
\draw[-latex] (4) edge (5)
(5) edge (1)
(1) edge (2)
(2) edge (3);
\draw[-latex] (3) -- node[fill=white] {$p_i$} (5);
\draw[-latex] (3) -- node[fill=white] {$C$ and $\gamma$} (1);
\end{tikzpicture}
\caption{Step \#2 flowchart: SVM tuning with GA. This closed-loop will quit after a given number of generations has been created by the GA.}
\end{figure}
\end{document}
得到的图片:
错误日志:
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./mainCI15.tex
LaTeX2e <2016/02/01>
Babel <3.9o> and hyphenation patterns for 80 language(s) loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2015/10/03 v3.19a KOMA-Script document class (article)
(/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2015/10/03 v3.19a KOMA-Script package (loading files)
Copyright (C) Markus Kohm
))) (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2015/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2015/10/03 v3.19a KOMA-Script package (type area)
Copyright (C) Frank Neukam, 1992-1994
Copyright (C) Markus Kohm, 1994-
)) (/usr/local/texlive/2015/texmf-dist/tex/latex/base/fontenc.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/base/t1enc.def)) (/usr/local/texlive/2015/texmf-dist/tex/latex/caption/caption.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/caption/caption3.sty)) (/usr/local/texlive/2015/texmf-dist/tex/generic/babel/babel.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/babel-english/english.ldf (/usr/local/texlive/2015/texmf-dist/tex/generic/babel/babel.def))) (/usr/local/texlive/2015/texmf-dist/tex/latex/mathtools/mathtools.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/tools/calc.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/mathtools/mhsetup.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsopn.sty))) (/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/amsfonts.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/tools/bm.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/tools/array.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/isodate/isodate.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/substr/substr.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/isodate/english.idf
Define commands for English date format
)) (/usr/local/texlive/2015/texmf-dist/tex/latex/secdot/secdot.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/grffile.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifpdf.sty) (/usr/local/texlive/2015/texmf-dist/tex/generic/ifxetex/ifxetex.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/kvoptions.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ltxcmds.sty) (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/etexcmds.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))) (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/graphics.cfg) (/usr/local/texlive/2015/texmf-dist/tex/latex/pdftex-def/pdftex.def))) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def (/usr/local/texlive/2015/texmf-dist/tex/latex/ms/everyshi.sty
/usr/local/texlive/2015/texmf-dist/tex/latex/ms/everyshi.sty:95: Undefined control sequence.
l.95 \DeclareTextSy
)
/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def:113: Undefined control sequence.
<recently read> \EveryShipout
l.113 \EveryShipout
{%
/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def:145: LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.145 ...box\@cclv \else\hsize=\wd\@cclv \noindent
\unhbox\@cclv \fi%
) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/graphicx.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/color.cfg)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty)) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgffor.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/math/pgfmath.sty (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryarrows.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex) (/usr/local/texlive/2015/texmf-dist/tex/latex/sectsty/sectsty.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/base/inputenc.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/local/texlive/2015/texmf-dist/tex/latex/ucs/ucs.sty (/usr/local/texlive/2015/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/local/texlive/2015/texmf-dist/tex/latex/algorithm2e/algorithm2e.sty
(/usr/local/texlive/2015/texmf-dist/tex/latex/tools/xspace.sty) (/usr/local/texlive/2015/texmf-dist/tex/latex/relsize/relsize.sty)
答案1
您的 TikZ 图像代码有错误:您使用\draw [-latex] (4) -> (5);
而不是\draw [-latex] (4) -- (5);
。还缺少 TikZ 库arrow
。除此之外,请查看下一个图像代码是否对您有用:
\begin{tikzpicture}[
node distance = 21mm and 11mm,
start chain = going right,
place/.style = {rectangle, draw, thick, minimum size=6mm,
on chain}
]
\node[place] (4) {Shrinked Dataset};
\node[place] (5) {Weighting Features};
\node[place] (1) {SVM Classifier};
\node[place] (2) {Model};
%
\node[place] (3) [below=of 1] {Performances (fitness) Evaluation};
%
\draw[-latex] (4) edge (5)
(5) edge (1)
(1) edge (2)
(2) edge (3);
\draw[-latex] (3) -- node[fill=white] {$p_i$} (5);
\draw[-latex] (3) -- node[fill=white] {$C$ and $\gamma$} (1);
\end{tikzpicture}
它需要 Tikz 库chains
和positioning
,即在序言中你需要添加\usetikzlibrary{arrows,chains,positioning}
。上面的代码给出:
您可以在上面的评论中找到对 MWE 的其他评论。