summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chemarrow/chemarrow.sty
blob: fae4e2e841ba574852498e99d6e2b3de53769d5a (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
%
% New arrow heads for chemical reaction schemes
%
% Author: Thomas Schroeder schroeder@ictw.chemie.uni-karlsruhe.de
%
% Version: 0.7 February 3 2001
%
% macro chemarrow.sty based on TeXBook and a source file provided
% by Andreas Hertwig Andreas.Hertwig@chemie.uni-karlsruhe.de
%
% font arrow.mf based on cryst.mf by Ulrich Mueller
%
%----------------------------------------------------------------------------
% TeX Usage of various Chemical Arrow drawing macros
%-----------------------------------------------------------------------------
% \chemarrow                                % simple unsized reaction arrow
% \larrowfill{90pt}                         % parameter is length of harpoon
% \rarrowfill{90pt}                         % parameter is length of harpoon
% \rightleftharpoonsfill{90pt}              % parameter is length of harpoons
% \leftrightharpoonsfill{90pt}              % parameter is length of harpoons
% \autoleftarrow{upper_stuff}{lower_stuff}          % sizes automatically
% \autorightarrow{upper_stuff}{lower_stuff}         % sizes automatically
% \autorightleftharpoons{upper_stuff}{lower_stuff}  % sizes automatically
% \autoleftrightharpoons{upper_stuff}{lower_stuff}  % sizes automatically
%----------------------------------------------------------------------------
\DeclareFontFamily{U}{arr}{\hyphenchar\font=-1}
%\DeclareFontShape{U}{arr}{m}{n}{<9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88> <29.86> <35.83> <43.00> <51.6> <61.92> <74.3> <89.16> <107.0> arrow}{}
\DeclareFontShape{U}{arr}{m}{n}{ <-> arrow}{}
\newcommand{\arro}{\usefont{U}{arr}{m}{n}}
%-----------------------------------------------------------------------------
% definitions taken from `am-plain.tex'
%
\catcode`@=11
\newdimen\z@ \z@=0pt % can be used both for 0pt and 0
\newskip\z@skip \z@skip=0pt plus0pt minus0pt
\def\m@th{\mathsurround=\z@}%   from am-plain.tex
%-----------------------------------------------------------------------------
% dimensions used in calculating the `auto' fill macros
%
 \newdimen\autotop  \newdimen\autobottom    \newdimen\autosize
%-----------------------------------------------------------------------------
% Same as `\rightarrowfill' from the TeXBook, but with `\leftharpoondown'
%
\def\leftharpoondownfill{$\m@th\mathord{\textrm{\arro\symbol{70}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{71}}}$}
%-----------------------------------------------------------------------------

\def\leftharpoonupfill{$\m@th\mathord{\textrm{\arro\symbol{69}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{71}}}$}


%-----------------------------------------------------------------------------
% Same as `\rightarrowfill' from the TeXBook, but with `\rightharpoondown'
%

\def\rightharpoonupfill{$\m@th\mathord{\textrm{\arro\symbol{71}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{66}}}$}


\def\rightharpoondownfill{$\m@th\mathord{\textrm{\arro\symbol{71}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{67}}}$}


%-----------------------------------------------------------------------------

\def\leftchemarrowfill{$\m@th\mathord{\textrm{\arro\symbol{68}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{71}}}$}

%\def\rightchemarrowfill{$\m@th\mathord-\mkern-6mu%
%  \cleaders\hbox{$\mkern-2mu\mathord-\mkern-2mu$}\hfill
%  \mkern-6mu\mathord{\textrm{\arro\symbol{65}}}$}

\def\rightchemarrowfill{$\m@th\mathord{\textrm{\arro\symbol{71}}}\mkern-6mu%
  \cleaders\hbox{$\mkern-2mu\mathord{\textrm{\arro\symbol{71}}}\mkern-2mu$}\hfill
  \mkern-6mu\mathord{\textrm{\arro\symbol{65}}}$}


%-----------------------------------------------------------------------------
% Similar to `\rightleftharpoons from the TeXBook,
%    except using `\rightharpoonupfill' and `\rightharpoondownfill'.
%
% The first parameter is the length of the harpoons.
%
\def\rightleftharpoonsfill#1{%
\mathop{\vcenter{\hbox{\ooalign{\raise.4ex
          \hbox{$\hbox to#1{\hspace*{.05em}\rightharpoonupfill}$}\crcr
        $\hbox to#1{\leftharpoondownfill\hspace*{.05em}}$}}}}\limits}
%-----------------------------------------------------------------------------

\def\leftrightharpoonsfill#1{%
\mathop{\vcenter{\hbox{\ooalign{\raise.4ex
          \hbox{$\hbox to#1{\leftharpoonupfill\hspace*{.05em}}$}\crcr
        $\hbox to#1{\hspace*{.05em}\rightharpoondownfill}$}}}}\limits}


%-----------------------------------------------------------------------------
%   define the simplest possible chemical reaction right arrow, unsized
%
\def\chemarrow{\textrm{\arro\symbol{65}}}
%-----------------------------------------------------------------------------

%-----------------------------------------------------------------------------
% Make a long leftarrow with its length specified by the passed parameter:
% Usage: \larrowfill{125pt}  or  \larrowfill{1.0in}   or   \larrowfill{2.2cm}
%
\def\larrowfill#1{\mathop{\hbox to #1{\mathstrut\leftchemarrowfill}}\limits}
%-----------------------------------------------------------------------------

%-----------------------------------------------------------------------------
% Make a long rightarrow with its length specified by the passed parameter:
% Usage: \rarrowfill{125pt}  or  \rarrowfill{1.0in}   or   \rarrowfill{2.2cm}
%
\def\rarrowfill#1{\mathop{\hbox to #1{\mathstrut\rightchemarrowfill}}\limits}
%-----------------------------------------------------------------------------

%-----------------------------------------------------------------------------
% Make a long leftarrow with its length slightly longer than the larger
%    of the lower and upper parameters:
%
% Usage: \autoleftarrow{upper_stuff}{lower_stuff}
%
\def\autoleftarrow#1#2{{%
    \setbox0=\hbox{#1}\autotop=\wd0\setbox0=\hbox{#2}\autobottom=\wd0%
    \ifdim\autobottom>\autotop\autosize=\autobottom\else\autosize=\autotop\fi%
    \advance\autosize by 2em%
    \mathop{\hbox to \autosize{\mathstrut\leftchemarrowfill}}\limits%
    ^{\hbox{#1}}_{\hbox{#2}}}}%
%-----------------------------------------------------------------------------

%-----------------------------------------------------------------------------
% Make a long rightarrow with its length slightly longer than the larger
%    of the lower and upper parameters:
%
% Usage: \autorightarrow{upper_stuff}{lower_stuff}
%
\def\autorightarrow#1#2{{%
    \setbox0=\hbox{#1}\autotop=\wd0\setbox0=\hbox{#2}\autobottom=\wd0%
    \ifdim\autobottom>\autotop\autosize=\autobottom\else\autosize=\autotop\fi%
    \advance\autosize by 2em%
    \mathop{\hbox to \autosize{\mathstrut\rightchemarrowfill}}\limits%
    ^{\hbox{#1}}_{\hbox{#2}}}}%
%-----------------------------------------------------------------------------

%-----------------------------------------------------------------------------
\def\autorightleftharpoons#1#2{%
\setbox0=\hbox{#1}\autotop=\wd0\setbox0=\hbox{#2}\autobottom=\wd0%
\ifdim\autobottom>\autotop\autosize=\autobottom\else\autosize=\autotop\fi%
\advance\autosize by 2em%
\mathop{\vcenter{\hbox{\ooalign{\raise.4ex%
          \hbox{$\hbox to \autosize{\hspace*{.05em}\rightharpoonupfill}$}\crcr%
                $\hbox to \autosize{\leftharpoondownfill\hspace*{.05em}}$}}}}%
            \limits^{\hbox{#1}}_{\hbox{#2}}}
%-----------------------------------------------------------------------------

\def\autoleftrightharpoons#1#2{%
\setbox0=\hbox{#1}\autotop=\wd0\setbox0=\hbox{#2}\autobottom=\wd0%
\ifdim\autobottom>\autotop\autosize=\autobottom\else\autosize=\autotop\fi%
\advance\autosize by 2em%
\mathop{\vcenter{\hbox{\ooalign{\raise.4ex%
          \hbox{$\hbox to \autosize{\leftharpoonupfill\hspace*{.05em}}$}\crcr%
                $\hbox to \autosize{\hspace*{.05em}\rightharpoondownfill}$}}}}%
            \limits^{\hbox{#1}}_{\hbox{#2}}}