summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cursor/cursor.sty
blob: 880ab0219e47091a7929698bdcd200c99ba68c37 (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
%%%=====================================================
%%%  @LaTeX-file{
%%%     author          = "Werenfried F.M. Spit",
%%%     version         = "1.1",
%%%     date            = "20/01/1999",
%%%     filename        = "WSartikel.cls",
%%%     address         = "Berberisweg 488
%%%                     =  NL-3053 PL  Rotterdam
%%%                     =  Nederland",
%%%     e-mail          = "W.Spit@witbo.nl",
%%%     telephone       = "+31-10-4.186.136",
%%%     telephone2      = "+31-70-3.700.709",
%%%     telefax2        = "+31-70-3.600.098",
%%%     checksum        = "55762 134 325 4092",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "LaTeX2e documentstyle",
%%%     supported       = "yes",
%%%     abstract        = "cursors in formulas",
%%% }
%%%=====================================================
%%%
%%% usage:
%%%  \Lc{<formulapart>} puts a left-pointing cursor below <formulapart>;
%%%                     the cursorheight and width are adapted to it
%%%  \Rc{<formulapart>} puts a right-pointing cursor below <formulapart>;
%%%  \LRc{<p1>}{<p2>}   puts a left and right-pointing cursor below <p1>
%%                      and <p2>
%%%
%%% if the formulapart is empty a standard width is used instead of an
%%% adapted width
%%%
%%% \cursorheight{<formula>} print <formula> and adapt the heights of the
%%% cursor(s) in it to the heigth of the complete formula
%%%
%%%
%%% all heigths and widths are calculated for display style printing
%%% all commands can be used in math mode only except
%%%
%%% \cursorformula{<formula>} print formula as displayed formula and
%%% adapt the heights of the cursor(s)in it to the heigth of the complete formula
%%%
%%% adaptable parameters:
%%%
%%%  \cursorlinew    line width cursor     (0.5pt)
%%%
%%% version history
%%%           20  1.1      added \displaystyle to calculation of cursor width
%%%   1999/01/18  1.0      first working version
%%%
%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{cursor.sty}[1999/01/20 v1.1 Specialized document class (WS)]
\newlength{\ruled}
\newlength{\ruleh}
\newlength{\rulew}
\newlength{\rulewr}
\newlength{\rulewl}

\newlength{\cursorlinew} \setlength{\cursorlinew}{0.5pt}



\def\cursorformula#1{$$\cursorheight{#1}$$}

\def\cursorheight#1{\bgroup%
\let\LRc=\relax%
\let\Lc=\relax%
\let\Rc=\relax%
\settoheight{\ruleh}{$\displaystyle #1$}\settodepth{\ruled}{$\displaystyle #1$}%
\addtolength{\ruled}{0.5ex}%
\addtolength{\ruleh}{\ruled}%
\addtolength{\ruleh}{0.5ex}%
\let\Lc=\l@cursor%
\let\Rc=\r@cursor%
\let\LRc=\lr@cursor%
#1
\egroup}



\def\L@cursor#1{%
\settoheight{\ruleh}{$\displaystyle #1$}%
\settodepth{\ruled}{$\displaystyle #1$}%
\addtolength{\ruled}{0.5ex}%
\addtolength{\ruleh}{\ruled}%
\addtolength{\ruleh}{0.5ex}
\l@cursor{#1}%
}


\def\R@cursor#1{%
\settoheight{\ruleh}{$\displaystyle #1$}%
\settodepth{\ruled}{$\displaystyle #1$}%
\addtolength{\ruled}{0.5ex}%
\addtolength{\ruleh}{\ruled}%
\addtolength{\ruleh}{0.5ex}
\r@cursor{#1}%
}


\def\LR@cursor#1#2{%
\settoheight{\ruleh}{$\displaystyle #1 #2$}%
\settodepth{\ruled}{$\displaystyle #1 #2$}%
\addtolength{\ruled}{0.5ex}%
\addtolength{\ruleh}{\ruled}%
\addtolength{\ruleh}{0.5ex}
\lr@cursor{#1}{#2}%
}


\def\l@cursor#1{\settowidth{\rulewl}{$#1$}%
\ifdim\rulewl=\z@\rulewl=1em\else\settowidth{\rulewl}{$\displaystyle #1\,$}\fi%
\,\rlap{\rule[-\ruled]{\cursorlinew}{\ruleh}%
\rule[-\ruled]{\rulewl}{\cursorlinew}}\,#1}

\def\r@cursor#1{\settowidth{\rulewr}{$#1$}%
\ifdim\rulewr=\z@\rulewr=1em\else\settowidth{\rulewr}{$\displaystyle\,#1$}\fi%
#1\,\llap{\rule[-\ruled]{\rulewr}{\cursorlinew}%
\rule[-\ruled]{\cursorlinew}{\ruleh}}\,}

\def\lr@cursor#1#2{%
\settowidth{\rulewl}{$#1$}\settowidth{\rulewr}{$#2$}%
\ifdim\rulewl=\z@\rulewl=1em\else\settowidth{\rulewl}{$\displaystyle #1\,$}\fi%
\ifdim\rulewr=\z@\rulewr=1em\else\settowidth{\rulewr}{$\displaystyle\,#2$}\fi%
#1\,\llap{\rule[-\ruled]{\rulewl}{\cursorlinew}}%
\rule[-\ruled]{\cursorlinew}{\ruleh}%
\rlap{\rule[-\ruled]{\rulewr}{\cursorlinew}}\,#2}


%\global
\global\let\Lc=\L@cursor
\global\let\Rc=\R@cursor
\global\let\LRc=\LR@cursor
\endinput