1

dashed help lines

I would like to see other similar or different ways of resizing the strokes when drawing a grid with the help lines option when a dashed pattern is used. Here's an example below.

\documentclass{article}
\usepackage{tikz}
\tikzstyle{dashdotted}=[dash pattern=on 9pt off 2pt on \the\pgflinewidth off 2pt]
\begin{document}
\begin{tikzpicture}
\draw[help lines, dashdotted, xstep=1.3cm, ystep=1.6cm] (0,0) grid (16,8);
\end{tikzpicture}
\end{document}

I used this example:TikZ: Get values for predefined dash patterns

  • 2
    Could you explain again what you want? In your code, you defined one of the various dashed pattern. Then you used it to draw the grid. By the way, remove the help lines and put gray in the style you had created. – Sigur Feb 23 at 1:02
  • 2
    Well, I think defining a personal style is the best option. You can use line width=2pt to change the line thickness also. You can define everything in the style. – Sigur Feb 23 at 1:08
  • 3
    But, when you say other packages, depends what you want. For example, if you want only a grid on the text area, you can use showframe package with [grid=true] option, for example. – Sigur Feb 23 at 1:09
  • 3
    Are there other possibilities? Yes. And if you tell us concretely what you want to achieve, you will most likely get a concrete answer how to do that. (And please notice that \tikzstyle is somewhat deprecated.) – user121799 Feb 23 at 1:44
  • 4
    @marmot \tikzstyle is deprecated and will eventually be removed. – Henri Menke Feb 23 at 4:59
1

The styles listed in the post you linked are already defined in TikZ, you do not need to create a new style to use them.

You can create a style if you need a pattern that doesn't exist. For example, mygridstyle in my MWE creates a style with a sequence of dashes with a length of 8pt, 6pt, 4pt, and 2pt separated by a space of 4pt.

\documentclass{article}
\usepackage{tikz}
\tikzset{mygridstyle/.style={dash pattern=on 8pt off 4pt on 6pt off 4pt on 4pt off 4pt on 2pt off 4pt}}
\begin{document}
Standard dashdotted:
\begin{tikzpicture}
\draw[gray, dashdotted, xstep=1.3cm, ystep=1.6cm] (0,0) grid (4,4);
\end{tikzpicture}

Standard dotted, thick line:
\begin{tikzpicture}
\draw[gray, dotted, xstep=1.3cm, ystep=1.6cm, thick] (0,0) grid (4,4);
\end{tikzpicture}

Standard dash, with 4pt line width:
\begin{tikzpicture}
\draw[gray, dotted, xstep=1.3cm, ystep=1.6cm, line width=4pt] (0,0) grid (4,4);
\end{tikzpicture}

Customized sytle, very thick line:
\begin{tikzpicture}
\draw[gray, mygridstyle, xstep=1.3cm, ystep=1.6cm, very thick] (0,0) grid (4,4);
\end{tikzpicture}
\end{document}

enter image description here

  • Hi @CarLaTeX, although I have given little information about what I really wanted, you gave a valid answer to what I was looking for. Just correcting the lack of detail on my part, especially the requests from all the staff who tried to help me. I would like to be able to make the help lines grid with dashes of the length I want, using dashed pattern. It would be a personalization of the dashed standard itself but mandatory along with the help lines. – Diego Bnei Noah Feb 23 at 18:31

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.