3

How can I draw this figure centered within the following code

\documentclass{exam}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{txfonts}
\usepackage{url}\urlstyle{sf}
\usepackage[plain]{algorithm}
\usepackage {tikz}
\begin{document}
  \begin{parts}
    \part \begin{tikzpicture}
       \node[rectangle,minimum width=2cm,minimum height=5cm] (m) {
       \begin{minipage}{1.95cm}
          \begin{tikzpicture}
            \draw (0,5) node[minimum width=0.9cm, minimum height=0.9cm,draw] {$a$};
            \draw (0,5) -> (1,5) node[minimum width=0.9cm, minimum height=0.9cm] {$a$};
          \end{tikzpicture}
        \end{minipage}
      };
      \draw[dashed] (m.south west) rectangle (m.north east);
    \end{tikzpicture}
  \end{parts}
\end{document}

and this is the image that a make

enter image description here

And this

  • 3
    What exactly are you having difficulties with? You are only showing some images. Questions seeking formatting help ("how to make this image?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See minimal working example (MWE). – Henri Menke Sep 10 '17 at 23:15
  • If you don't know where to start, take a look at these questions: https://tex.stackexchange.com/questions/5599 https://tex.stackexchange.com/questions/205 – Henri Menke Sep 10 '17 at 23:16
  • I'm sorry, the question would be how to draw this image in latex https://i.stack.imgur.com/jc3aN.png , because I have had difficulties with handling the tikz library – The Third Sep 10 '17 at 23:21
  • Start from the template \documentclass{article}\usepackage{tikz}\begin{document}\begin{tikzpicture} ... \end{tikzpicture}\end{document} and read through the tutorials on the first pages of the TikZ manual. As you get stuck, post the code here and explain what you try to achieve. Keep the question as specific as possible. – Henri Menke Sep 10 '17 at 23:30
  • What does the parts environment do and what does \part, which is a sectioning command, have to do with the image? Do you want this to appear on a kind of part title page or something? If you're not familiar with \part, I'd suggest starting with an introduction to LaTeX before trying to learn TikZ. – cfr Sep 11 '17 at 00:13
  • Which TikZ library did you have trouble with? What trouble did you have with it? There are many, many libraries built-in, without mentioning the third-party additions. – cfr Sep 11 '17 at 00:14
  • @HenriMenke You think the OP is asking about a theorem/amsthm/ntheorem? Admittedly, the parts thing is really unclear. – cfr Sep 11 '17 at 00:17
  • @cfr See the question history. There was a theorem-like thing in the first version. – Henri Menke Sep 11 '17 at 00:35

1 Answers1

1

as exercise for me and starting point for you :)

enter image description here

pure tikz image, needed libraries arrows.meta, fit, positioning:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, fit, positioning}
\usepackage{amsmath}

    \begin{document}
\begin{tikzpicture}[
    node distance = 8mm and 4mm,
         F/.style = {draw, rounded corners, dash dot,
                     label=$\boldsymbol{\mathrm{E}_{#1}}$
                     }
                    ]
\node (n1) [draw]           {a};
\node (n2) [right=of n1]    {a};
\node (n3) [below=of n2]    {b};
%
\node (n4)  [below right = 2mm and 22mm of n3]  {x};
\node (n5)  [below=of n4]                       {y};
%
\node (n6)  [below left = 2mm and 22mm of n5]   {c};
\node (n7)  [below=of n6]                       {d};
%%
\node [F=3,
      fit=(n1) (n7)] {};
\node [F=4, minimum width=8mm,
      fit=(n1.north -| n4) (n7.south -| n5)] {};
%%
\draw[semithick,-Latex] (n1) edge (n2)
                        (n2) edge (n3)
                        (n4) edge (n5)
                        (n6)  to  (n7);
\draw[semithick,densely dashed,-{Latex[fill=white]}]
                        (n3) edge (n4)
                        (n5) edge (n6);
\end{tikzpicture}
    \end{document}
Zarko
  • 296,517