8

I would like diagonal line pattern and I also found it in the documentation, but something goes wrong:

enter image description here

The two pattern should consist of solid lines in two directions.

MEW:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc,patterns}

\begin{document}
\noindent\hrulefill

\begin{center}
\begin{tikzpicture}[
  extended line/.style={shorten >=-#1,shorten <=-#1}]
\coordinate (a) at (0,0);
\coordinate (b1) at (1,1);
\coordinate (b2) at (-1,1);
\coordinate (b3) at (-1,-1);
\coordinate (b4) at (1,-1);
\fill[pattern=north west lines]
   ($(b1)$) -- ($(b2)$) -- ($(b3)$);
\fill[pattern=north east lines]
   ($(b1)$) -- ($(b2)$) -- ($(b4)$);
\draw[extended line=1mm] (b3) -- (b1);
\draw[extended line=1mm] (b4) -- (b2);
\end{tikzpicture}
\end{center}


\noindent\hrulefill
\end{document}

EDIT Interesting: it must be a bug. The picture for the MEW is from www.overleaf.com; but if I compile it in my document with (miktext 2019) I get

img

The quality is poor (because the pattern are made in small square I suppose instead of clipping a nice "infinite" pattern) but at least it is what it was supposed to do.

8

Seems to be a job for patterns.meta, which was looming in the dark until it got added recently to the pgfmanual.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{patterns.meta}
\begin{document}
\tikzdeclarepattern{
  name=arrows,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(12.1pt,8.1pt)},
  tile size={(12pt,8pt)},
  tile transformation={rotate=45},
  code={
\tikzset{x=1pt,y=1pt}
\draw [-stealth] (0,2) -- (6,2); 
\draw [-stealth] (6,6) -- (12,6); 
} }
\tikzdeclarepattern{
  name=north east stripes,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(12.1pt,8.1pt)},
  tile size={(12pt,8pt)},
  tile transformation={rotate=45},
  code={
\tikzset{x=1pt,y=1pt}
\draw  (0,2) -- (6,2); 
\draw  (6,6) -- (12,6); 
} }
\tikzdeclarepattern{
  name=north west stripes,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(12.1pt,8.1pt)},
  tile size={(12pt,8pt)},
  tile transformation={rotate=-45},
  code={
\tikzset{x=1pt,y=1pt}
\draw  (1,2) -- (5,2); 
\draw  (7,6) -- (11,6); 
} }
\begin{tikzpicture}
\draw [pattern=arrows] (-2,2) -- (0,0) -- (2,2);
\draw [pattern=north east stripes] (2,2) -- (0,0) -- (2,-2);
\draw [pattern=north west stripes] (-2,2) -- (0,0) -- (-2,-2);
\end{tikzpicture}
\end{document}

enter image description here

Using square tiles one can reproduce the screen shot more precisely.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{patterns.meta}
\begin{document}
\tikzdeclarepattern{name=arrows,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(10.1pt,10.1pt)},
  tile size={(10pt,10pt)},
  tile transformation={rotate=45},
  code={
\tikzset{x=1pt,y=1pt}
\draw [-stealth] (0,2.5) -- (5,2.5); 
\draw [-stealth] (5,7.5) -- (10,7.5); 
} }
\tikzdeclarepattern{name=north east stripes,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(10.1pt,10.1pt)},
  tile size={(10pt,10pt)},
  tile transformation={rotate=45},
  code={
\tikzset{x=1pt,y=1pt}
\draw  (0,2.5) -- (5,2.5) (5,7.5) -- (10,7.5); 
} }
\tikzdeclarepattern{name=north west stripes,
  type=uncolored,
  bottom left={(-.1pt,-.1pt)},
  top right={(10.1pt,10.1pt)},
  tile size={(10pt,10pt)},
  tile transformation={rotate=-45},
  code={
\tikzset{x=1pt,y=1pt}
\draw (1,2.5) -- (5,2.5)  (6,7.5) -- (10,7.5); 
} }
\begin{tikzpicture}
 \draw [pattern=arrows] (-3.2,3.2) -- (0,0) -- (3.2,3.2);
 \draw [pattern=north east stripes] (3.2,3.2) -- (0,0) -- (3.2,-3.2);
 \draw [pattern=north west stripes] (-3.2,3.2) -- (0,0) -- (-3.2,-3.2);
\end{tikzpicture}
\end{document}

enter image description here

I tested this both with preview and acroread in various magnifications and did not see any issue.

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.