# Coordinates unit in pt although default is cm in TikZ

As we know that in TikZ, if unit is not mentioned in the coordinate in TikZ, it takes cm by default.

When I extract the coordinates, I was expecting the unit as cm. But TikZ shows the unit in the coordinate as pt.

How does TikZ determine the unit of measure in a coordinate if no unit is specified.

MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\tikzset{zigzag/.style={decorate,decoration=zigzag}}
\begin{document}

\newdimen\XCoord
\newdimen\YCoord
\newcommand*{\ExtractCoordinate}[1]{\path (#1); \pgfgetlastxy{\XCoord}{\YCoord};}

\begin{tikzpicture}
\coordinate (c) at (0,-2);
\coordinate (d) at (4,-2);
\coordinate (e) at (2,-4);
\draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with { \coordinate (x); },
mark=at position 0.5 with { \coordinate (singularity); },
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);

\draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
\draw[thick,postaction={
decoration={
markings,
mark = at position 0.7 with \coordinate (y);
},
decorate
}] (a) -- (c);
\draw[thick,red,dashed] (x) -- (y);

\node[above = 10ex of singularity,red] (sn) {singularity};
\draw[red,->] (sn) -- ($(singularity)+(0,1)$);
\ExtractCoordinate{x};
\node[above] at (\XCoord,\YCoord) {(\XCoord,\YCoord)};
\end{tikzpicture}

\end{document}


• Not an answer, but the information may be useful: tex.stackexchange.com/a/20069/579 Feb 28 '19 at 3:33
• Barbara I would like to know the default unit of measure when unit of measure is not mentioned Feb 28 '19 at 3:35
• Internally TikZ works with pt. You have a coordinate system in which the unit vectors have length 1cm. Does that make sense? The IMHO clearest discussion on this can be found at tex.stackexchange.com/a/31606/121799 .
– user121799
Feb 28 '19 at 3:38
• How did you measure the distance though? How did you make sure you are not magnifying the document when measuring?
– zyy
Feb 28 '19 at 3:39
• @zyy As far as I can see, there is only the word singularity, not a real singularity, so you can use the Euclidean metric to a good approximation. ;-)
– user121799
Feb 28 '19 at 3:41

You can always convert everything from pt to cm or back by multiplying by the ratio 1pt/1cm or its inverse. (If that's not what you're after, I will be happy to remove the post.)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\tikzset{zigzag/.style={decorate,decoration=zigzag}}
\begin{document}

\newdimen\XCoord
\newdimen\YCoord
\newcommand*{\ExtractCoordinate}[1]{\path (#1); \pgfgetlastxy{\XCoord}{\YCoord};}

\begin{tikzpicture}
\coordinate (c) at (0,-2);
\coordinate (d) at (4,-2);
\coordinate (e) at (2,-4);
\draw[thick,red,zigzag,postaction={
decoration={
markings,
mark=at position 0.7 with { \coordinate (x); },
mark=at position 0.5 with { \coordinate (singularity); },
},
decorate
}] (-2,0) coordinate(a) -- (2,0) coordinate(b);

\draw[thick,fill=blue!20] (c) -- (b) -- (d) -- (e) -- cycle;
\draw[thick,postaction={
decoration={
markings,
mark = at position 0.7 with \coordinate (y);
},
decorate
}] (a) -- (c);
\draw[thick,red,dashed] (x) -- (y);

\node[above = 10ex of singularity,red] (sn) {singularity};
\draw[red,->] (sn) -- ($(singularity)+(0,1)$);
\ExtractCoordinate{x};
\node[above] at (\XCoord,\YCoord) {%
(\pgfmathparse{\XCoord*1pt/1cm}\pgfmathprintnumber{\pgfmathresult}\,cm,%
\pgfmathparse{\YCoord*1pt/1cm}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,cm)};
\end{tikzpicture}
\end{document}