Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to create a picture for Instant Insanity problem. Here is my following code:

\begin{tikzpicture}
\matrix[nodes=draw]
{
; & \node{\LARGE R}; & ; & ;\\
\node{\LARGE R}; & \node[draw=white]{\LARGE B}; & \node{\LARGE G}; & \node{\LARGE W};\\
; & \node{\LARGE R}; & ; & ;\\
};
\end{tikzpicture}

The problem is, the node containing B has relatively thick border. This is due to border overlapping by surrounding nodes. How can I turn off drawing borders of node containing B ?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I think you need to draw the lines manually:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix(m)[matrix of nodes,nodes={minimum width=2em,font=\LARGE}]
{
  & R & & \\
R & B & G & W\\
  & R & & \\
};
\draw (m-3-2.south west) rectangle (m-1-2.north east);
\draw (m-2-1.south west) rectangle (m-2-4.north east);
\draw (m-2-3.south east) -- (m-2-3.north east);
\end{tikzpicture}
\end{document}

TikZ's matrix library is apparently necessary to access the nodes in a matrix.

Now you can take that and make it the replacement text of a macro so you won't have to type it over and over.

share|improve this answer
    
It works. Superb! Thanks. –  user1553 Dec 24 '10 at 5:00
    
I don't know why. Edge thickness is not same everywhere! –  user1553 Dec 24 '10 at 9:28
    
@Sazzad: This is probably due to your pdf renderer (which has to fit the line to pixels on your screen). How does it look when you change the zoom level or print it? –  Caramdir Dec 25 '10 at 16:49
    
@Caramdir : When I zoom sufficiently, all looks OK. I think you're right, because I face the same problem with rectangle command. Hence, I use 1pt line width to make it seem smoother. :P –  user1553 Dec 26 '10 at 11:13
    
At last I've drawn the cubes with rectangle commands, the picture looks nicer but the code is not. Should I paste it here and ask, whether anybody can make any macro out of it? –  user1553 Dec 26 '10 at 11:15

Use \node[draw=none]. From the TikZ manual (section 15.3 “Drawing a Path” in v2.10),

If the special color name none is given, this option causes drawing to be “switched off.” This is useful if a style has previously switched on drawing and you locally wish to undo this effect.

share|improve this answer
    
I tried that. The effect is not good. I mean the lower border of 'B' seem to be thinner than any other. Isn't there any other way? –  user1553 Dec 23 '10 at 22:43
    
I was just answering the question as posed. But now I see what you want to achieve, though I can't think of a simple solution at the moment. –  Caramdir Dec 23 '10 at 23:30
4  
This answer is so useful I apparently upvoted it years ago, and now wish to do so again. –  Ryan Reich Aug 15 '13 at 5:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.