3

I am trying to create a node as shown in the below figure. Could anyone help me how to create it?

Thank you in advance

enter image description here

11
\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, shapes.multipart}

\begin{document}
\begin{tikzpicture}
\node[rectangle split, rectangle split parts=3, rectangle split horizontal, draw]{\nodepart{two}ReadInput};
\end{tikzpicture}
\end{document}

enter image description here

Update:

Following code shows an improved version of previous code. It shows font and colors more similar to OP's example.

A second solution is also provided. This one uses a regular node with larger inner xsep and a path picture option which draws inner lines. This solution avoids to use \nodepart{two} inside node's contents and offers a better control over size of lateral boxes.

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, shapes.multipart}

\begin{document}
\begin{tikzpicture}[
    mynode/.style={
        rectangle split,
        rectangle split parts=3,
        rectangle split horizontal,
        font=\sffamily,
        color = cyan!80!black,
        draw,
        top color=white,
        bottom color=orange
    }
]
\node[mynode]{\nodepart{two}ReadInput};
\end{tikzpicture}

\begin{tikzpicture}[
    mynode/.style={
        font=\sffamily,
        color = cyan!80!black,
        draw,
        top color=white,
        bottom color=orange,
        inner xsep=4mm,
        path picture={%
            \draw ([xshift=-2mm]path picture bounding box.north east)--([xshift=-2mm]path picture bounding box.south east);
            \draw ([xshift=2mm]path picture bounding box.north west)--([xshift=2mm]path picture bounding box.south west);},
    }
]
\node[mynode]{ReadInput};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Here are some suggestions: I think the second part should be of fixed width, the font should be in \sffamily and the node should have a shade color. Anyway, +1 :) – JouleV Mar 26 at 9:19
  • Thanks for your solution. – Akhilesh Thothara Mar 26 at 11:43
  • How do I change the width of the rectangles on the end. – Akhilesh Thothara Mar 26 at 11:43
  • @AkhileshThothara On second solution, the width is automaticaly adjusted to text width, but if you want to impose some width you can use minimum width or text width options. – Ignasi Mar 26 at 12:13

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.