I want to calculate the ratio of two lengths in Latex, so that I can then stretch an en dash by that ratio. For example, in the code below, I'd like to replace the "0.7" value of FakeStretch with the ratio of newdashw/dashw.
How can I do this?
\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Schola} % the font might change from doc to doc
\def\hairspace{\kern .08333em} % make a very thin space
\newlength\dashw
\settowidth\dashw{\normalsize--} % width of en dash in this font
\newlength\newdashw
\setlength\newdashw\dashw
\addtolength\newdashw{-0.16667em} % subtract 2*hairspace
% make a figure dash: want to replace "0.7" with "newdashw / dashw"
\newcommand\figdash{%
\hairspace{\addfontfeature{FakeStretch=0.7}--}\hairspace}
\begin{document}
Jenny's number: 867\figdash 5309
\end{document}