Output is: 72.27 pt

But i want to show output in centimeter using VTeX.

  • Is this meant to be the new question I suggested? If so, it's not VTeX that's important: it's not using e-TeX. Moreover, did you see my suggestion about using printlen in the comment I left on your other question? – Joseph Wright Apr 20 '15 at 18:17
  • 3
    is there any particular reason to be using vtex rather than a more standard tex distribution such as miktex or texlive? – David Carlisle Apr 20 '15 at 20:53

Using macros by Claudio Beccari in widetable.sty:



  \wt@Numer #1\relax \wt@Denom #2\relax
  \ifdim\wt@Denom<\z@ \wt@Denom -\wt@Denom \wt@Numer -\wt@Numer\fi
  \ifdim\wt@Numer<\z@ \def\wt@segno{-}\wt@Numer -\wt@Numer\fi
    \wt@Num=\wt@Numer \wt@Den=\wt@Denom \divide\wt@Num\wt@Den
    \advance\wt@Numer -\wt@Q\wt@Denom \wt@I=6
    \@whilenum \wt@I>\z@ \do{\wt@dividiDec\advance\wt@I\m@ne}%

  \wt@Numer=10\wt@Numer \wt@Num=\wt@Numer \divide\wt@Num\wt@Den
  \advance\wt@Numer -\wt@q\wt@Denom}


\newcommand{\convert}[2]{\dividi#1\per 1#2\in\temp\temp\,#2}







The accuracy is not guaranteed beyond three digits, but it should be sufficient.

enter image description here


If I understand your question, you need to do unit conversion in a obscure TeX system where eTeX primitives are not available. First of all, ask yourself if this is a good idea. The most of current LaTeX packages need eTeX primitives.

If you really needs to convert TeX units without eTeX then you must reconcile to the precision loss because the 64bit integer arithmetic isn't available. And you can use, for example, the following macro \printin with the usage:


for example:


prints \hsize register in cm. The \printin macro can be implemented by:

{\lccode`\?=`\p \lccode`\!=`\t  \lowercase{\gdef\ignorept#1?!{#1}}}

    \tmpnum=1073741824 \tmpdim=1#1
    \divide\tmpdim by4
    \divide\tmpnum by\tmpdim
    \tmpdim=\the\tmpnum sp
  • Is there any specific reason for the spaces after \p and \t ? – percusse Apr 20 '15 at 19:56
  • @percusse If you mean the first line -- then the reason is only code transparency. The spaces are consumed by token processor. But I can say \lccode`?=`p, then the space is consumed by main processor and the result is the same. – wipet Apr 20 '15 at 20:01
  • Ah OK, I thought there might be some space sensitive context that I'm not seeing right away. – percusse Apr 20 '15 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.