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.

Is it possible to use the grid pattern on a node but also setting a background color to it, say blue?

I want to use something like

\node (b) [fill=red, pattern=grid] {b};

I am aware of the solution here: How to combine fill and pattern in a pgfplot bar plot?, but it does not seem to apply directly to a node. Thanks in advance!

share|improve this question
1  
Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). –  Claudio Fiandrino Jul 22 '12 at 16:59
add comment

1 Answer

up vote 13 down vote accepted
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{patterns}
\tikz{\node[preaction={fill, red}, pattern=grid] {b};}
\end{document}

Result:

enter image description here

share|improve this answer
    
Worked like a charm! Thank you so much, especially for the timely reply! Saved my life by the due date! –  Leshui Jul 22 '12 at 17:37
    
So... Accepted answer? :-) –  JLDiaz Jul 22 '12 at 17:49
    
I am newbie on posting and answering questions though. Can you let me know if there's a way to formally ``accept'' the answer to help your reputation? I am happy to do it! –  Leshui Jul 22 '12 at 17:57
    
Yes, click on the check mark which is under the vote arrows. –  JLDiaz Jul 22 '12 at 18:00
    
Done! Thx again! :-) –  Leshui Jul 22 '12 at 18:07
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.