5

How can I obtain the same angle of an trapezium node with one and two text lines? When I write two lines of text, it always results in a different angle according to the figure below.

enter image description here

MWE:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,shapes}

\begin{document}
   \begin{tikzpicture}[node distance = 1.5cm]
% Styles
    \tikzstyle{start} = [rectangle, rounded corners, text width=3cm, minimum height=1cm, draw=black, text centered]
    \tikzstyle{process} = [rectangle, text width=3cm, minimum height=1cm, draw=black, text centered]
    \tikzstyle{input} = [trapezium, trapezium left angle=70, trapezium right angle=110, text width=2.8cm, minimum height=1cm, text centered, trapezium stretches=true, draw=black]
    \tikzstyle{arrow} = [thick,->,>=latex]
% Nodes
    \node (start) [start] {Start};
    \node (P1) [process,below of=start] {Step 1};
    \node (I1) [input,left of=P1, xshift=-3.0cm] {Input one: two lines long};
    \node (P2) [process,below of=P1] {Step 2};
    \node (I2) [input,left of=P2, xshift=-3.0cm] {Input two};
    \node (P3) [process,below of=P2] {Step 3};
    \node (I3) [input,left of=P3, xshift=-3.0cm] {Input three: two lines long};
    \node (stop) [start,below of=P3] {Stop};
% Arrows
    \draw [arrow] (start) -- (P1);
    \draw [arrow] (I1) -- (P1);
    \draw [arrow] (P1) -- (P2);
    \draw [arrow] (I2) -- (P2);
    \draw [arrow] (P2) -- (P3);
    \draw [arrow] (I3) -- (P3);
    \draw [arrow] (P3) -- (stop);
\end{tikzpicture}
\end{document}
2

When you increase the height of the trapezoid, this modifies the form since it forces the height when it is already determined by another parameter, for that reason if you want to add height you can use the inner sep property, which can be xsep or ysep .., in the comments in the code I indicate which parameters cause modifications.

RESULT:

enter image description here

MWE:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,shapes.geometric,calc}

\begin{document}
   \begin{tikzpicture}[node distance = 1.5cm]
   % Styles (Its good practice to write like this, you could activate or deactivate options, add comments and avoid put information that goes off the screen like thislike...
    \tikzstyle{start} = [
        rectangle,
        rounded corners,
        text width=3cm,
        minimum height=1cm,
        draw=black,
%       dashed,
        text centered
    ]
    \tikzstyle{process} = [
        rectangle,
        text width=3cm,
        minimum height=1cm,
        draw=black,
        text centered
    ]
    \tikzstyle{input} = [ % It's a matter of tuning...
        trapezium,
        trapezium left angle=70,
        trapezium right angle=110,
        text width=3cm,
%       inner sep=2pt, % Separation between textbox and shape box horizontal and vertical
%       inner xsep=5pt, % Idem but only horizontal.
        inner ysep=5pt, % Idem but only vertical
        minimum width=4.4cm, % it must be the length of the largest trapezoid.
%       minimum height=1cm, % It causes the variation of trapezium angles.. use inner sep instead...
%       trapezium stretches=true, % It also generate variation of trapezium angles...
        text centered,
        draw=black
    ]
    \tikzstyle{arrow} = [
        thick,
        ->,
        >=latex
    ]
% Nodes
    \node (start) [start] {Start};
    \node (P1) [process,below of=start] {Step 1};
    \node (I1) [input,left of=P1, xshift=-3.0cm] {Input one: two lines long};
    \node (P2) [process,below of=P1] {Step 2};
    \node (I2) [input,left of=P2, xshift=-3.0cm] {Input two:};
    \node (P3) [process,below of=P2] {Step 3};
    \node (I3) [input,left of=P3, xshift=-3.0cm] {Input three: three lines long to get another };
    \node (stop) [start,below of=P3] {Stop};
% Arrows
    \draw [arrow] (start) -- (P1);
    \draw [arrow] (I1) -- (P1);
    \draw [arrow] (P1) -- (P2);
    \draw [arrow] (I2) -- (P2);
    \draw [arrow] (P2) -- (P3);
    \draw [arrow] (I3) -- (P3);
    \draw [arrow] (P3) -- (stop);

% For inspection:
    \draw[dashed, orange,thick] (-6.85,-2.5) -- ++ (70:2);
    \draw[dashed, orange,thick] (-6.75,-3.5) -- ++ (70:1.2);
    \draw[dashed, orange,thick] (-6.8,-5.5) -- ++ (70:2);
    \draw[dashed, orange,thick] (-6.7,-5.55) -- ++ (90:5);
    \draw[dashed, orange,thick] (-2.3,-5.55) -- ++ (90:5);

\end{tikzpicture}
\end{document}

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.