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).

  • 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 2 '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 2 '18 at 18:35
  • I posted a reference to another source, I'm setting up a MWE now! – HolyMonk Jan 2 '18 at 18:54
  • You were right that my question was not well posed, please wait for my MWE with better explenation. – HolyMonk Jan 2 '18 at 18:58
  • Is my question better now? – HolyMonk Jan 2 '18 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.