几何 tikz 库存在故障排除...据说 tikz 库找不到几何库?

几何 tikz 库存在故障排除...据说 tikz 库找不到几何库?

=>这是我的代码......

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,geometric,arrows}


\tikzstyle{startstop} = [rectangle, draw, text width=13cm, text centered, rounded corners, minimum height=1em]
\tikzstyle{io}  = [trapezium, draw, text width=3.5cm, text centered, minimum height=1em]
\tikzstyle{process} = [rectangle, draw, text width=5cm, text centered, minimum height=1em]
\tikzstyle{decision} = [diamond, draw, text width=3.5cm, text centered, minimum height=1em]
\tikzstyle{arrow}=[thick,->,>=stealth]
\begin{document}
\begin{tikzpicture}[node distance=2cm]
%middle boxes
\node(Start)[startstop]{start};
\node(in1)[io,below of=start]{Read fingerprint,distance,date,time};
\node(pro1)[process,below of=in1]{Result=new ValidationResult()};
\node(pro2)[process,below of=pro1]{Generate template from fingerprint};
\node(pro3)[process,below of=pro2]{Search local storage for a matching template};
\node(dec1)[decision,below of=pro3,yshift=-1cm]{Match exists?};
\node(pro2a)[process,left of=dec1,xshift=-2cm,yshift=-2cm]{Details <- helpPost(server,fingerprint)};
\node(pro2b)[process,right of=dec1,xshift=5cm,yshift=-2cm]{Update the pending transaction==matching file name with the current as exit details};
\node(pro3a)[process,below of=pro2b,xshift=1em]{Queue transaction for insertion in the database};
\node(pro3b)[process,below of=pro3a,xshift=1cm]{};
\node(dec2) [decision,below of=pro2a,yshift=-1cm]{Details=Null?};
\node(pro4a)[process,left of=dec2,xshift=-2cm,yshift=-1.5cm]{Result=ValidateUser(details)};
\node(pro4b)[process,right of=dec2,xshift=1cm,yshift=-1.5cm]{Result=Result.Unknown};
\node(dec3)[decision,below of=pro4a,yshift=-1cm]{Result=Result.valid?};
\node(pro5a)[process,left of=dec3,yshift=-1cm]{Store the fingerprint template in the local file system};




\end{tikzpicture}

\end{document}

答案1

应该是shapes.geometric,而不是shapes,geometric。句号,而不是逗号。

您也可以说只是shapes,我认为它会加载所有不同的shape库。

关于您的图表的其他一些评论:

  • 您需要\usepackage[T1]{fontenc}正确<呈现。

  • 您已将第一个节点命名为Start,但下一个节点是相对于 放置的start,因此会引发错误。节点名称区分大小写。

  • 您使用的语法<position> of=<othernode>实际上已被弃用,建议加载positioning库并使用<position>=of <othernode>。请参阅PGF/TikZ 中“right of=”和“right=of”之间的区别

    如果您希望计算节点中心点之间的节点距离,请将该on grid选项添加到节点设置中。

  • 通常还建议使用

    \tikzstyle{<stylename>/.style={<settings>}}
    

    代替

    \tikzstyle{<stylename>}=[<settings>]
    

    应该\tikzset或被\tikzstyle用来定义 TikZ 样式吗?进行一些讨论。

  • 除了 eg 之外,xshift还有一种替代方法是写 egyshiftbelow=of ..

    below left=1cm and 3cm of someothernode
    

    第一个值(1cm)是垂直距离,第二个值(3cm)是水平距离。

  • 你的图表是远的对于标准页面来说太宽了,所以你需要压缩它。例如,通过减少节点之间的空间、减少text widths 和减小字体大小。我在这里做了所有这些,现在图表适合标准article页面的边距。

    但看起来你还没有完全完成,所以你可能需要进行更多的调整。

代码输出

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{
  shapes.geometric,
  positioning 
}

\tikzset{
  startstop/.style={rectangle, draw, text width=7cm, text centered, rounded corners, minimum height=1em},
  io/.style={trapezium, draw, text width=1.5cm, text centered, minimum height=1em},
  process/.style={rectangle, draw, text width=3cm, text centered, minimum height=1em]},
  decision/.style={diamond, draw, text width=1.2cm, text centered, minimum height=1em},
  arrow/.style={thick,->,>=stealth}
}
\begin{document}
\begin{center}
\begin{tikzpicture}[
  node distance=3mm and 1mm,
  every node/.append style={font=\scriptsize} % reduce font size of all nodes
]
%middle boxes
\node [startstop]                       (start) {start};
\node [io,below=of start]               (in1)   {Read fingerprint, distance, date, time};
\node [process,below=of in1]            (pro1)  {Result = new ValidationResult()};
\node [process,below=of pro1]           (pro2)  {Generate template from fingerprint};
\node [process,below=of pro2]           (pro3)  {Search local storage for a matching template}; 
\node [decision,below=of pro3]          (dec1)  {Match exists?};
\node [process, 
       below left=1cm and 1mm of dec1]  (pro2a) {Details <- helpPost(server,fingerprint)};
\node [process,
       below right=1cm and 2cm of dec1] (pro2b) {Update the pending transaction == matching file name with the current as exit details};
\node [process,below=of pro2b]          (pro3a) {Queue transaction for insertion in the database};
\node [process,below=of pro3a]          (pro3b) {};
\node [decision,below=1cm of pro2a]     (dec2)  {Details = Null?};
\node [process,
       below left=1cm and 1mm of dec2]  (pro4a) {Result = ValidateUser(details)};
\node [process,
       below right=1cm and 1mm of dec2] (pro4b) {Result = Result.Unknown};
\node [decision,below=of pro4a]         (dec3)  {Result = Result.valid?};
\node [process,below=of dec3]           (pro5a) {Store the fingerprint template in the local file system};
\end{tikzpicture}
\end{center}

\end{document}

相关内容