0

I have two questions. How can I enlarge the background and change the position of the text? and, Why is the last trapezoid larger than the other figures?

This is my WE:

\documentclass[12pt,a4paper]{extarticle} %,twoside Usado en latex-ssau-gost-style-master
\usepackage[utf8]{inputenc}
%%%%%%%TIKZ%%%%%%%
\usepackage{tikz}    
% FLOWCHARTS
\usepackage{subfigure}

\usetikzlibrary{shapes,arrows,backgrounds,fit}

\tikzstyle{deci} = [diamond, draw, fill=blue!20, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{proc} = [rectangle, draw, fill=blue!20,text width=7em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{io} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]    
\tikzstyle{data} = [trapezium, draw, trapezium left angle = 70, trapezium right angle = 110, ,text width=7em, text centered, minimum height=4em, fill=blue!20]
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}[node distance = 2.5cm, auto]
        % Place nodes
        \node (init) [io] {Begining};
        \node (ispea) [data,below of = init] {Airfoil coordinates, $\bar{c}, g_1(\bar{x}), g_2(\bar{x})$};
        \node (spea)   [proc, below of=ispea] {Multiobjective optimization};
        \node (vlm)    [proc, below of=spea] {VLM};
        \node (imdb)  [data, right of=vlm, node distance=7cm] {Geometrical characteristics};
        \node (static) [proc,below of =vlm] {Static analysis};
        \node (seval)  [proc, below of=static] {$C_k$ calculation};
        \begin{pgfonlayer}{background}
            \node (MAPDL) [fit = (static)(seval),fill=blue!10] {MAPDL};
        \end{pgfonlayer}
        \node (out) [data, below of=seval,node distance=3cm]  {Print results};
        \node (end) [io, below of=out] {End};
        % Draw edges
        \path [line] (init) -- (ispea);
        \path [line] (ispea) -- (spea);
        \path [line] (spea) -- (vlm);
        \path [line] (imdb) -- (vlm);
        \path [line] (vlm) -- (static);
        \path [line] (static) -- (seval);
        \path [line] (seval) -- (out);
        \path [line] (out) -- (end);
    \end{tikzpicture}
    \caption{Scheme automatization process wing's design}
    \label{fig:wing_design_process}
\end{figure}

\end{document}

This is what I'm obtaining: enter image description here

This is what I'm looking for: enter image description here

  • Can you use pure English code? Russian need extra font to run your code. – ZhiyuanLck Jun 10 at 12:56
  • Yes, just let me change it. – Oscar Espinosa Jun 10 at 12:58
  • It will be better if you make your example fig correspond to your code. – ZhiyuanLck Jun 10 at 13:34
1

Note that \tikzstyle is now deprecated. Instead \tikzset is recommended. Your code need only a little change to fit your demmand:

  • Put MAPDL node on path (static) -- (seval) in the front layer
  • Then let the background node which fits (static)(seval)(mapdl) only be responsible for coloring
  • Use trapezium stretches body option for your data style
\documentclass[12pt,a4paper]{extarticle} %,twoside Usado en latex-ssau-gost-style-master
\usepackage[utf8]{inputenc}
%%%%%%%TIKZ%%%%%%%
\usepackage{tikz}    
% FLOWCHARTS
\usepackage{subfigure}

\usetikzlibrary{shapes,arrows,backgrounds,fit}

\tikzset{
  deci/.style={diamond, draw, fill=blue!20, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt},
  proc/.style={rectangle, draw, fill=blue!20,text width=7em, text centered, rounded corners, minimum height=4em},
  line/.style={draw, -latex'},
  io/.style={draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em},
  data/.style={trapezium, draw, trapezium left angle = 50, trapezium right angle = 130,
    text width=7em, text centered, minimum height=4em, fill=blue!20,
    trapezium stretches body,
  },
}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}[node distance = 2.5cm, auto]
        % Place nodes
        \node (init) [io] {Begining};
        \node (ispea) [data,below of = init] {Airfoil coordinates, $\bar{c}, g_1(\bar{x}), g_2(\bar{x})$};
        \node (spea)   [proc, below of=ispea] {Multiobjective optimization};
        \node (vlm)    [proc, below of=spea] {VLM};
        \node (imdb)  [data, right of=vlm, node distance=7cm] {Geometrical characteristics};
        \node (static) [proc,below of =vlm] {Static analysis};
        \node (seval)  [proc, below of=static] {$C_k$ calculation};
        \node (out) [data, below of=seval,node distance=3cm]  {Print results};
        \node (end) [io, below of=out] {End};
        % Draw edges
        \path [line] (init) -- (ispea);
        \path [line] (ispea) -- (spea);
        \path [line] (spea) -- (vlm);
        \path [line] (imdb) -- (vlm);
        \path [line] (vlm) -- (static);
        \path [line] (static) -- node (mapdl) [right=2cm] {MAPDL} (seval);
        \path [line] (seval) -- (out);
        \path [line] (out) -- (end);
        \begin{pgfonlayer}{background}
          \node (MAPDL) [fit = (static)(seval)(mapdl),fill=blue!10] {};
        \end{pgfonlayer}
    \end{tikzpicture}
    \caption{Scheme automatization process wing's design}
    \label{fig:wing_design_process}
\end{figure}

\end{document}

enter image description here

| improve this answer | |
  • That worked in the correct way, thank you. I'm still having the last trapezoid too big, there is a way to keep the same size as the others? – Oscar Espinosa Jun 10 at 14:24
  • @OscarEspinosa I have add it to my answer. – ZhiyuanLck Jun 10 at 14:39

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.