1

I want to make split rectangles, but customize the width of each part separately, moreover I would like to hide the lines which split up the distinct rectangles and make the filled part fade from black to gray to white.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{shapes,calc}
\usetikzlibrary{automata,positioning}

\tikzset{
myshape/.style={
  rectangle split,
  minimum height=1.5cm,
  rectangle split horizontal,
  rectangle split parts=2, 
  draw,
  text width=2cm,
  anchor=center,
  }
}

\begin{document}    

\begin{tikzpicture}
\node[
  myshape,
  rectangle split part fill={white,black}
  ] 
  (shape1) {};
\end{tikzpicture}

\end{document}

The resulting picture looks as follows:

MWE

There are however a few problems: I would like the right part of the picture to be wider than the left (but I can only do it the other way around using text width, which is not what I want).

Moreover instead of just using fill, I would like to use shade right color = black, left color = white and when using this, the line between the two parts of the square will become visible (which should then be corrected).

HolyMonk
  • 317
  • 1
    Please, give to us more information. It is not clear what you want. Maybe some piece of code which you had tried or some image showing the output. – Sigur Jan 02 '18 at 18:17
  • Perhaps draw=none, but it would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem.

    While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.

    – Peter Grill Jan 02 '18 at 18:35
  • I posted a reference to another source, I'm setting up a MWE now! – HolyMonk Jan 02 '18 at 18:54
  • You were right that my question was not well posed, please wait for my MWE with better explenation. – HolyMonk Jan 02 '18 at 18:58
  • Is my question better now? – HolyMonk Jan 02 '18 at 19:06
  • You have to supply an (empty) \nodepart{two} before it will allocates space for it (other than some default). – John Kormylo Jan 02 '18 at 20:58
  • Where should I supply this? – HolyMonk Jan 02 '18 at 22:14
  • Inside the text field. See page 726 of the pgf manual. – John Kormylo Jan 03 '18 at 04:31
  • The post https://tex.stackexchange.com/questions/404200/how-can-i-create-a-parent-node-in-tikz-with-parts-of-the-node-designated-for-poi/404229#404229 might give you some ideas –  Jan 03 '18 at 11:02

0 Answers0