4

I want to create a multi part parallelogram input block for a flowchart. There is no multi part trapezium shape that exist so for now I used a standard rectangular multi part shape with the xslant option to make it look like a parallelogram. I defined a style that I can easily reuse.

The problem is that the text is also slanted, and if possible I would like it normal.

Is there a way to apply xslant only to the shape and not to the text ?

I tried creating a second node only for the text but the problem is that the paralellogram doesn't resize properly to fit the text.

My MWE :

\documentclass[class=article]{standalone}
\usepackage[]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes}

\tikzstyle{io} = [rectangle split,  rectangle split parts=2, xslant=0.4,
draw, rectangle split part fill={blue!50,blue!20}, text centered, minimum width=4.25cm, minimum height=2cm]

\begin{document}
\begin{tikzpicture}

\draw (0,0) node[io,name = ,align = center]{Parameters\nodepart{two} $\alpha$, $\eta$};

\end{tikzpicture}
\end{document}

Thanks for your help.

2
  • You could create your custom node shape Commented 14 hours ago
  • Or maybe instead of a node define a pic and adjust the size of the slanted rectangles using the fit library … Commented 13 hours ago

1 Answer 1

4

You could put the node texts in boxes that you "unslant":

\documentclass[border=10pt]{standalone}
\usepackage{tikz, l3draw}
\usetikzlibrary{shapes}

\ExplSyntaxOn
\NewDocumentCommand { \unslant } { m m } {
    \draw_begin:
        \hbox_set:Nn \l_tmpa_box {#2}
        \draw_transform_xslant:n {#1}
        \draw_box_use:N \l_tmpa_box
    \draw_end:
}

\ExplSyntaxOff

\tikzset{
    io/.style={
        rectangle split,
        rectangle split parts=2,
        xslant=0.4,
        draw,
        rectangle split part fill={blue!50, blue!20},
        text centered,
        minimum width=4.25cm,
        minimum height=2cm
    }
}

\begin{document}
\begin{tikzpicture}

\draw (0,0) node[io] {
    \unslant{-0.4}{Parameters}
    \nodepart{two}
    \unslant{-0.4}{$\alpha$, $\eta$}
};

\end{tikzpicture}
\end{document}

output of above code

Note that you should not use the deprecated command \tikzstyle.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.