summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/oberdiek/chemarr.sty
blob: defcfb3b925f3eeaa3e0e3f84d9ca589ae99d9a4 (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
% File:        chemarr.sty
% Version:     2001/06/22 v1.1
% Author:      Heiko Oberdiek
% Email:       <oberdiek@uni-freiburg.de>
%
% Copyright:   Copyright (C) 2001 Heiko Oberdiek.
%
%              This program 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.
%
% Function:    Very often chemists need a longer version
%              of reaction arrows (\rightleftharpoons) with
%              the possibility to put text above and below.
%              Analogous to amsmath's \xrightarrow and
%              \xleftarrow this package provides the macro
%              \xrightleftharpoons.
%
% Requirement: amsmath
% Use:         LaTeX: \usepackage{chemarr}
%              \xrightleftharpoons[below]{above}
%
% History:     2001/06/21 v1.0:
%                * first public version
%              2001/06/22 v1.1:
%                * documentation fixes
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chemarr}%
  [2001/06/22 v1.1 Chemical reaction arrows (HO)]
%
\RequirePackage{amsmath}
% The package amsmath is needed for the following commands:
%   \ext@arrow, \@ifnotempty, \arrowfill@
%   \relbar, \std@minus
%   \@ifempty, \@xifempty, \@xp
%
% In fontmath.ltx \rightleftharpoons is defined with
% a vertical space of 2pt.
%
\newcommand{\xrightleftharpoons}[2][]{%
  \ensuremath{%
    \mathrel{%
      \settoheight{\dimen@}{\raise 2pt\hbox{$\rightharpoonup$}}%
      \setlength{\dimen@}{-\dimen@}%
      \edef\CA@temp{\the\dimen@}%
      \settoheight\dimen@{$\rightleftharpoons$}%
      \addtolength{\dimen@}{\CA@temp}%
      \raisebox{\dimen@}{%
        \rlap{%
          \raisebox{2pt}{%
            $%
            \ext@arrow 0359\rightharpoonupfill@{\hphantom{#1}}{#2}%
            $%
          }%
        }%
        \hbox{%
          $%
          \ext@arrow 3095\leftharpoondownfill@{#1}{\hphantom{#2}}%
          $%
        }%
      }%
    }%
  }%
}
\newcommand*{\leftharpoondownfill@}{%
  \arrowfill@\leftharpoondown\relbar\relbar
}
\newcommand*{\rightharpoonupfill@}{%
  \arrowfill@\relbar\relbar\rightharpoonup
}
\endinput