我正在使用 TikZ 包制作流程图。我收到以下错误:Package PGF Math Error: Unknown operator c' or
c@' (in '1c'). \node (in1) [input] {node};
我不明白错误指的是什么。这是我的代码:
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{question} = [rectangle, minimum width=3cm, minimum height=1cm,text centered, draw=black]
\tikzstyle{diagnosis} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\tikzstyle{input} = [diamond, minimum width=3cm, minimum height=1c, text centered, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{tikzpicture}[node distance=2cm]
\node (in1) [input] {node};
\node (q1) [question, below of=in1] {Matches distractor node?};
\draw [arrow] (in1) -- (q1);
\end{tikzpicture}
答案1
你的文风有点问题input
。你写错了minimum height=1c
。我想你的意思是minimum height=1cm
:
\tikzstyle{input} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black]
此外,正如 marmot 先生所说,\tikzstyle
语法有点令人沮丧,应替换为\tikzset
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzset{%
question/.style={rectangle, minimum width=3cm, minimum height=1cm,text centered, draw=black},
% \tikzstyle{question} = [rectangle, minimum width=3cm, minimum height=1cm,text centered, draw=black]
diagnosis/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black},
% \tikzstyle{diagnosis} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black]
input/.style={diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black},
% \tikzstyle{input} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black]
arrow/.style={thick,->,>=stealth}
% \tikzstyle{arrow} = [thick,->,>=stealth]
}
\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node (in1) [input] {node};
\node (q1) [question, below of=in1] {Matches distractor node?};
\draw [arrow] (in1) -- (q1);
\end{tikzpicture}
\end{document}
我保留了以前的语法以便进行比较。