summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/printlen/printlen-doc.tex
blob: 2f3f91208656a1fca5f5491adadd80b386b85aea (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
\documentclass[pagesize=auto, fontsize=12pt, DIV=10]{scrartcl}

\usepackage{fixltx2e}
\usepackage{etex}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[svgnames]{xcolor}
\usepackage{listings}
\usepackage{microtype}
\usepackage{hyperref}

\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
\makeatletter
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
\makeatother
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}

\addtokomafont{title}{\rmfamily}

\lstset{%
  language=[LaTeX]TeX,%
  columns=flexible,%
  upquote=true,%
  numbers=left,%
  basicstyle=\ttfamily,%
  keywordstyle=\color{Navy},%
  commentstyle=\color{DimGray},%
  stringstyle=\color{SeaGreen},%
  numberstyle=\scriptsize\color{SlateGray}%
}

\title{The \pkg{printlen} package\thanks{This manual corresponds to \pkg{printlen.sty}~v1.1a, dated~2009/09/03.}}
\subtitle{Print lengths in a variety of units}
\author{Peter Wilson, Herries Press\and Harald Harders\thanks{\mail{h.harders@tu-bs.de}}\and Maintainer: Will Robertson\thanks{\mail{will.robertson.@latex-project.org}}}
\date{2009/09/03}


\begin{document}

\maketitle


\section{Usage}

\cmd{\printlength}\marg{length} prints the value of a \LaTeX\ length in the 
units specified by \cmd{\uselengthunit}\marg{unit}, where \meta{unit} may be any \TeX\ %
length unit except for scaled point. That is, \meta{unit} may be any of:
\texttt{pt}, \texttt{pc}, \texttt{in}, \texttt{mm}, \texttt{cm}, \texttt{bp}, \texttt{dd} or \texttt{cc}. When \texttt{pt} is set the printed length
value will include any stretch or shrink values, otherwise these
are not printed. The \meta{unit} argument may also be \texttt{PT}, in which case
length values will be printed in pt units but without any stretch
or shrink values. An unknown value for \meta{unit} is treated as though it
had been specified as \texttt{pt}.

The unit is separated from the number using the command
\cmd{\unitspace} which is set to \cmd{\,} by default. In math mode the units are
printed upright.

\cmd{\rndprintlength}\meta{length} prints the rounded value of a \LaTeX\ length.
Use \texttt{PT} instead of \texttt{pt} for rounded points if there are stretch or
shrink values.

The initial setting is \verb+\uselengthunit{pt}+


\minisec{Example:}

\begin{lstlisting}
The \verb|\textwidth| is \printlength{\textwidth} which is also
\uselengthunit{in}\printlength{\textwidth} and
\uselengthunit{mm}\printlength{\textwidth}.
\end{lstlisting}


\section{Change history}

\minisec{Version 1.1a (2009/09/03)}

\begin{itemize}
\item New maintainer (Will Robertson)
\end{itemize}
 

\minisec{Version 1.1 (2001/12/09)}

\begin{itemize}
\item Print rounded values
\item Space between value and units
\end{itemize}


\minisec{Version 1.0 (2001/11/03)}

\begin{itemize}
\item First public release
\end{itemize}

\end{document}