I have read carefully the etex manual to understand the syntax of dimexpr and numexpr but my limited comprehension remains limited… The expression "\dimexpr" appears only 3 times in the mentioned manual and nowhere is a formal definition (I mean: that answers my question).
So, in the detail, one can find this macro on the net:
\newcommand\dimtomm[1]{%
\strip@pt\dimexpr 0.352777778\dimexpr#1\relax\relax
}
to convert a dimension in mm. The thing is that it doesn't seem to take into account the initial unit of #1… ? Indeed, I use this newcommand with a position issued from zsavepos which is in sp, and it works as if I had given the newcommand a dimension in pt!
There is so a more general question about dimensions, for which I can't find answer among the litteracy (source book, …) and internet: when a variable is defined to contain a dimension, is there a unit attached to it, or is just a number but with a label "dimension"? I guess… no! because of the \strip@pt, but this is in contradiction with the behavior of \dimtomm above (according to me, of course).
Who could make a clear topo about dimension, about coordinate (zsavepos…), about how add a zsavepos in sp with a dimension in pt, about the dimexpr functioning, and so on?
EDIT To be more precise about my questioning, in order the answers not to be too general: I get the zsavepos of a point and I can access to x and y which are lenghts in sp. Then I want to draw locate an object in a draw using something like:
$(current page.north west) + (0cm,\xcoordtodim{\zposy{pointA}})$
So I face two problems of different types:
1) I want \xcoordtodim returns a dim, and apparently, I can't do that with my current knowledge…
2) \xcoordtodim adds the zposy of a point (in sp) with a given length generally expressed in pt: this is the question of "mixing" units linked to \dimtomm and \dimexpr…
Best Answer
dimensions are not stored with a unit (actually they are always stored as an integer, in
sp
units). Whatever unit is used when setting the length (if a unit is used at all)\the
will show the length usingpt
units.Settings that don't use any explicit unit include things like