1

I have no idea for reducing distance of dots (lines) in tikz dotted (horizontal lines) pattern. I find some similar examples in this website (like this), but it was so complicated. Can someone give me some hints?

3
  • 2
    Could you please list the codes that you found and explain why you do not like them? Otherwise there is a danger you will get the same answer again.
    – user121799
    Feb 4, 2019 at 15:04
  • For example see this one:tex.stackexchange.com/questions/42003/… or tex.stackexchange.com/questions/54358/…
    – user108724
    Feb 4, 2019 at 15:05
  • 2
    I have a hard time seeing how this is directly related to your question. This post discusses a random pattern of solid lines, doesn't it? And please add the relevant information to your question, and not in comments.
    – user121799
    Feb 4, 2019 at 15:09

1 Answer 1

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

\pgfdeclarepatternformonly{mydots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{2pt}{2pt}}% original definition: \pgfqpoint{3pt}{3pt}
{%
  \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}%
  \pgfusepath{fill}%
}%

\pgfdeclarepatternformonly{mynewdots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{1pt}{1pt}}% original definition: \pgfqpoint{3pt}{3pt}
{%
  \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}%
  \pgfusepath{fill}%
}%

\begin{document}
\begin{tikzpicture}
\draw[pattern=dots] (0,0) rectangle ++(3,3);
\draw[pattern=mydots] (4,0) rectangle ++(3,3);
\draw[pattern=mynewdots] (8,0) rectangle ++(3,3);
\end{tikzpicture}
\end{document}

enter image description here

4
  • Very nice. And what about line case? Do i allowed to use this patteren without referencing in literatures?
    – user108724
    Feb 4, 2019 at 18:08
  • @C.F.G what does IT mean?
    – Ignasi
    Feb 4, 2019 at 18:18
  • IT? Information Technology?! :) . my means is copyright issues.
    – user108724
    Feb 5, 2019 at 6:00
  • @C.F.G You can use this code as you want. But, if it solves your problem, you could accept the answer ;-)
    – Ignasi
    Feb 5, 2019 at 8:32

You must log in to answer this question.