Add `formatDim` with limited precision. Fixes #396

The precision is set to 6 decimal to format TeX dimensions.
As discussed in #396 by @okomarov, 5 decimals is ample resolution
for any practical use.

Trailing zeros and dots are removed for prettiness.

Moreover, when a TeX length (e.g. `\figurewidth`) is used as unit,
1.0 is converted into just the unit.
Merge branch 'truncation'