“包 pgf 错误:没有已知的名为‘c’的形状。}”

“包 pgf 错误:没有已知的名为‘c’的形状。}”

错误:
包 pgf 错误:没有已知的名为“c”的形状。}
包 pgf 错误:没有已知的名为“e”的形状。}
包 pgf 错误:没有已知的名为“ ”的形状。}

\documentclass[a4paper,12pt]{report}

\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfkeys}

\usetikzlibrary{fit,arrows,tikzmark,shadows,decorations.pathreplacing,calc,automata}

\begin{document}

\tikzstyle{line} = [-stealth, very thick, draw]

\tikzset{label/.style={draw=gray, thick, rounded corners=.25ex, fill=gray!20,text width=4cm, text badly centered,  inner sep=2ex, anchor=east, minimum height=4em}}

\begin{figure}[!htb]
    \centering
    \resizebox{\textwidth}{!}{
        \begin{tikzpicture}[node distance=6cm,auto]
            \node [label] (b) {DTMF Decoder Module};
            \node [label] (a) at ([yshift=-3cm]$(c)!1.0!(e)$) {Mobile Phone} ();
            \node [label, right of=b] (c) {Microcontroller};
            \node [label] (d) at ([yshift=3cm]$(b)!1.4!(c)$) {LCD Display};
            \node [label, right of=c] (e) {Relay Module};
            \node [label] (f) at ([yshift=-3cm]$(c)!1.4!(e)$) {Solenoid Actuator};
            \path [line] (a) -- (b);
            \path [line] (b) -- (c);
            \path [line] (c) -- (d);
            \path [line] (c) -- (e);
            \path [line] (e) -- (f);
        \end{tikzpicture} 
    }
    \caption{Block Diagram 1}
    \label{fig:bd1}
\end{figure}
\end{document}

答案1

正如 @daleif 所说,编辑问题也解决了我的问题

\documentclass[a4paper,12pt]{report}

\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfkeys}

\usetikzlibrary{fit,arrows,tikzmark,shadows,decorations.pathreplacing,calc,automata}

\begin{document}

\tikzstyle{line} = [-stealth, very thick, draw]

\tikzset{label/.style={draw=gray, thick, rounded corners=.25ex, fill=gray!20,text width=4cm, text badly centered,  inner sep=2ex, anchor=east, minimum height=4em}}

\begin{figure}[!htb]
    \centering
    \resizebox{\textwidth}{!}{
        \begin{tikzpicture}[node distance=6cm,auto]
            \node [label] (b) {DTMF Decoder Module};
            \node [label, right of=b] (c) {Microcontroller};
            \node [label] (d) at ([yshift=3cm]$(b)!1.4!(c)$) {LCD Display};
            \node [label, right of=c] (e) {Relay Module};
            \node [label] (a) at ([yshift=-3cm]$(c)!1.0!(e)$) {Mobile Phone} ();
            \node [label] (f) at ([yshift=-3cm]$(c)!1.4!(e)$) {Solenoid Actuator};
            \path [line] (a) -- (b);
            \path [line] (b) -- (c);
            \path [line] (c) -- (d);
            \path [line] (c) -- (e);
            \path [line] (e) -- (f);
        \end{tikzpicture} 
    }
    \caption{Block Diagram 1}
    \label{fig:bd1}
\end{figure}
\end{document}

答案2

我只是通过替换这样的代码来消除错误:(输出相同没有区别)

\documentclass[a4paper,12pt]{report}

\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfkeys}

\usetikzlibrary{fit,arrows,tikzmark,shadows,decorations.pathreplacing,calc,automata}

\begin{document}

\tikzstyle{line} = [-stealth, very thick, draw]
\tikzstyle{block} = [draw=gray, thick, rounded corners=.25ex, fill=gray!20,text width=4cm, text badly centered,  inner sep=2ex, anchor=east, minimum height=4em]

\begin{figure}[!htb]
    \centering
    \resizebox{\textwidth}{!}{
        \begin{tikzpicture}[node distance=6cm,auto]
            \node [block] (b) {DTMF Decoder Module};
            \node [block, below of=b, yshift=8.0em] (a) {Mobile Phone};
            \node [block, right of=b] (c) {$Microcontroller$} ;
            \node [block, above of=c, yshift=-8.0em] (d) {LCD Display};
            \node [block, right of=c] (e) {Relay Module};
            \node [block, below of=e, yshift=8.0em] (f) {Solenoid Actuator};
            \path [line] (a) -- (b);
            \path [line] (b) -- (c);
            \path [line] (c) -- (d);
            \path [line] (c) -- (e);
            \path [line] (e) -- (f);
        \end{tikzpicture} 
    }
    \caption{Block Diagram 1}
    \label{fig:bd1}
\end{figure}

\end{document}

相关内容