summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mh/mathstyle.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-10 23:13:28 +0000
committerKarl Berry <karl@freefriends.org>2012-05-10 23:13:28 +0000
commita97524f5ad4cdfcb20d204b202c4b588dab91544 (patch)
tree2263ffb7a3df06623339797e12d7d5deeda9f270 /Master/texmf-dist/source/latex/mh/mathstyle.dtx
parent70b47686cb689d8c5e4c6eecb58e7cd43240e92c (diff)
mh (10may12)
git-svn-id: svn://tug.org/texlive/trunk@26294 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/mh/mathstyle.dtx')
-rw-r--r--Master/texmf-dist/source/latex/mh/mathstyle.dtx94
1 files changed, 77 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/mh/mathstyle.dtx b/Master/texmf-dist/source/latex/mh/mathstyle.dtx
index 4e21d9853bc..a3d33a58efa 100644
--- a/Master/texmf-dist/source/latex/mh/mathstyle.dtx
+++ b/Master/texmf-dist/source/latex/mh/mathstyle.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
% Copyright (C) 1997-2003 by Michael J. Downes
-% Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com>
+% Copyright (C) 2007-2008 by Morten Hoegholm
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -13,7 +13,7 @@
%
% This work has the LPPL maintenance status "maintained".
%
-% This Current Maintainer of this work is Morten Hoegholm,
+% This Current Maintainer of this work is
% Lars Madsen, Will Robertson and Joseph Wright.
%
% This work consists of the main source file mathstyle.dtx
@@ -67,8 +67,7 @@
%<*install>
\input docstrip.tex
\Msg{************************************************************************}
-\Msg{* Installation}
-\Msg{* Package: mathstyle 2008/11/25 v0.88 Mathstyle (MH)}
+\Msg{* Installation for package: mathstyle}
\Msg{************************************************************************}
\keepsilent
@@ -79,7 +78,7 @@
This is a generated file.
Copyright (C) 1997-2003 by Michael J. Downes
-Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com>
+Copyright (C) 2007-2011 by Morten Hoegholm et al
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -91,7 +90,7 @@ LaTeX version 2005/12/01 or later.
This work has the LPPL maintenance status "maintained".
-This Current Maintainer of this work is Morten Hoegholm,
+This Current Maintainer of this work is
Lars Madsen, Will Robertson and Joseph Wright.
This work consists of the main source file mathstyle.dtx
@@ -127,10 +126,16 @@ and the derived files
%<*ignore>
\fi
%</ignore>
+%
+%<*driver>
+\ProvidesFile{mathstyle.drv}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{mathstyle}
+%<*package|driver>
+ [2011/08/03 v0.90 Tracking mathstyle implicitly]
+%</package|driver>
%<*driver>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{mathstyle.drv}%
- [2008/11/25 v0.88 mathstyle (MH)]
\documentclass{ltxdoc}
\CodelineIndex
\EnableCrossrefs
@@ -142,9 +147,10 @@ and the derived files
%</driver>
% \fi
%
+% \GetFileInfo{mathstyle.drv}
% \title{The \textsf{mathstyle} package}
-% \date{2008/08/13 v0.87}
-% \author{Morten H\o gholm \\\texttt{mh.ctan@gmail.com}}
+% \date{\filedate\quad\fileversion}
+% \author{Morten H\o gholm \\Maintainers: \texttt{mh.ctan@gmail.com}}
%
%
% \maketitle
@@ -199,17 +205,42 @@ and the derived files
% #1 {}\rlap{$\m@th \currentmathstyle {#2}$}}
% \end{verbatim}
%
+% \subsection{Package options}
%
+% This package has one set of options affecting the \verb|_| and \verb|^| characters:
%
-% \StopEventually{}
-% \part*{Implementation}
+% \begin{itemize}
+% \item\verb|\usepackage[mathactivechars]{mathstyle}|
+%
+% This is the default behaviour. Here, \verb|_| and \verb|^| are made into harmless
+% characters in text mode and behave as expected (for entering sub/superscript) when
+% inside math mode.
+% Certain code that assumes the catcodes of these characters may get confused about
+% this; see below for a possible fix.
%
+% \item\verb|\usepackage[activechars]{mathstyle}|
%
+% With this option, \verb|_| and \verb|^| are made into active characters for
+% entering sub/superscript mode in all cases---therefore, in text mode they will
+% produce a regular error (`Missing \$ inserted') indicating they are being used
+% out of place.
+%
+% \item\verb|\usepackage[noactivechars]{mathstyle}|
+%
+% This is the option most like to solve any compatibility problems. Here,
+% \verb|_| and \verb|^| retain their regular catcodes at all times and behave
+% in their default fashion. \textbf{However}, certain other features of this
+% package (such as \cs{currentmathstyle} inside a subscript) will then fail
+% to work, so only use this option as a last resort.
+% \end{itemize}
+%
+% \StopEventually{}
+% \part*{Implementation}
%
% \begin{macrocode}
%<*package>
-\ProvidesPackage{mathstyle}[2010/11/17 v0.89]
% \end{macrocode}
+%
% \begin{macro}{\@saveprimitive}
% A straight copy from \pkg{breqn}, see implementation details
% there. Of course, with a recent pdf\TeX\ (v1.40+), one can just
@@ -238,6 +269,7 @@ and the derived files
\splitfirstmark{\string\splitfirstmark:}%
\splitbotmark{\string\splitbotmark:}%
#1{\string#1}%
+ \@nil % for the \@car
\edef\@tempa{\expandafter\strip@prefix\meaning\@tempb}%
\edef\@tempb{\meaning#1}%
\ifx\@tempa\@tempb \global\let#2#1%
@@ -251,10 +283,27 @@ and the derived files
}
% \end{macrocode}
% \end{macro}
-% Do initial \cs{chardef} of \cs{mathstyle}.
+%
+% \begin{macro}{\everydisplay}
+% We need to keep track of whether we're in inline or display maths, and the only
+% way to do that is to add a switch inside \verb|\everydisplay|.
+% We act sensibly and preserve any of the previous contents of that token register
+% before adding our own code here.
% \begin{macrocode}
-\chardef\mathstyle=\z@
+\everydisplay=\expandafter{\the\everydisplay\chardef\mathstyle\z@}
% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\mathstyle}
+% A counter for the math style: 0--display, 1--text, 2--script, 3--scriptscript.
+% The logic is that display maths will explicitly
+% set \verb|\mathstyle| to zero (see above), so by default it is set to the
+% `text' maths style.
+% \begin{macrocode}
+\chardef\mathstyle\@ne
+% \end{macrocode}
+% \end{macro}
+%
% Save the four style changing primitives, \cs{mathchoice} and the
% fraction commands.
% \begin{macrocode}
@@ -315,6 +364,8 @@ and the derived files
\def\sb#1{\mathsub{\protect\subsupstyle#1}}%
\def\sp#1{\mathsup{\protect\subsupstyle#1}}%
% \end{macrocode}
+%
+% \begin{macro}{\mathchoice}
% \cs{mathchoice} is now just a switch. Note that this redefinition
% does not allow the arbitrary \meta{filler} of the \TeX\
% primitive. Very rarely used anyway.
@@ -338,17 +389,26 @@ and the derived files
\providecommand\@thirdoffour[4]{#3}
\providecommand\@fourthoffour[4]{#4}
% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\genfrac}
% The fractions. Note that this uses the same names as in
% \pkg{amsmath}. Much the same except here they call \cs{fracstyle}.
% \begin{macrocode}
\DeclareRobustCommand\genfrac[6]{%
- {\fracstyle #1%
+ {#1\fracstyle
{\begingroup #5\endgroup
\csname @@\ifx\maxdimen#4\maxdimen over\else above\fi
\if @#2@\else withdelims\fi\endcsname #2#3#4\relax
#6}%
}%
}
+% \end{macrocode}
+% \changes{v0.90}{2011/08/03}{\cs{fracstyle} must be called \emph{after}
+% changing to the required style}
+% \end{macro}
+%
+% \begin{macrocode}
\renewcommand{\frac}{\genfrac{}{}{}{}}
\providecommand{\dfrac}{}
\providecommand{\tfrac}{}