metafont
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

chemarrow.sty
text/x-tex

Download raw (7.9 KB)

%
% 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}}}