图片下推自动机机制

图片下推自动机机制

在此处输入图片描述我正在尝试输入所附的图片。下面是我拥有的代码。我已将其下载到某处,尝试对其进行调整,但无法成功。谢谢。

\documentclass[12pt]{book}
\usepackage[paperwidth=16cm, paperheight=24cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\usepackage{tikz}

\usetikzlibrary{arrows,automata,matrix,positioning}

\begin{document}
                \begin{figure}
                    \centering
                        \def\a1
                            {%
                                \begin{tikzpicture}[node distance=0mm, every node/.style= 
                                    {
                                        draw,minimum size=8mm}]
                                        \node (deb) {Unité de contrôle finie};
                                        { 
                                            [start chain=1]
                                            \node [on chain] at (3,-2){$a$};
                                            \node [on chain] {$a$};
                                            \node [on chain] {$b$};
                                            \node [on chain] {$b$};
                                        }
                                        { [start chain=2 going below]
                                            \node [on chain] at (-2,-2){0};
                                            \node [on chain] {$x$};
                                            \node [on chain] {$y$};
                                            \node [on chain] {$z$};
                                        }
                                        \begin{scope}[->,>=latex']
                                            \draw (deb.east) -| (1-1);
                                            \draw (deb.south) |- (2-1.east);
                                        \end{scope}
                                \end{tikzpicture}
                            }
                            \a1 $\implies$ \a2
                \end{figure}
\end{document}[![enter image description here][1]][1]

根据 Js bibra 答案更新

\documentclass{minimal}

\usepackage{pgf}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{positioning}

\tikzset{
    state/.style={
        rectangle,
        rounded corners,
        draw=black, very thick,
        minimum height=2em,
        inner sep=2pt,
        text centered,
    },
}

\begin{document}
    
    \begin{tikzpicture}[->,>=stealth']
    
    % Position of QUERY 
    % Use previously defined 'state' as layout (see above)
    % use tabular for content to get columns/rows
    % parbox to limit width of the listing
    \node[state] (QUERY) 
    {\begin{tabular}{l}
        \parbox{4cm}{
\textvisiblespace
        }\\[4em]
        \parbox{4cm}{
        }
        \end{tabular}};
    
    % State: ACK with different content
    \node[state,        % layout (defined above)
    text width=3cm,     % max text width
    yshift=0cm,         % move 2cm in y
    right of=QUERY,     % Position is to the right of QUERY
    node distance=8.5cm,    % distance to QUERY
    anchor=center] (ACK)    % posistion relative to the center of the 'box'
    {%
        \begin{tabular}{l}  % content
        \textbf{Ack}\\
        \parbox{2.8cm}{Unit of control}
        \end{tabular}
    };
    
    % STATE QUERYREP
    \node[state,
    below of=ACK,
    yshift=-2cm,
    anchor=center,
    text width=3cm] (QUERYREP) 
    {%
        \begin{tabular}{l}
        \end{tabular}
    };

    % draw the paths and and print some Text below/above the graph
    \path 
    (QUERY)     ++(0,-4cm)node[anchor=left,below]{$Reading tape$}   edge[->]     (QUERY)
    (QUERY)     edge[]  node[anchor=right,above]{$Read one symbol as input$} (ACK)
        (ACK)           edge[]  node[anchor=right, above]{$Reading \quad tape \quad as \quad input$}  (ACK)
    (QUERYREP) ++(0,-2cm)node[anchor=left,below]{$stack$}   edge[->]     (QUERYREP)
    (QUERYREP)      edge[<->]                node[anchor=left,right]{$push pop$} (ACK);
    \end{tikzpicture}
\end{document}

答案1

与您的草图类似:

在此处输入图片描述

%\documentclass{article}
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, 
                positioning,
                shapes.multipart}



\begin{document}
    \begin{tikzpicture}[
            > = Straight Barb,
node distance = 9mm and 28mm,
  vmpn/.style = {shape=rectangle split, rectangle split parts=#1,
                 outer sep=0mm, align=left,
                 text width=28mm, draw, 
                 },
vmpn/.default = 5,
  boxr/.style = {rounded corners=2pt, draw, text width=28mm},
   lbl/.style = {font=\footnotesize, align=center}
                    ]
% QUERY
\node (n1)  [vmpn]  {\vphantom{x}\textvisiblespace};
% ACK
\node (n2)  [boxr,
             right=of n1.one east]  {\textbf{Ack}\\
                                     Unit of control};
% QUERYREP
\node (n3) [vmpn,
            below=of n2]            {\vphantom{x}};
% connection edges with labels
\draw[<-]   (n1.south)    -- ++ (0,-0.5) node[lbl,below] {Reading tape\\ as input};
\draw[->]   (n1.one east) -- node[lbl] {Read one\\ Symbol as input}
                             (n1.one east -| n2.west);
\draw[<->]  (n2.south) node[lbl,below right] {Push}
                          -- (n3.north) node[lbl,above right] {Pop};
\draw[<-]   (n3.south)    -- ++ (0,-0.5)
                        node[lbl,below] {Stack};
\draw[->]   (n2.east)    -- ++ (0.5,0)
                        node[lbl,right] {Accept or Reject};
    \end{tikzpicture}
\end{document}

答案2

为你指明正确方向的东西

在此处输入图片描述

\documentclass{minimal}

\usepackage{pgf}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{positioning}


\tikzset{
    state/.style={
        rectangle,
        rounded corners,
        draw=black, very thick,
        minimum height=2em,
        inner sep=2pt,
        text centered,
    },
}

\begin{document}
    
    \begin{tikzpicture}[->,>=stealth']
    
    % Position of QUERY 
    % Use previously defined 'state' as layout (see above)
    % use tabular for content to get columns/rows
    % parbox to limit width of the listing
    \node[state] (QUERY) 
    {\begin{tabular}{l}
        \textbf{Query}\\
        \parbox{4cm}{\begin{itemize}
            \item Start
            \item Parameter $Q$
            \item Zufallszahl aus \mbox{$[0, 2^Q-1]$} in Slotzähler $SC$
            \end{itemize}
        }\\[4em]
        \textbf{QueryAdjust}\\
        \parbox{4cm}{\begin{itemize}
            \item Variiere Q
            \item neue Zufallszahl
            \end{itemize}
        }
        \end{tabular}};
    
    % State: ACK with different content
    \node[state,        % layout (defined above)
    text width=3cm,     % max text width
    yshift=0cm,         % move 2cm in y
    right of=QUERY,     % Position is to the right of QUERY
    node distance=6.5cm,    % distance to QUERY
    anchor=center] (ACK)    % posistion relative to the center of the 'box'
    {%
        \begin{tabular}{l}  % content
        \textbf{Ack}\\
        \parbox{2.8cm}{Bestätigen mit $RN_{16}$}
        \end{tabular}
    };
    
    % STATE QUERYREP
    \node[state,
    below of=ACK,
    yshift=-2cm,
    anchor=center,
    text width=3cm] (QUERYREP) 
    {%
        \begin{tabular}{l}
        \textbf{QueryRep}\\
        \parbox{2.8cm}{Dekrementiere Slotzähler}
        \end{tabular}
    };
    

    
    % draw the paths and and print some Text below/above the graph
    \path 
    (QUERY)     edge[]  node[anchor=right,above]{$one symbol $} (ACK)
    (QUERYREP) ++(0,-2cm)node[anchor=left,below]{$stock$}   edge[->]     (QUERYREP)
    (QUERYREP)      edge[<->]                node[anchor=left,right]{$push pop$} (ACK);
    
    \end{tikzpicture}
    

\end{document}

相关内容