summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/dotarrow/DotArrow.dtx
blob: b5340a62888f7be35d99383f20e1bf70e002811e (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
%% DotArrow.dtx
%% Copyright 2008 Sven Schneider
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Sven Schneider.
%
% This work consists of the files DotArrow.dtx, README, DotArrow.pdf and DotArrow.ins
% and the derived file DotArrow.sty, DotArrow.tex.

% Version 0.02a

%<*driver>
\documentclass{ltxdoc}


\usepackage[utf8]{inputenc}
\usepackage{epsfig,ifthen,amsmath,url,hyperref}

\usepackage{DotArrow}

\title{The DotArrow-Package\\ -- Dotted Extendable Arrows --}
\author{Sven Schneider}

\setlength{\parindent}{0pt}
\begin{document}
\maketitle

\begin{abstract}
This package defines a new extendable arrow. This time its a dotted one. Other interesting packages are \verb+extPfeil+\footnote{\url{http://tug.ctan.org/tex-archive/macros/latex/contrib/extpfeil/}} \verb+symbols+\footnote{\url{http://www.ctan.org/tex-archive/info/symbols/comprehensive/}} \verb+extarrows+\footnote{\url{http://tug.ctan.org/tex-archive/macros/latex/contrib/extarrows/}}
\verb+chemarrow+\footnote{\url{http://tug.ctan.org/tex-archive/macros/latex/contrib/chemarrow/}}.
\end{abstract}
\tableofcontents
\section{Simple Usage}
\DescribeMacro{\dotarrow}
	$S\dotarrow{\kappa}S^\prime$\\
	\verb+$S\dotarrow{\kappa}S^\prime$+
\section{Package - Options}
\DescribeMacro{Option:autosep**}
	These Package-Options can be used to adjust the space on left and right to the label. The default is \verb+autosep03+.

	\begin{center}
	\begin{tabular}{ll}
	autosep00 & \DotArrowSetSep{0.0em}$S\dotarrow{\kappa}S^\prime$\\
	autosep01 & \DotArrowSetSep{0.1em}$S\dotarrow{\kappa}S^\prime$\\
	autosep02 & \DotArrowSetSep{0.2em}$S\dotarrow{\kappa}S^\prime$\\
	autosep03 & \DotArrowSetSep{0.3em}$S\dotarrow{\kappa}S^\prime$\\
	autosep04 & \DotArrowSetSep{0.4em}$S\dotarrow{\kappa}S^\prime$\\
	autosep05 & \DotArrowSetSep{0.5em}$S\dotarrow{\kappa}S^\prime$\\
	autosep06 & \DotArrowSetSep{0.6em}$S\dotarrow{\kappa}S^\prime$\\
	autosep07 & \DotArrowSetSep{0.7em}$S\dotarrow{\kappa}S^\prime$\\
	autosep08 & \DotArrowSetSep{0.8em}$S\dotarrow{\kappa}S^\prime$\\
	autosep09 & \DotArrowSetSep{0.9em}$S\dotarrow{\kappa}S^\prime$\\
	autosep10 & \DotArrowSetSep{1.0em}$S\dotarrow{\kappa}S^\prime$
	\end{tabular}
	\end{center}

\DescribeMacro{Option:autoraise**}
	These Package-Options can be used to adjust the space between label and arrow. The default is \verb+autosep06+.

	\begin{center}
	\begin{tabular}{ll}
	autoraise00 & \DotArrowSetRaise{0.0ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise01 & \DotArrowSetRaise{0.1ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise02 & \DotArrowSetRaise{0.2ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise03 & \DotArrowSetRaise{0.3ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise04 & \DotArrowSetRaise{0.4ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise05 & \DotArrowSetRaise{0.5ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise06 & \DotArrowSetRaise{0.6ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise07 & \DotArrowSetRaise{0.7ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise08 & \DotArrowSetRaise{0.8ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise09 & \DotArrowSetRaise{0.9ex}$S\dotarrow{\kappa}S^\prime$\\
	autoraise10 & \DotArrowSetRaise{1.0ex}$S\dotarrow{\kappa}S^\prime$
	\end{tabular}
	\end{center}

\DescribeMacro{Option:head*}
	These Package-Options can be used to choose a different head. The default is \verb+head1+.

	\begin{center}
	\begin{tabular}{ll}
	head1 & \DotArrowSetHead{\ensuremath{\succ}}$S\dotarrow{\kappa}S^\prime$\\
	head2 & \DotArrowSetHead{\ensuremath{>}}$S\dotarrow{\kappa}S^\prime$\\
	head3 & \DotArrowSetHead{\ensuremath{\gg}}$S\dotarrow{\kappa}S^\prime$
	\end{tabular}
	\end{center}

\section{Commands}
\DescribeMacro{\DotArrowSetSep}
	Select a new separation-value. \verb+\DotArrowSetSep{0.3em}+

\DescribeMacro{\DotArrowSetRaise}
	Select a new raisevalue. \verb+\DotArrowSetRaise{0.6ex}+

\DescribeMacro{\DotArrowSetHead}
	Select a new arrowhead. \verb+\DotArrowSetHead{\ensuremath{\succ}}+

\end{document}
%</driver>

%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{DotArrow}[2007/02/12 draw dotted arrows]

\RequirePackage{ifthen}

\PackageInfo{DotArrow}{This is the DotArrow-Package-0.02a}

% ####################################################
% Define Setters
% ####################################################
\newcommand{\DotArrowSetRaise}[1]{\setlength{\AUTORAISE}{#1}}
\newcommand{\DotArrowSetSep}[1]{\setlength{\AUTOSEP}{#1}}
\newcommand{\DotArrowSetHead}[1]{\renewcommand*{\ARROWHEAD}{\scalebox{.5}[.5]{#1}}}


\newlength{\AUTOSEP}
\setlength{\AUTOSEP}{0.3em}
\DeclareOption{autosep00}{\DotArrowSetSep{0.0em}}
\DeclareOption{autosep01}{\DotArrowSetSep{0.1em}}
\DeclareOption{autosep02}{\DotArrowSetSep{0.2em}}
\DeclareOption{autosep03}{\DotArrowSetSep{0.3em}}
\DeclareOption{autosep04}{\DotArrowSetSep{0.4em}}
\DeclareOption{autosep05}{\DotArrowSetSep{0.5em}}
\DeclareOption{autosep06}{\DotArrowSetSep{0.6em}}
\DeclareOption{autosep07}{\DotArrowSetSep{0.7em}}
\DeclareOption{autosep08}{\DotArrowSetSep{0.8em}}
\DeclareOption{autosep09}{\DotArrowSetSep{0.9em}}
\DeclareOption{autosep10}{\DotArrowSetSep{1.0em}}


\newlength{\AUTORAISE}
\setlength{\AUTORAISE}{0.6ex}
\DeclareOption{autoraise00}{\DotArrowSetRaise{0.0ex}}
\DeclareOption{autoraise02}{\DotArrowSetRaise{0.2ex}}
\DeclareOption{autoraise04}{\DotArrowSetRaise{0.4ex}}
\DeclareOption{autoraise06}{\DotArrowSetRaise{0.6ex}}
\DeclareOption{autoraise08}{\DotArrowSetRaise{0.8ex}}
\DeclareOption{autoraise10}{\DotArrowSetRaise{1.0ex}}
\DeclareOption{autoraise12}{\DotArrowSetRaise{1.2ex}}
\DeclareOption{autoraise14}{\DotArrowSetRaise{1.4ex}}
\DeclareOption{autoraise16}{\DotArrowSetRaise{1.6ex}}

\newcommand*{\ARROWHEAD}{\scalebox{.5}[.5]{$\succ$}}
\DeclareOption{head1}{\DotArrowSetHead{\ensuremath{\succ}}}
\DeclareOption{head2}{\DotArrowSetHead{\ensuremath{>}}}
\DeclareOption{head3}{\DotArrowSetHead{\ensuremath{\gg}}}

\ProcessOptions\relax

% ##################################################
% \newlength - commands
% ##################################################
% width of the printed horizontal bars
\newlength{\actualWidth}
% the width of one horizontal bar
\newlength{\oneWidth}
% the width of the text on top of the arrow
\newlength{\labelWidth}

% second store for the \labelWidth (the \labelWidth is used for calculation)
\newlength{\labelWidthBack}
% the distance to go backwards/forwards to print the 
% label/to print the arrowhead
\newlength{\captionStart}

% the distance of the bars from the baseline
\newlength{\moveUpBars}
% the distance of the label from the baseline
\newlength{\moveUpLabel}

% the distance the arrowhead is moved up
\newlength{\moveSuccHeight}
\newlength{\succHeight}
% \newcommand*{\ARROWHEAD}{\scalebox{.5}[.5]{$\succ$}}

% ##################################################
% \onePartX : prints one horizontal bar
% ##################################################
\newlength{\WIDTH}
\setlength{\WIDTH}{.4pt}

% this is one single horizontal bar
% \newcommand{\onePartX}{\raisebox{\moveUpBars}{\rule{2pt}{\WIDTH}}}
\newcommand*{\onePartX}{\raisebox{\moveUpBars}{\rule{2pt}{\WIDTH}}}
% oneWidth is the width of one such bar
\settowidth{\oneWidth}{\onePartX}

% ##################################################
% \allPartFront : print the first bar without any space around it
% ##################################################
\newcommand{\allPartFront}{
	% determine the actual width of the horizontal bars:
	\setlength{\actualWidth}{0pt}
	\onePartX%
	\addtolength{\labelWidth}{-\oneWidth}
	\addtolength{\actualWidth}{\oneWidth}
}

% ##################################################
% \allPartFront : prints all further bars with space on the left side
% ##################################################
\newcommand{\allPart}{%
	\ifthenelse{\labelWidth > 0}{%
		\hspace*{1.5pt}%
		\addtolength{\labelWidth}{-1.5pt}%
		\onePartX%
		\addtolength{\labelWidth}{-\oneWidth}%
		\addtolength{\actualWidth}{\oneWidth}%
		\addtolength{\actualWidth}{1.5pt}%
		\allPart%
	}{%
	}%
}%

% ##################################################
% \dotarrow : draws the whole arrow
% ##################################################
\newcommand{\dotarrow}[1]{%
	\setlength{\moveUpBars}{.8ex}%
	\addtolength{\moveUpBars}{-.5\WIDTH}%
	\setlength{\moveUpLabel}{\AUTORAISE}%
	\addtolength{\moveUpLabel}{\moveUpBars}%
	\addtolength{\moveUpLabel}{\WIDTH}%
	% print a little space at the left side
	\;%
	% get the width of the label
	\settowidth{\labelWidthBack}{\hspace*{\AUTOSEP}\scriptsize\ensuremath{#1}\hspace*{\AUTOSEP}}%
	\setlength{\labelWidth}{\labelWidthBack}%
	\setlength{\captionStart}{\labelWidth}%
	% and print the horizontal bars
	\allPartFront{}\allPart%
	% determine the space to go back to print the label
	\addtolength{\captionStart}{\actualWidth}%
	\setlength{\captionStart}{.5\captionStart}%
	% now go back
	\hspace*{-\captionStart}%
	% print the label
	\raisebox{\moveUpLabel}{\hspace*{\AUTOSEP}\scriptsize\ensuremath{#1}\hspace*{\AUTOSEP}}%
	% determine the space to go forward
	\setlength{\captionStart}{\actualWidth}%
	\addtolength{\captionStart}{-\labelWidthBack}%
	\setlength{\captionStart}{.5\captionStart}%
	% and go forward
	\hspace*{\captionStart}%
	% print the top of the arrow
	% arrowhead distance-calculation:
	\settoheight{\succHeight}{\ARROWHEAD}%
	\setlength{\succHeight}{.5\succHeight}%
	\setlength{\moveSuccHeight}{\moveUpBars}%
	\addtolength{\moveSuccHeight}{.5\WIDTH}%
	\addtolength{\moveSuccHeight}{-\succHeight}%
	\raisebox{\moveSuccHeight}{\ARROWHEAD}%
	% print a little space at the right side
	\;%
}%
%</package>