Suppose customized spacing is used in LaTex as exemplified below when generating a PDF. Is there a way to extract the sizes of whitespaces from the PDF? I have tried pymupdf, but it does not give info about size of whitespaces.
\documentclass{article}
% Define custom spacing commands
\newcommand{\widespace}{\hspace{0.6em}}
\newcommand{\narrowspace}{\hspace{0.4em}}
\begin{document}
Hello,\widespace{}world!\narrowspace{}This\widespace{}is\narrowspace{}a\widespace{}simple\narrowspace{}LaTeX\widespace{}example.
\end{document}
I think the short answer is no. I ran it through MathPix which didn't detect it, but the better reason is this: I opened your PDF in Acrobat and measured the space between the comma and the word "world" which comes out to 0.08 inches (sorry, not sure why Acrobat doesn't use something more scientific than inches...). From your code, the space should have been
0.6emwhich should be 0.6*1.666666 in = 0.1 inches. So even if you did have a software measuring this for you, your LaTeX output doesn't seem to follow your code to begin with and until you fix that I don't know how you would recover something like this correctly.