-
Notifications
You must be signed in to change notification settings - Fork 24
/
lenval.sty
47 lines (40 loc) · 1.24 KB
/
lenval.sty
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
%%%
%%% Copyright Newgen Imaging systems pvt ltd.
%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{lenval}[2003/07/22 v1.4 value equivalent for length parameters(dimensions)]
\RequirePackage{ifthen}
\newlength{\LV@len}
\newlength{\LV@leni}
\newlength{\LV@lenii}
\newlength{\LV@leniii}
\newcounter{LV@cntri}
\newcounter{LV@cntrii}
\newcounter{LV@cntriii}
\newcommand{\LV@value}{}%
\newcommand{\lenval}[1]{%
\setcounter{LV@cntri}{0}%
\setcounter{LV@cntrii}{0}%
\setcounter{LV@cntriii}{0}%
\setlength{\LV@len}{#1}%
\setlength{\LV@leni}{\the\LV@len}%
\whiledo{\not \(\lengthtest{\LV@leni < 1pt}\)}%
{%
\stepcounter{LV@cntri}%
\addtolength{\LV@leni}{-1pt}%
}%
\setlength{\LV@lenii}{10\LV@leni}%
\whiledo{\not \(\lengthtest{\LV@lenii < 1pt}\)}%
{%
\stepcounter{LV@cntrii}%
\addtolength{\LV@lenii}{-1pt}%
}%
\setlength{\LV@leniii}{10\LV@lenii}%
\whiledo{\not \(\lengthtest{\LV@leniii < 1pt}\)}%
{%
\stepcounter{LV@cntriii}%
\addtolength{\LV@leniii}{-1pt}%
}%
\ifthenelse{\value{LV@cntriii}>4}{\stepcounter{LV@cntrii}}{\relax}%
\renewcommand{\LV@value}{\arabic{LV@cntri}.\arabic{LV@cntrii}}%%
}%