blob: e68f705ed0b4dc9b77b5c45181bc49aa8724b831 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
smartunits
==========
A [LaTeX](http://en.wikipedia.org/wiki/LaTeX) package that implements
automatic conversions between (some) metric and Imperial units. All units are
printed using siuntx
Example
-------
```tex
\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](https://www.ctan.org/pkg/pgfkeys) and
[siunitx](https://www.ctan.org/pkg/siunitx).
### Author
Copyright (c) 2016 [Andrew Mathas](mailto:andrew.mathas@gmail.com)
Released under the [LaTeX Project Public
License](http://www.latex-project.org/lppl.txt) v1.3c or later
|