tikz 图形中的块错误

tikz 图形中的块错误
\begin{figure}[H] \centering 
\begin{tikzpicture}[node distance = 1cm, auto] 
\node [block] (cipher) {Cifertekst}; 
\node [block,above left=of cipher,label={left:A}] (plaininput) {Klartekst}; 
\node [block,above right=of cipher] (encrypt) {Kryptering}; 
\node [block,below left=of cipher] (decrypt) {Dekryptering}; 
\node [block,below right=of cipher,label={right:B}] (plainoutput) {Klartekst};

    \draw[->] (plaininput) -- (encrypt);
    \draw[->] (encrypt) |- (cipher);
    \draw[->] (cipher) -| (decrypt);
    \draw[->] (decrypt) -- (plainoutput);
\end{tikzpicture}
\caption{Grundlæggende kryptering}
\label{fig:grundlæggende kryptering}
\end{figure} 

不知怎的,我在编译时似乎收到这个错误:“我不知道键‘/tikz/block’

答案1

你想要这样的东西吗?

块

我添加了一个样式

block/.style={draw}

来实现这一点。以下是完整代码:

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[node distance = 1cm, auto, block/.style={draw}]
  \node [block] (cipher) {Cifertekst};
  \node [block, above left = of cipher, label = {left:A}] (plaininput) {Klartekst};
  \node [block, above right = of cipher] (encrypt) {Kryptering};
  \node [block, below left = of cipher] (decrypt) {Dekryptering};
  \node [block, below right = of cipher, label = {right:B}] (plainoutput) {Klartekst};

  \draw[->] (plaininput) -- (encrypt);
  \draw[->] (encrypt) |- (cipher);
  \draw[->] (cipher) -| (decrypt);
  \draw[->] (decrypt) -- (plainoutput);
\end{tikzpicture}
\end{document}

相关内容