0

enter image description here

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
            chains,
            fit,
            positioning,
            quotes}

\begin{document}
\begin{center}
\begin{tikzpicture}[
node distance = 12mm and 12mm,
start chain = going right,
arr/.style = {draw, semithick, rounded    corners, -Straight Barb},
 N/.style = {circle, draw, fill=none, minimum size=1em, 
             outer sep=3pt, font=\tiny},
EN/.style = {N, double, double    distance=1.5pt},
 every edge/.style = {draw, arr},
                ]
% position the nodes a...c
\coordinate[label=left:I] (a);
\node (novoInicial) [N, right=of a] {$q_1$};
\node (b) [N, right=of novoInicial] {$q_2$};
\node (c) [N, above right=of b] {$q_3$};
% position the nodes 8...12
  \begin{scope}[nodes={on chain}]
    \node (d) [N, below right=of c] {$q_8$};
    \foreach \i in {9, 10,...,12}{
        \node (\i) [N] {$q_{\i}$};
    }
\end{scope}
\node (ei) [EN, right=of 12] {$q_{13}$};
\path   
(a) edge (novoInicial)
(novoInicial) edge["$\varepsilon$"] (b)
(b) edge["$\varepsilon$"] (c)
(c) edge["$\varepsilon$"]   (d)
(d) edge["0"]               (9)
(9) edge["$\varepsilon$"]   (10)
(10) edge["0"]               (11)
(11) edge["$\varepsilon$"]   (12)
(12) edge["1"]               (ei)
;
\draw[arr]  (ei) |- ([yshift=45mm] b.north west)
 to ["$\varepsilon$" '] (b.north west);
 %%%%
 \node (j) [N, above right=of c]   {$q_4$};
 \node (k) [N, right=of j] {$q_5$};
 \node (l) [N, right=of k] {$q_6$};
 \node (em) [EN, right=of l] {$q_7$};
 \path   (c) edge["$\varepsilon$"]   (j)
    (j) edge["1"]               (k)
    (k) edge["$\varepsilon$"]   (l)
    (l) edge["0"]               (em);
    \draw[arr]  (em) |- ([yshift=42mm] b.north)
             to ["$\varepsilon$"] (b);
     %%%%
\begin{scope}[nodes={on chain}]
 \node (n) [N, below right=of b] {$q_{14}$};
 \foreach \i in {15, 16,...,18}{
  \node (\i) [N] {$q_{\i}$};
  }
 \end{scope}
  \node (es) [EN, right=of 18] {$q_{19}$};
  \path (b) edge["$\varepsilon$"]   (n)
    (n) edge["0"]               (15)
    (15) edge["$\varepsilon$"]   (16)
    (16) edge["1"]               (17)
    (17) edge["$\varepsilon$"]   (18)
    (18) edge["0"]               (es);
  \draw[arr]  (es) |- ([yshift=-22mm] b.south) to ["$\varepsilon$"] (b);
\end{tikzpicture}
\end{center}
\end{document}
7
  • It does fit with \usepackage[paper=a3paper]{geometry}.
    – frougon
    Jun 5 at 19:04
  • @frougon Using this command, it is no longer possible to print the document on A4 paper, right?
    – B612
    Jun 5 at 19:07
  • Use the landscape environment.
    – Bernard
    Jun 5 at 19:08
  • @B612 It is, using e.g. pdfjam --paper a4paper --outfile out.pdf -- in.pdf as a first step. But my comment was to be taken as a joke: your example is very far from minimal; if you're capable of creating such a complex picture, you can certainly modify its layout so that it spreads more in the vertical direction than horizontal, or use the scale option of the tikzpicture environment (and/or x=..., y=...) , or switch to landscape as @Bernard said... You need to have an idea yourself how you want the figure to look, we can't guess!
    – frougon
    Jun 5 at 19:11
  • Another option is to reduce the distance between the nodes, for example: node distance = 7mm and 7mm.
    – Unknown
    Jun 5 at 19:18

1 Answer 1

0

Solution #1: Decrease the margins

Suggested replacement of Line 2:

\usepackage[left=1cm, right=1cm]{geometry}

This shrinks the margins of the page on the left and right, making more space for your picture.

Solution #2: Shrink the picture

As suggested by a previous commenter, you could replace Line 13 with something like

node distance = 5mm and 5mm,

Even dropping these numbers from 12 to 10 makes a difference in spacing.

These solutions could also be used in combination with each other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.