How can we display rulers on the top and the side of a TikZ image? When creating a TikZ image, we need to place items (nodes, lines, etc.) at specific positions. It would be easier if we see the coordinates of any potential point by means of rulers (or is there a better way?) How can we place rulers in the TikZ image (they would be just for the time of development of the image)
Asked
Active
Viewed 53 times
2 Answers
1
TikZ has the help lines style for this purpose.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\drawhelp lines grid (5,2);
\draw (-.5,-.7) -- (4.3, 1.6);
\end{tikzpicture}
\end{document}
Sandy G
- 42,558
0
Something like this?
Code:
\documentclass[10pt,a4paper]{book}
\usepackage{tikz}
%\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}
\draw[step=1cm,line width=1pt] (0,0) grid (11,12);
\foreach \i in {1,2,...,11}
\foreach \j in {1,2,...,12}
\node at (\i-.5,\j-.5) () { \i,\j};
\node at (5,5) {\includegraphics[width=6cm]{example-image-duck}};
\end{tikzpicture}
\end{document}
You can comment or delete the code for the grid after your work is finished.
Raffaele Santoro
- 9,702


\draw (0,0) grid (4,3);for example. – Sigur Jan 05 '24 at 12:50\foreach\x in {0, ..., 4}\node[below]at(\x,0){\x};\foreach\y in {0, ..., 3}\node[left]at(0,\y){\y};– Skillmon Jan 05 '24 at 13:51