18

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!

  • 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
26
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{patterns}
\tikz{\node[preaction={fill, red}, pattern=grid] {b};}
\end{document}

Result:

enter image description here

  • 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
  • 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

Your Answer

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

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