3

This is my tikz code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.geometric,arrows,fit,calc,positioning,automata,}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[t]
\centering
\begin{subfigure}{.5\textwidth}
  \centering
  \begin{tikzpicture}[shorten >=1pt,auto,node distance=5 cm, scale = 0.4, transform shape]
\tikzstyle{int}=[draw, minimum size=4em]
\tikzset{every edge/.append style={font=\Large}}
\tikzset{every node/.append style={font=\Large}}

  \node[initial,state] (A)                                  {$q_0$};
  \node[state]         (B) [right of=A]                 {$q_1$};
  \node[state]         (C) [right of=B,node distance = 8 cm]        {$q_2$};
  \coordinate [right=4cm of B] (b1) {};
  \node[state]         (D) [below of =b1,node distance = 5 cm]              {$q_3$};
  \node[state]         (E) [below  of=C,node distance = 10 cm]                  {$q_5$};
  \node[state]         (F) [below  of=B,node distance = 10 cm]                  {$q_4$};
  \node[int]           (G) [left of=F]                  {Sender for seq. no. $1$};

  \path[->] (A) edge [above]        node [align=center]         {$+ \rightarrow$ \\ $[x = 0]$} (B)
        (B) edge [loop above]   node [align=center]             {$0 \rightarrow$ \\ $[x = x.1]$ }   (B)
        edge [bend right,above] node [align=center]         {$1 \rightarrow$ \\ $[x = x.1]$ }   (C)
        edge [left]         node [align=center]         {$\$  \rightarrow$ \\  $[x = x.0.\mathbf 0.\#]$ } (D)
    (C) edge [loop above]       node [align=center]         {$0 \rightarrow$ \\ $[x = x.0]$ }   (C)
            edge [bend right,right]     node [above,align=center]       {$1 \rightarrow$ \\ $[x = x.0]$}   (B)
        edge [above]            node [pos=0.6,align=center]         {$\$ \rightarrow$\\ $[x = x.1.\mathbf 1.\#]$ } (D)
    (D) edge [bend left,right]  node [pos=0.25,align=center]            {$0 \rightarrow$ \\ $[x = x.0]$} (E)
        edge [bend left,right]  node [pos=0.85,align=center]        {$1 \rightarrow$ \\ $[x = x.1]$} (F)
    (E) edge [bend left,above]  node [pos=0.45,align=center]        {$0,1 \rightarrow$ \\ $[w = w.3.\#.1.\$]$} (D)
    (F) edge [bend left,left]   node [pos=0.5,align=center]     {$0 \rightarrow$ \\ $[w = w.2.\#.3.\$]$} (D)
        edge [above]        node [align=center]         {$1 \rightarrow$ \\ $\begin{bmatrix} w = w.y\\x = \epsilon \end{bmatrix}$} (G)
    (G) edge [right]        node [align=center]         {${ack}_{0} \rightarrow$ \\ $\begin{bmatrix} w = w.s\\x = x \end{bmatrix}$} (A);



\end{tikzpicture}
  \caption{fig 1}
  \label{fig:1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
  \begin{tikzpicture}[shorten >=1pt,auto,node distance=5.5 cm, scale = 0.4, transform shape]
\tikzset{every edge/.append style={font=\Large}}
\tikzset{every node/.append style={font=\Large}}
%  \tikzstyle{every state}=[fill=white,draw=none,text=black]
  \node[initial,state] (E)                  {$r_0$};
  \node[state]         (A) [below left of=E]            {$r_1$};
  \node[state]         (B) [below right of=E]           {$r_2$};
  \node[state]         (C) [below of=A]             {$r_3$};
  \node[state]         (D) [below of=B]             {$r_4$};


  \path[->] (E) edge  [left]        node [pos = 0.3,align=center]           {$0 \rightarrow$\\$[y = y.1]$} (A)
        (E) edge  [right]       node [pos = 0.3,align=center]           {$1 \rightarrow$\\$[y = y.0]$} (B)
        (A) edge  [loop left]   node [align=center]         {$0 \rightarrow$\\$[y = y.2]$} (A)
        (A) edge  [bend left, above]    node [align=center]     {$1 \rightarrow$\\$[y = y.3]$} (B)
        (A) edge  [bend right, left]    node [align=center]     {$\# \rightarrow$\\$[y = y.0]$} (C)
        (B) edge  [loop right]  node [align=center]         {$0 \rightarrow$\\$[y = y.2]$} (B)
        (B) edge  [bend left, above]    node [align=center]         {$1 \rightarrow$\\$[y = y.3]$} (A)
        (B) edge  [bend left, right]    node [pos = 0.5,align=center]       {$\# \rightarrow$\\$[y = 2]$} (D)
        (C) edge  [loop left]   node [align=center]         {$0 \rightarrow$\\$[y = 3]$} (C)
        (C) edge  [bend left, below]    node [align=center]         {$1 \rightarrow$\\$[y = 2]$} (D)
        (C) edge  [right]   node [pos = 0.25,align=center]      {$\$ \rightarrow$\\$\begin{bmatrix} y = 3\\z = z.x.\$\end{bmatrix}$} (E)
        (D) edge  [loop right]  node [align=center]         {$0 \rightarrow$\\$[y = 4]$} (D)
        (D) edge  [bend left, below]    node [align=center]         {$1 \rightarrow [y = 5]$} (C)
        (D) edge  [left]    node [pos = 0.25,align=center]      {$\$ \rightarrow$\\$\begin{bmatrix}y = \epsilon\\ z = 3\end{bmatrix}$} (E) ;
\end{tikzpicture}
  \caption{fig 2}
  \label{fig:1}
\end{subfigure}
\caption{Figure}
\label{fig:modeling}
\end{figure}



\end{document}

This is the output:

enter image description here

I have some questions:

  1. How to vertically align the captions fig1 and fig2?

  2. The figure looks too dense. Any suggestions on making it more (ans easily) readable? I don't have extra space, so I have to put them side by side.

  3. The format doesn't support subcaption package, as it gives a warning on compilation. Any alternative for that? But I want it to be one figure. I can't use minipage as it makes it two independent figures. I don't want that. I want one figure with two subfigures (a) and (b).

marked as duplicate by Qrrbrbirlbel, Heiko Oberdiek, Xavier, T. Verron, lockstep Jun 27 '13 at 3:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.