Mark every centimeter on a line
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I am building a TikZ graph for a set of furniture for example a table.
Because the exact lengths are important there I would like every of the four lines that make the border of the rectangle to have a little mark for every centimeter they span, so I can easily spot the lengths with my eyes.
I thought a decoration might be a way to go but I did not find anything suitable in the TikZ documentation. Also the axes from the plot area might be a way?
My current workaround is a slihtly different approach, but perhaps someone knows a good way to handle it in TikZ?
documentclassstandalone
usepackagetikz
usetikzlibrarybackgrounds
begindocument
begintikzpicture
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Thank you for your thoughts and input!
tikz-pgf
New contributor
add a comment |Â
up vote
2
down vote
favorite
I am building a TikZ graph for a set of furniture for example a table.
Because the exact lengths are important there I would like every of the four lines that make the border of the rectangle to have a little mark for every centimeter they span, so I can easily spot the lengths with my eyes.
I thought a decoration might be a way to go but I did not find anything suitable in the TikZ documentation. Also the axes from the plot area might be a way?
My current workaround is a slihtly different approach, but perhaps someone knows a good way to handle it in TikZ?
documentclassstandalone
usepackagetikz
usetikzlibrarybackgrounds
begindocument
begintikzpicture
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Thank you for your thoughts and input!
tikz-pgf
New contributor
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am building a TikZ graph for a set of furniture for example a table.
Because the exact lengths are important there I would like every of the four lines that make the border of the rectangle to have a little mark for every centimeter they span, so I can easily spot the lengths with my eyes.
I thought a decoration might be a way to go but I did not find anything suitable in the TikZ documentation. Also the axes from the plot area might be a way?
My current workaround is a slihtly different approach, but perhaps someone knows a good way to handle it in TikZ?
documentclassstandalone
usepackagetikz
usetikzlibrarybackgrounds
begindocument
begintikzpicture
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Thank you for your thoughts and input!
tikz-pgf
New contributor
I am building a TikZ graph for a set of furniture for example a table.
Because the exact lengths are important there I would like every of the four lines that make the border of the rectangle to have a little mark for every centimeter they span, so I can easily spot the lengths with my eyes.
I thought a decoration might be a way to go but I did not find anything suitable in the TikZ documentation. Also the axes from the plot area might be a way?
My current workaround is a slihtly different approach, but perhaps someone knows a good way to handle it in TikZ?
documentclassstandalone
usepackagetikz
usetikzlibrarybackgrounds
begindocument
begintikzpicture
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Thank you for your thoughts and input!
tikz-pgf
tikz-pgf
New contributor
New contributor
New contributor
asked 4 hours ago
jà Â.
133
133
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
This is taken almost literally from the 2nd example on p. 585 of the pgfmanual.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style=postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
draw[#1] (0pt,-2pt) -- (0pt,2pt);
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,,cm mark=red,line width=0.4pt] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Here is another version which prints the distances.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style args=#1 with labels #2postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
pgfmathtruncatemacromydistpgfkeysvalueof/pgf/decoration/mark
info/sequence number-1
draw[#1] (0pt,-2pt) -- (0pt,2pt);
coordinate (Xmark) at (0,0);
pgftransformreset
path (Xmark) node[#1,outer sep=3pt,#2] $mydist$cm;
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin with labels above] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,green!60!black with labels left] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,red with labels below] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
There are many ways I see how this might be customized, e.g. by dropping 0 and so on. However, as my crystal ball got stolen, I do not know if you are interested in such options.
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
This is taken almost literally from the 2nd example on p. 585 of the pgfmanual.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style=postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
draw[#1] (0pt,-2pt) -- (0pt,2pt);
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,,cm mark=red,line width=0.4pt] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Here is another version which prints the distances.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style args=#1 with labels #2postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
pgfmathtruncatemacromydistpgfkeysvalueof/pgf/decoration/mark
info/sequence number-1
draw[#1] (0pt,-2pt) -- (0pt,2pt);
coordinate (Xmark) at (0,0);
pgftransformreset
path (Xmark) node[#1,outer sep=3pt,#2] $mydist$cm;
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin with labels above] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,green!60!black with labels left] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,red with labels below] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
There are many ways I see how this might be customized, e.g. by dropping 0 and so on. However, as my crystal ball got stolen, I do not know if you are interested in such options.
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
add a comment |Â
up vote
3
down vote
accepted
This is taken almost literally from the 2nd example on p. 585 of the pgfmanual.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style=postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
draw[#1] (0pt,-2pt) -- (0pt,2pt);
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,,cm mark=red,line width=0.4pt] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Here is another version which prints the distances.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style args=#1 with labels #2postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
pgfmathtruncatemacromydistpgfkeysvalueof/pgf/decoration/mark
info/sequence number-1
draw[#1] (0pt,-2pt) -- (0pt,2pt);
coordinate (Xmark) at (0,0);
pgftransformreset
path (Xmark) node[#1,outer sep=3pt,#2] $mydist$cm;
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin with labels above] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,green!60!black with labels left] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,red with labels below] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
There are many ways I see how this might be customized, e.g. by dropping 0 and so on. However, as my crystal ball got stolen, I do not know if you are interested in such options.
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
This is taken almost literally from the 2nd example on p. 585 of the pgfmanual.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style=postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
draw[#1] (0pt,-2pt) -- (0pt,2pt);
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,,cm mark=red,line width=0.4pt] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Here is another version which prints the distances.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style args=#1 with labels #2postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
pgfmathtruncatemacromydistpgfkeysvalueof/pgf/decoration/mark
info/sequence number-1
draw[#1] (0pt,-2pt) -- (0pt,2pt);
coordinate (Xmark) at (0,0);
pgftransformreset
path (Xmark) node[#1,outer sep=3pt,#2] $mydist$cm;
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin with labels above] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,green!60!black with labels left] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,red with labels below] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
There are many ways I see how this might be customized, e.g. by dropping 0 and so on. However, as my crystal ball got stolen, I do not know if you are interested in such options.
This is taken almost literally from the 2nd example on p. 585 of the pgfmanual.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style=postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
draw[#1] (0pt,-2pt) -- (0pt,2pt);
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,,cm mark=red,line width=0.4pt] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
Here is another version which prints the distances.
documentclass[tikz,border=3.14mm]standalone
usetikzlibrarybackgrounds,decorations.markings
begindocument
begintikzpicture[cm mark/.style args=#1 with labels #2postaction=decorate,
decoration=markings,% switch on markings mark=% actually add a mark
mark=between positions 0 and 1 step 1cm
with
pgfmathtruncatemacromydistpgfkeysvalueof/pgf/decoration/mark
info/sequence number-1
draw[#1] (0pt,-2pt) -- (0pt,2pt);
coordinate (Xmark) at (0,0);
pgftransformreset
path (Xmark) node[#1,outer sep=3pt,#2] $mydist$cm;
]
node[%
rectangle,
draw,
gray,
line width=.5mm,
minimum width=2.2cm, minimum height=1.6cm,
inner sep=0.2mm] (box) %
Table%
;
% measure lines
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=blue,thin with labels above] (box.north west) -- (box.north east);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,green!60!black with labels left] (box.north west) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm,
yshift=.25mm,cm mark=line width=0.4pt,red with labels below] (box.south east) -- (box.south west);
draw[line width=.5mm, dash pattern=on 1cm off 0.01cm on 1cm, xshift=5mm, yshift=.25mm] (box.south east) -- (box.north east);
beginscope[on background layer]
node[circle,draw=black,fill=darkgray,minimum size=0.25cm] at (box.north east) ;
draw[gray] (box.north east) -- (box.south west) ;
draw[gray] (box.north west) -- (box.south east) ;
endscope
endtikzpicture
enddocument
There are many ways I see how this might be customized, e.g. by dropping 0 and so on. However, as my crystal ball got stolen, I do not know if you are interested in such options.
edited 3 hours ago
answered 3 hours ago
marmot
59.4k463128
59.4k463128
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
add a comment |Â
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
Thank your very much for your nice hint and even putting it into code I could directly use. Very nice!
â jà Â.
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
@jà Â. You're welcome! And welcome to TeX.SE!
â marmot
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
awesome, that is a great addition too! And I am feeling with you for the loss of your beloved crystal ball. Really hoping you get it back one day! ;)
â jà Â.
3 hours ago
add a comment |Â
jà Â. is a new contributor. Be nice, and check out our Code of Conduct.
jà Â. is a new contributor. Be nice, and check out our Code of Conduct.
jà Â. is a new contributor. Be nice, and check out our Code of Conduct.
jà Â. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452034%2fmark-every-centimeter-on-a-line%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password