Directory macros/latex/contrib/smartunits
README.md
smartunits
A LaTeX package that implements automatic conversions between (some) metric and Imperial units. All units are printed using siuntx
Example
\documentclass{article} \usepackage{smartunits} \begin{document} \SmartUnitSettings{metric imperial, places=1} \SmartUnit{km=100.0,figures=1} % 100 km (60 mi) \SmartUnit{miles=62.15,places=1} % 100 km (62.2 mi) \SmartUnit{cm=10} % 10 cm (3.9") \SmartUnit{celsius=20} % 20 C (68.0 F) \SmartUnit{miles=5.0} % 8.0 km (5.0 mi) \SmartUnit{miles=5.0, figures=1} % 8 km (5 mi) \SmartUnit{hours=0, minutes=59} % 0:59 (12:59 AM) \SmartUnit{hours=12, minutes=12} % 12:12 (12:12 PM) \SmartUnit{kg=10.0, places=1} % 10.0kg (22.0 lbs) \SmartUnit{pound=10.0,figures=1} % 5kg (10 lbs) \SmartUnit{l=10.0, places=1} % 10.0l (2.6gal) \SmartUnit{L=10.0, places=1,uk} % 10.0L (2.2gal) \end{document}
Units supported
Currently smartunits converts between the following five classes of units:
============ ============== Metric Imperial ------------ -------------- ------------- kilometers miles (distance) centimeters feet and inches (length) Celsius Fahrenheit (temperature) 24-hour time 12-hour time (time) litres USA/UK gallons (volume) kilograms pounds (weight) ============ ============== =============
It is quite easy to extend the code to other units. I am happy to consider new requests.
Requirements
The package requires pgfkeys and siunitx.
Author
Copyright (c) 2016 Andrew Mathas
Released under the LaTeX Project Public License v1.3c or later
Download the contents of this package in one zip archive (334.2k).
smartunits – Converting between common metric and Imperial units
This LaTeX package implements a \SmartUnit macro for converting between (some) metric and Imperial units.
The package requires pgfkeys and siunitx.
Package | smartunits |
Version | 1.2 2016-02-05 |
Licenses | The LaTeX Project Public License 1.3 |
Copyright | 2016 Andrew Mathas |
Maintainer | Andrew Mathas |
Contained in | TeX Live as smartunits MiKTeX as smartunits |
Topics | Units Misc conv |