summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/subdepth/subdepth.sty
blob: 010b190bfbe62c38b7ddecf1a6cf67b96f9a180b (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
%%
%% This is file `subdepth.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% subdepth.dtx  (with options: `package')
%% 
%%   __________________________________
%%   Copyright (C) 2007  Will Robertson
%% 
%%   License information appended.
%% 
\ProvidesPackage{subdepth}
  [2007/09/02 v0.1 Unify subscript depths]
\@ifpackageloaded{dchem}{\PackageWarning{subdepth incorporated within dchem; aborting loading}\endinput}{}
\newif\if@wspr@sup@low@
\DeclareOption{low-sup}{\@wspr@sup@low@true}
\ProcessOptions
\addto@hook\every@math@size{\dch@scr@hook}
\def\dch@scr@adjust{\@ifundefined{dch@sizet\f@size}%
  {\expandafter\dch@set@script\csname dch@sizet\f@size\endcsname}%
  {\csname dch@sizet\f@size\endcsname}}
\def\dch@set@script#1{%
  \begingroup % fontdimen settings are global anyway
    \frozen@everymath{}% Prevent recursion!
    \let#1\@empty
    \let\dch@do@one\relax
    \dch@set@one\scriptscriptstyle\scriptscriptfont#1\ssf@size
    \dch@set@one\scriptstyle\scriptfont#1\sf@size
    \dch@set@one\textstyle\textfont#1\f@size
  \endgroup
  #1}
\def\dch@set@one#1#2#3#4{%
  \@ifundefined{dch@size#4}%
   {\expandafter\xdef\csname dch@size#4\endcsname{%
      \unless\if@wspr@sup@low@
        \fontdimen13\the#2\tw@=\the\fontdimen13#2\tw@
        \fontdimen14\the#2\tw@=\the\fontdimen14#2\tw@
        \fontdimen15\the#2\tw@=\the\fontdimen15#2\tw@
      \fi
      \fontdimen16\the#2\tw@=\the\fontdimen16#2\tw@
      \fontdimen17\the#2\tw@=\the\fontdimen17#2\tw@}%
  }{\csname dch@size#4\endcsname}%
  \setbox\z@\hbox{$#1H_2$}\@tempdima\dp\z@
  \setbox\z@\hbox{$#1H_2^{+\vrule \@height 1em}$}%
  \ifdim\@tempdima<\dp\z@
    \@tempdima\dimexpr (\@tempdima+\dp\z@)/2 \relax
    \@tempdimb\dimexpr (\dp\z@-\@tempdima+\ht\z@-1em) \relax
    \xdef#3{#3\dch@do@one#2{\the\@tempdimb}{\the\@tempdima}}%
  \fi}
\def\dch@do@one#1#2#3{%
  \unless\if@wspr@sup@low@
    \fontdimen13#1\tw@#2\relax
    \fontdimen14#1\tw@\fontdimen13#1\tw@
    \fontdimen15#1\tw@\fontdimen13#1\tw@
  \fi
  \fontdimen\sixt@@n#1\tw@#3
  \fontdimen17#1\tw@
  \fontdimen\sixt@@n#1\tw@}%
\let\dch@scr@hook\dch@scr@adjust
\ifx\glb@currsize\f@size
  \dch@scr@adjust
\fi
%% 
%% Copyright (C) 2007 by Will Robertson <wspr81@gmail.com>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status)
%% by Will Robertson.
%% 
%% This work consists of the file  subdepth.dtx
%%           and the derived files subdepth.pdf,
%%                                 subdepth.sty, and
%%                                 subdepth.ins.
%% 
%%
%% End of file `subdepth.sty'.