3

Is there an easy way to control the line width (and inevitably the line distance) of a pattern decoration?

I want a uniform line hatching, e.g. red / blue, with line width, say 3mm.

BTW: I need this for a large number of cells, so it would be good to use the patterns library to solve this, as opposed to drawing in manually.

enter image description here

\documentclass[tikz, border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{tikzpicture}[font=\Huge, 
Deco/.style={postaction={pattern=north west lines, 
%line width=6mm, ultra thick, % no effect
pattern color=blue}},
]
\node[Deco, fill=red, draw, minimum size=5cm]{A};
\end{tikzpicture}
\end{document}
3
  • There's an example in tex.stackexchange.com/a/60234 (bottom half of answer) Edit: not for multiple colours, but for changing line width and separation May 15, 2021 at 12:51
  • See the patterns.meta library which provides easy customization.
    – SebGlav
    May 15, 2021 at 12:53
  • Yes, I see. Thanks for the advices.
    – cis
    May 15, 2021 at 13:13

1 Answer 1

4

I think the easiest way is to use the patterns.meta library:

enter image description here

\documentclass[tikz, border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns.meta}

\begin{document}
\begin{tikzpicture}[font=\Huge, 
Deco/.style={postaction={
pattern={
Lines[angle=-45, distance=6mm,  line width=3mm]% <--- !
},    pattern color=blue,
}},
]

\node[Deco, fill=red, draw, minimum size=5cm]{A};
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .