From 58496e93da32b893f5958b37a5d1bf630a93dc15 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 5 Feb 2016 23:35:16 +0000 Subject: smartunits (5feb16) git-svn-id: svn://tug.org/texlive/trunk@39592 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/smartunits/README.md | 21 ++++++++++----- .../texmf-dist/doc/latex/smartunits/smartunits.pdf | Bin 331493 -> 336458 bytes .../texmf-dist/doc/latex/smartunits/smartunits.tex | 30 ++++++++++++++------- 3 files changed, 36 insertions(+), 15 deletions(-) (limited to 'Master/texmf-dist/doc/latex/smartunits') diff --git a/Master/texmf-dist/doc/latex/smartunits/README.md b/Master/texmf-dist/doc/latex/smartunits/README.md index 1942639f661..e68f705ed0b 100644 --- a/Master/texmf-dist/doc/latex/smartunits/README.md +++ b/Master/texmf-dist/doc/latex/smartunits/README.md @@ -2,7 +2,8 @@ smartunits ========== A [LaTeX](http://en.wikipedia.org/wiki/LaTeX) package that implements -automatic conversions between (some) metric and Imperial units. +automatic conversions between (some) metric and Imperial units. All units are +printed using siuntx Example ------- @@ -12,14 +13,22 @@ Example \usepackage{smartunits} \begin{document} \SmartUnitSettings{metric imperial, places=1} - \SmartUnit{cm=10} % 10 cm (4') - \SmartUnit{celsius=20} % 20 C (43 F) - \SmartUnit{miles=5} % 8 km (5 mi) - \SmartUnit{miles=5, precision=1} % 8.0 km (5 mi) - \SmartUnit{miles=5, km=7} % 7 km (5 mi) + \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 --------------- diff --git a/Master/texmf-dist/doc/latex/smartunits/smartunits.pdf b/Master/texmf-dist/doc/latex/smartunits/smartunits.pdf index eb81116ba63..e55b6217b28 100644 Binary files a/Master/texmf-dist/doc/latex/smartunits/smartunits.pdf and b/Master/texmf-dist/doc/latex/smartunits/smartunits.pdf differ diff --git a/Master/texmf-dist/doc/latex/smartunits/smartunits.tex b/Master/texmf-dist/doc/latex/smartunits/smartunits.tex index 78c23ee12a0..fe57502fbd4 100644 --- a/Master/texmf-dist/doc/latex/smartunits/smartunits.tex +++ b/Master/texmf-dist/doc/latex/smartunits/smartunits.tex @@ -107,8 +107,9 @@ Imperial units (there is no error checking, however). Depending on the (global) settings the unit will be printed either as a metric unit, or as an Imperial unit, or both. If the required unit is not - given as an argument to \Verb|\SmartUnit| then it is computed. The - units are printed using \ctan{siunitx}, so the formatting of the + given as an argument to \Verb|\SmartUnit| then it is computed. + + The units are printed using \ctan{siunitx}, so the formatting of the units can be controlled using \Verb|\sisetup| together with formatting parameters from \ctan{siunitx}. Some aspects of the formatting can be controlled ``locally'' using \Verb|\SmartUnit| and @@ -136,6 +137,7 @@ \SmartUnitSettings{places=2} % Some global settings < \SmartUnitSettings{places=2} > \SmartUnit{metric imperial} % Output format: metric (Imperial) < \SmartUnit{metric imperial} > \SmartUnit{cm=10} % < \SmartUnit{cm=10} > + \SmartUnit{cm=66} % < \SmartUnit{cm=66} > \SmartUnit{feet=4,inches=3} % < \SmartUnit{feet=4,inches=3} > \SmartUnit{celsius=20} % < \SmartUnit{celsius=20} > \SmartUnit{metric} % Output format: metric < \SmartUnit{metric} > @@ -223,6 +225,8 @@ \end{lstlisting} \item[Length -- cm, inches, feet] + Feet are always printed as integers. Significant figures/places + are applied only to the printing of inches. \begin{lstlisting}[texcl] \SmartUnit{feet=7, inches=1} % \SmartUnit{feet=7, inches=1} \SmartUnit{cm=189, feet=7, inches=1} % \SmartUnit{cm=189, feet=7, inches=1} @@ -230,10 +234,15 @@ \end{lstlisting} \item[Temperature -- celsius, fahrenheit] + Convesions between Celsius and Fehrenheit can be speficied using + \textsf{celsius}, \textsf{C}, \textsf{fahrenheit} or \textsf{F}. + \begin{lstlisting}[texcl] \SmartUnit{celsius=32,places=3} % \SmartUnit{celsius=32,places=3} \SmartUnit{celsius=0} % \SmartUnit{celsius=0} + \SmartUnit{C=37} % \SmartUnit{C=37} \SmartUnit{fahrenheit=0} % \SmartUnit{fahrenheit=0,places=2} + \SmartUnit{F=22,figures=4} % \SmartUnit{F=212,figures=4} \end{lstlisting} \item[Time -- hours, minutes, seconds, am, pm] @@ -277,8 +286,8 @@ \Verb|\sisetup| macro from the \ctan{siunitx} package. \begin{description} - \item[figures] This is equivalent to \Verb|\sisetup{round-mode=figures, precision=#1}|. All units are printed - with \#1 significant figures. + \item[figures] This is equivalent to \Verb|\sisetup{round-mode=figures, precision=#1}|. + Units are printed with \#1 significant figures. \begin{lstlisting}[texcl] \SmartUnit{miles=60, metric, figures=0} % \SmartUnit{miles=60, metric, figures=0} \SmartUnit{miles=60, metric, figures=1} % \SmartUnit{miles=60, metric, figures=1} @@ -288,8 +297,8 @@ \end{lstlisting} \item[places] - This is equivalent to \Verb|\sisetup{round-mode=figures, precision=#1}|. All units are printed - with \#1 significant figures. + This is equivalent to \Verb|\sisetup{round-mode=places, precision=#1}|. + Units are printed with \#1 decimal places. \begin{lstlisting}[texcl] \SmartUnit{miles=60, metric, places=0} % \SmartUnit{miles=60, metric, places=0} \SmartUnit{miles=60, metric, places=1} % \SmartUnit{miles=60, metric, places=1} @@ -404,12 +413,15 @@ The package was written in response to a \href{http://tex.stackexchange.com/questions/241169/}{TeX.SX question}, partly as a proof-of-concept and partly as an exercise to learn how - to use \ctan{pgfkeys}. I thank Mark Adams for asking the question. + to use \ctan{pgfkeys}. Thanks to Mark Adams for asking the question. \Section{Author} - \href{mailto:Andrew.Mathas@gmail.com?smartunits}{Andrew Mathas}, \copyright\space February 2016. + \href{mailto:Andrew.Mathas@gmail.com?smartunits}{Andrew Mathas}, + \copyright\space 2015, 2016. \Section{Licence} - Released under the \href{http://www.latex-project.org/lppl.txt}{LaTeX Project Public License}, v1.3c or later. + Released under the + \href{http://www.latex-project.org/lppl.txt}% + {LaTeX Project Public License}, v1.3c or later. \end{document} -- cgit v1.2.3