summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/isopt/latex/isopt.sty
blob: 019cfbdc2a090ba9bae9e77552f5f7af3376cbd2 (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
%%
%% IMPORTANT NOTICE:
%%
%% This is file `ISOpt.sty',
%%
%% Herbert Voss <hvoss@tug.org>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `ISOpt' offers writing a TeX length in ISO style
%%
\NeedsTeXFormat{LaTeX2e}
\def\ISOpt@fileversion{0.01}
\def\ISOpt@filedate{2017/10/09}
\ProvidesPackage{isopt}[2017/10/09 v 0.01  print a TeX length in ISO style]
\message{`isopt' v\ISOpt@fileversion, \ISOpt@filedate\space (hv)}
%
\RequirePackage{xkeyval}
\let\ISOpt@space\thinspace
\DeclareOptionX{space}{\def\ISOpt@space{#1}}
\ProcessOptionsX\relax
%
\newcommand*{\ISO}{\@ifnextchar\bgroup\dudenpt@arg\dudenpt@}
\newcommand*{\dudenpt@arg}[1]{\dudenpt@#1\relax}
\newcommand*{\dudenpt@}{\begingroup\afterassignment\@dudenpt\dimen@=}
\newcommand*{\@dudenpt}{\expandafter\endgroup\expandafter\duden@pt\the\dimen@}
\begingroup
  \catcode`P=12
  \catcode`T=12
  \lowercase{% 
    \def\x{%  
      \def\duden@pt##1.##2PT{%
        ##1\ifnum##2>\z@.##2\fi
        \ifcase
            \ifnum##2>\z@\@ne
            \else\ifnum##1>9 \@ne
            \else\ifnum##1<\z@ \@ne
            \else \z@
            \fi\fi\fi
          \ISOpt@space
        \else
          \nobreakspace
        \fi
        pt%
      }%   
    }%  
  }%  
\expandafter\endgroup\x
%
\newcommand\THE{\ISO\the}
%
\endinput