summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/subdepth
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/subdepth
Initial commit
Diffstat (limited to 'macros/latex/contrib/subdepth')
-rw-r--r--macros/latex/contrib/subdepth/README14
-rw-r--r--macros/latex/contrib/subdepth/subdepth.dtx252
-rw-r--r--macros/latex/contrib/subdepth/subdepth.ins61
-rw-r--r--macros/latex/contrib/subdepth/subdepth.pdfbin0 -> 107960 bytes
4 files changed, 327 insertions, 0 deletions
diff --git a/macros/latex/contrib/subdepth/README b/macros/latex/contrib/subdepth/README
new file mode 100644
index 0000000000..09656e19cf
--- /dev/null
+++ b/macros/latex/contrib/subdepth/README
@@ -0,0 +1,14 @@
+___________________
+The SUBDEPTH package
+v0.1
+
+This package uses some Donald Arseneau code to unify the heights
+of math subscripts regardless of the presence of a superscript above.
+Compare $M_n$ to $M_n'$ in regular LaTeX for why this can be desirable.
+
+__________________________
+Packaged by Will Robertson
+wspr 81 [at] gmail [dot] com
+
+Copyright 2007
+Distributed under the LaTeX Project Public License
diff --git a/macros/latex/contrib/subdepth/subdepth.dtx b/macros/latex/contrib/subdepth/subdepth.dtx
new file mode 100644
index 0000000000..2edf4c133f
--- /dev/null
+++ b/macros/latex/contrib/subdepth/subdepth.dtx
@@ -0,0 +1,252 @@
+% \iffalse
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+____________________
+The SUBDEPTH package
+v0.1
+
+This package uses some Donald Arseneau code to unify the heights
+of math subscripts regardless of the presence of a superscript above.
+Compare $M_n$ to $M_n'$ in regular LaTeX for why this can be desirable.
+
+__________________________
+Packaged by Will Robertson
+wspr 81 [at] gmail [dot] com
+
+Copyright 2007
+Distributed under the LaTeX Project Public License
+%</readme>
+%<*internal>
+\fi
+\begingroup
+%</internal>
+%<*batchfile>
+\input docstrip.tex
+\keepsilent
+\preamble
+
+ __________________________________
+ Copyright (C) 2007 Will Robertson
+
+ License information appended.
+
+
+\endpreamble
+\postamble
+
+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.
+
+\endpostamble
+\askforoverwritefalse
+\generate{\file{subdepth.sty}{\from{subdepth.dtx}{package}}}
+%</batchfile>
+%<batchfile>\endbatchfile
+%<*internal>
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
+\nopreamble\nopostamble
+\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
+\generate{\file{prepare.sh}{\from{\jobname.dtx}{prepare}}}
+\endgroup
+\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
+\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
+%</internal>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+\newsavebox\wspr
+\savebox\wspr{\Huge $M_n$ $M_n'$}
+\usepackage{subdepth}
+\usepackage{url}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+%
+%
+% \fi
+%
+% \CheckSum{0}
+% \makeatletter
+%
+% \title{Unify subscript depths}
+% \author{Code by Donald Arseneau\\ Packaged by Will Robertson}
+% \GetFileInfo{subdepth.sty}
+% \date{\filedate \qquad \fileversion}
+%
+% \maketitle
+%
+% \begin{quote}\small
+% This small package comes essentially verbatim from the following |c.t.t.| post by Donald Arseneau: \url{http://groups.google.com/group/comp.text.tex/msg/f207c7535810d2c1}.\footnote{I am distributing this package with the LPPL license, while I assume that Donald's original code to be in the public domain. This license stuff can be a bit messy sometimes.}
+% \end{quote}
+%
+% Consider the standard output of a subscript with and without a superscript above:
+% \begin{center}
+% \usebox\wspr
+% \end{center}
+% The second $n$ is lower due to \TeX's default of jiggling the space when there are both superscripts and subscripts attached to a math symbol.
+%
+% In some circumstances, this isn't particularly desirable; this package adjusts \LaTeX's behaviour to unify the position of the subscript in both cases:
+% \begin{center}
+% \Huge $M_n$ $M_n'$
+% \end{center}
+%
+% Notice that to compensate for the higher subscript, the superscript position is slightly raised. The |[low-sup]| package option will suppress this change to the height of the superscripts.
+%
+%
+% \StopEventually{}
+%
+% \clearpage
+% \part{\textsf{\jobname} implementation}
+%\iffalse
+%<*package>
+%\fi
+%
+% This is the package.
+%
+% \begin{macrocode}
+\ProvidesPackage{subdepth}
+ [2007/09/02 v0.1 Unify subscript depths]
+% \end{macrocode}
+%
+% \changes{v0.1}{2007/08/30}{Initial version.}
+% \PrintChanges
+%
+% \section{Loading and package options}
+%
+% Since this package is extracted from \textsf{dchem}, don't bother if that package is already loaded:
+% \begin{macrocode}
+\@ifpackageloaded{dchem}{\PackageWarning{subdepth incorporated within dchem; aborting loading}\endinput}{}
+% \end{macrocode}
+%
+% Package option to lower the superscript height.
+% \begin{macrocode}
+\newif\if@wspr@sup@low@
+\DeclareOption{low-sup}{\@wspr@sup@low@true}
+\ProcessOptions
+% \end{macrocode}
+%
+% \section{Don's code}
+%
+% \textit{The comments that follow are Donald's. His out-commented diagnostic messages have been removed for clarity.}
+%
+% Set the fontdimen parameters for subscript and superscript position
+% so that |C_2H_5^+| has both subscripts at the same vertical position.
+% Do this by actually comparing |H_2| with |H_2^+| and adjusting the font's
+% sub-lowering (16, 17) by half the difference and setting the super-
+% raising (13, 14, 15) to the matching position. The settings (for
+% all three fonts t,s,ss) are determined once per text-font-size and
+% stored in the macro |\dch@sizet<size>| (e.g.\ |\csname dch@sizet12\endcsname|).
+% Since some specific fonts are used in different roles at different
+% text-font-sizes, the original (tfm) settings for each particular font
+% are saved in a macro |\dch@size<size>| (no "t") before they are changed
+% for the first time. When that font appears in a different role for
+% another text-font size, those original settings are restored first
+% before making changes.
+%
+% \begin{macrocode}
+\addto@hook\every@math@size{\dch@scr@hook}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+% textfont done last so it takes precedence in case it is the same as
+% another style (like at \cmd\tiny)
+%
+% |#1| = single-token command name for executing settings
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+% ({\itshape Added conditional for the |[low-sup]| package option}):
+% \begin{macrocode}
+\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}$}%
+% \end{macrocode}
+% {\itshape I've adapted Donald's code to use e\TeX\ methods for dimension calculating. \cmd\@tempdima\ is the `new sub lowering'. In \cmd\@tempdimb, the first two terms are the `adjustment', the second two the `new super raising'.}
+% \begin{macrocode}
+ \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}
+% \end{macrocode}
+% ({\itshape Added conditional for the |[low-sup]| package option}):
+% \begin{macrocode}
+\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@}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+\let\dch@scr@hook\dch@scr@adjust
+\ifx\glb@currsize\f@size
+ \dch@scr@adjust
+\fi
+% \end{macrocode}
+%
+%\iffalse
+%</package>
+%<*prepare>
+rm subdepth.zip
+latex subdepth.dtx
+mv README.txt README
+zip subdepth.zip subdepth.dtx subdepth.ins subdepth.pdf README
+%</prepare>
+%\fi
+%
+% \typeout{*************************************************************}
+% \typeout{*}
+% \typeout{* To finish the installation you have to move the following}
+% \typeout{* file into a directory searched by XeTeX:}
+% \typeout{*}
+% \typeout{* \space\space\space subdepth.sty}
+% \typeout{*}
+% \typeout{*************************************************************}
+%
+\endinput
diff --git a/macros/latex/contrib/subdepth/subdepth.ins b/macros/latex/contrib/subdepth/subdepth.ins
new file mode 100644
index 0000000000..10500d96fa
--- /dev/null
+++ b/macros/latex/contrib/subdepth/subdepth.ins
@@ -0,0 +1,61 @@
+%%
+%% This is file `subdepth.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% subdepth.dtx (with options: `batchfile')
+%%
+%% __________________________________
+%% Copyright (C) 2007 Will Robertson
+%%
+%% License information appended.
+%%
+%%
+\input docstrip.tex
+\keepsilent
+\preamble
+
+ __________________________________
+ Copyright (C) 2007 Will Robertson
+
+ License information appended.
+
+\endpreamble
+\postamble
+
+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.
+
+\endpostamble
+\askforoverwritefalse
+\generate{\file{subdepth.sty}{\from{subdepth.dtx}{package}}}
+\endbatchfile
+%%
+%% 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.ins'.
diff --git a/macros/latex/contrib/subdepth/subdepth.pdf b/macros/latex/contrib/subdepth/subdepth.pdf
new file mode 100644
index 0000000000..16fedccc7c
--- /dev/null
+++ b/macros/latex/contrib/subdepth/subdepth.pdf
Binary files differ