0

I want to learn tikz, but since I can't visualize coordinates, I need to draw/show step numbers on help lines. How can I achieve this?

\documentclass{standalone}
\usepackage{tikz}

\begin{document} \begin{tikzpicture} \draw[help lines, color=red!40, dashed, xstep=0.5cm,ystep=0.5cm] (-9.9,-9.9) grid (9.9,9.9); \draw[<->,ultra thin] (-9,0)--(9,0) node[right]{$x$}; \draw[<->,ultra thin] (0,-9)--(0,9) node[above]{$y$};. \end{tikzpicture} \end{document}

Mafsi
  • 664

1 Answers1

1

If you want something like this:

enter image description here

then add only two extra lines in \begin{tikzpicture}...\end{tikzpicture}.

\tkzInit[xmax=10,ymax=10,xmin=-10,ymin=-10]
%\tkzGrid
\tkzAxeXY

Of course, use \usepackage{tkz-euclide}.

Complete Example:

\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document} \begin{tikzpicture} \tkzInit[xmax=10,ymax=10,xmin=-10,ymin=-10] %\tkzGrid \tkzAxeXY \draw[help lines, color=red!40, dashed, xstep=0.5cm,ystep=0.5cm] (-9.9,-9.9) grid (9.9,9.9); \draw[<->,ultra thin, step=1cm] (-9,0)--(9,0) node[right]{$x$}; \draw[<->,ultra thin] (0,-9)--(0,9) node[above]{$y$};. \end{tikzpicture} \end{document}

Update:

\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document} \begin{tikzpicture} \tkzInit[xmax=10,ymax=10,xmin=-10,ymin=-10] %\tkzGrid \tkzAxeXY \draw[help lines, color=red!40, dashed, xstep=0.5cm,ystep=0.5cm] (-9.9,-9.9) grid (9.9,9.9); \draw[<->,ultra thin, step=1cm] (-9,0)--(9,0) node[right]{$x$}; \draw[<->,ultra thin] (0,-9)--(0,9) node[above]{$y$};. \end{tikzpicture} \end{document}

mmr
  • 2,249
  • 5
  • 22
  • Your example is not compiling anymore. Can you help again? – Mafsi May 24 '22 at 11:38
  • @Mafsi It is working on my side. What problem are you facing? Let me know. – mmr May 25 '22 at 04:48
  • @Mafsi You can check your compiler please. – mmr May 25 '22 at 04:50
  • I get this tikz-help-lines.tex:9: Undefined control sequence. l.9 \tkzAxeXY ? – Mafsi May 25 '22 at 05:45
  • @Mafsi You can add \usetkzobj{all} to resolve the problem. Link: https://tex.stackexchange.com/questions/154348/tkz-euclide-error-undefined-control-sequence-tkzmarkangle – mmr May 25 '22 at 05:54
  • Not compiling... Undefined control sequence. \usetkzobj{all} even if I put the command before begin{tikzpicture} or in preamble – Mafsi May 25 '22 at 05:57