3

This is my code:

\begin{tikzpicture}
\draw[double, double distance=3pt,line cap=rect]
(0,0) -- (10,0) -- (10,9) -- (8,9)
(10,9) -- (10,14) -- (0,14) -- (0,4) -- (-2,4) --(-2,1) -- (0,1) -- (0,0) -- (0,3)
(0,9) -- (6,9) -- (6,12)
(0,11) -- (1,11) -- (1,10);
\end{tikzpicture}

This is my output:

enter image description here

I would like to fill the double lines with the north west hatch pattern, is this possible?

Another solution to get the same output with a different code is also welcome, but i would like to have the exact same dimensions. Is there another way to specify a path with the given coordinates and then draw a rectangle/double line and fill it with a pattern?

2
  • 2
    Doesn't look like filling a double line is possible - take a look at this question. Jan 28, 2020 at 9:37
  • Thanks for your answer, but this seems to be really complicated. I´m sure there is an easier way. I added some more information on my answer
    – 19yc93
    Jan 28, 2020 at 10:17

2 Answers 2

2

Almost (strange artefacts somewhere) success with decorations.markings library.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary {decorations.markings}
\usetikzlibrary {patterns}
\begin{document}
\begin{tikzpicture}[decoration={markings,
mark= between positions 0 and 1step 3pt with{
\path[pattern=north west lines] (-1.5pt,-1.5pt) rectangle (1.5pt,1.5pt);
}}]
\draw[double, double distance=3pt,line cap=rect,postaction={decorate}]
(0,0) -- (10,0) -- (10,9) -- (8,9)
(10,9) -- (10,14) -- (0,14) -- (0,4) -- (-2,4) --(-2,1) -- (0,1) -- (0,0) -- (0,3)
(0,9) -- (6,9) -- (6,12)
(0,11) -- (1,11) -- (1,10);
\end{tikzpicture}
\end{document}

enter image description here

0

Just an idea. Use even odd rule and define the double line with two independent paths, the outer path and the inner path. I know it's not easy but ...

An example

\documentclass[tikz,border=2mm]{standalone}

\usetikzlibrary{patterns}

\begin{document}

\begin{tikzpicture}[even odd rule]
 \draw[pattern=north west lines] (0,0) rectangle (1,2) (.25,.25) -| (.75,1.75) -| (.25,1.125)-|(.5,1)|-(.25,.875)--cycle;
\end{tikzpicture}
\end{document}

enter image description here

1
  • 1
    Thanks, but it seems easier and more straightforward to draw all lines "by hand" instead of your idea (which I want to avoid)
    – 19yc93
    Jan 28, 2020 at 10:29

You must log in to answer this question.

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