summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/scalebar/scalebar.sty
blob: 1e842198f70f1f2dd8c494be10d1e566eb06764d (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
%%
%% This is file `scalebar.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scalebar.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2003 by Michael Lake <mikel@speleonics.com.au>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\ProvidesPackage{scalebar}%
           [2003/05/01 v1.0 Scalebars for maps and diagrams]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{fp}
\newlength{\SB@Length}%
\newcounter{SB@majordivs}%
\newcounter{SB@minordivs}%
\newcounter{SB@evenodd}%
\newcounter{SB@countup}%
\newlength{\SB@Height}%
\newlength{\SB@Thick}%
\newlength{\SB@MajorWidth}%
\newlength{\SB@MinorWidth}%
\newlength{\SB@DivisionWidth}%
\newlength{\SB@TextWidth}%
\newcommand{\SB@unitT}{%
\rule{\SB@DivisionWidth}{\SB@Height}\hspace{-\SB@DivisionWidth}%
\raisebox{-\SB@Height}{\rule{\SB@DivisionWidth}{\SB@Thick}}}%
\newcommand{\SB@unitB}{%
\raisebox{\SB@Height-\SB@Thick}%
{\rule{\SB@DivisionWidth}{\SB@Thick}}\hspace{-\SB@DivisionWidth}%
\raisebox{-\SB@Height}{\rule{\SB@DivisionWidth}{\SB@Height}}}%
\newcommand{\scalebar}[7][]{%
\ifthenelse{\equal{inverse}{#1}}%
{\setcounter{SB@evenodd}{1}}%
{\setcounter{SB@evenodd}{0}}%
\setlength{\SB@Length}{#2}%
\setcounter{SB@minordivs}{#3}%
\setcounter{SB@majordivs}{#4}%
\def\SB@StartNo{#5}%
\def\SB@EndNo{#6}%
\def\SB@TextUnits{#7}%
\setlength{\SB@Height}{1.2ex}%
\setlength{\SB@Thick}{0.2mm}%
\setlength{\SB@MajorWidth}{\SB@Length / \theSB@majordivs}%
\setlength{\SB@MinorWidth}{\SB@MajorWidth / \theSB@minordivs}%
\raisebox{-\SB@Height}{\rule{\SB@Thick}{2\SB@Height}}%
\setlength{\SB@DivisionWidth}{\SB@MinorWidth}%
\setcounter{SB@countup}{0}%
\whiledo{\not\theSB@countup=\theSB@minordivs}{%
\ifthenelse{\isodd{\value{SB@evenodd}}}{\SB@unitB}{\SB@unitT}%
\addtocounter{SB@evenodd}{1}%
\addtocounter{SB@countup}{1}}%
\setlength{\SB@DivisionWidth}{\SB@MajorWidth}%
\setcounter{SB@countup}{1}%
\whiledo{\not\theSB@countup=\theSB@majordivs}{%
\ifthenelse{\isodd{\value{SB@evenodd}}}{\SB@unitB}{\SB@unitT}%
\addtocounter{SB@evenodd}{1}%
\addtocounter{SB@countup}{1}}%
\raisebox{-\SB@Height}{\rule{\SB@Thick}{2\SB@Height}}%
\FPupn\SBIncrement%
{\the\value{SB@majordivs} \SB@StartNo{} \SB@EndNo{} - /}%
\def\SBRound{0}%
\FPifint\SBIncrement%
\else\def\SBRound{1}\FPupn\SBIncrement{\SBIncrement{} 1 round}\fi%
\FPifint\SB@StartNo%
\else\def\SBRound{1}\FPupn\SB@StartNo{\SB@StartNo{} 1 round}\fi%
\FPifint\SB@EndNo%
\else\def\SBRound{1}\FPupn\SB@EndNo{\SB@EndNo{} 1 round}\fi%
\hspace{-\SB@Length}\hspace{-\SB@Thick}%
\raisebox{-3\SB@Height}{%
\FPset\SBNextNo\SB@StartNo%
\setcounter{SB@countup}{0}%
\whiledo{\not\theSB@countup>\theSB@majordivs}{%
\FPupn\SBNextNo{\SBNextNo{} \SBRound{} round}%
\settowidth{\SB@TextWidth}{\SBNextNo}%
\hspace{-0.5\SB@TextWidth}%
\SBNextNo\hspace{-0.5\SB@TextWidth}\hspace{\SB@MajorWidth}%
\FPupn\SBNextNo{\SBNextNo{} \SBIncrement{} add}%
\addtocounter{SB@countup}{1}}%
\hspace{-\SB@MajorWidth}\hspace{0.5\SB@TextWidth}\,\SB@TextUnits}%
}%
\endinput
%%
%% End of file `scalebar.sty'.