The function \printlen[Unit][FracNr]{length} formats the output of the unit in sans serif, which I don't like, so I use the following four macros to output a length in pt, in, cm and mm. The macros require the packages fp for non-integer division and siunitx.
\newcommand{\ScaledPointsInPoint}{\number \dimexpr 1pt \relax}
\newcommand*{\FPSizePt}[2][0]{%
\FPdiv\res{\number\dimexpr #2\relax}{\ScaledPointsInPoint}%
\FPeval\res{round(\res:#1)}%
\SI\res{pt}}
\newcommand*{\FPSizeIn}[2][2]{%
\FPdiv\res{\number\dimexpr #2\relax}{\ScaledPointsInPoint}%
\FPdiv\res{\res}{72.27}%
\FPeval\res{round(\res:#1)}%
\SI\res{in}%
}
\newcommand*{\FPSizeCm}[2][2]{%
\FPdiv\res{\number\dimexpr #2\relax}{\ScaledPointsInPoint}%
\FPdiv\res{\res}{72.27}%
\FPmul\res{2.54}{\res}%
\FPeval\res{round(\res:#1)}%
\SI\res{\cm}}
\newcommand*{\FPSizeMm}[2][2]{%
\FPdiv\res{\number\dimexpr #2\relax}{\ScaledPointsInPoint}%
\FPdiv\res{\res}{72.27}%
\FPmul\res{25.4}{\res}%
\FPeval\res{round(\res:#1)}%
\SI\res{\mm}}
Usage:
\newlength{\testlen}\setlength{\testlen}{5440 pt}
\FPSizeIn{\testlen}, \FPSizeCm[4]{\testlen}, \FPSizeMm{\testlen}, \FPSizePt{\testlen}.
Output in locale=DE: 75,27 in, 191,1941 cm, 1911,94 mm, 5440 pt.
csvsimple--- I've emailed the two package authors, so hopefully this will get worked out. – WillAdams Jul 09 '13 at 16:26\TrimSpacesincsvsimpleshould have an@name, since it's an internal of the package. The clash is withxparse, rather thanlengthconvert– egreg Jul 09 '13 at 16:30csvsimpleafterxparsewould avoid raising the error in this particular case, but would breakxparse. – egreg Jul 10 '13 at 16:33lengthconvertpackage has not been updated to reflect some changes inexpl3, so it should not be used, unless the fix proposed in https://tex.stackexchange.com/a/270885/4427 is applied. – egreg Mar 27 '19 at 11:49