diff options
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/mh/breqn-technotes.tex | 145 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/breqn.dtx | 186 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/empheq07.dtx | 1506 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/flexisym.dtx | 17 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/mathstyle.dtx | 37 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/mathtools.dtx | 198 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mh/xfrac.dtx | 1037 |
7 files changed, 1458 insertions, 1668 deletions
diff --git a/Master/texmf-dist/source/latex/mh/breqn-technotes.tex b/Master/texmf-dist/source/latex/mh/breqn-technotes.tex new file mode 100644 index 00000000000..e8c6174cbbf --- /dev/null +++ b/Master/texmf-dist/source/latex/mh/breqn-technotes.tex @@ -0,0 +1,145 @@ +\documentclass{article} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage{breqn} +\def\eqnumside{L} +\providecommand*\cs[1]{\texttt{\textbackslash#1}} + +\usepackage{hyperref} + +\title{Technical notes on equation breaking} +\author{Michael J.\ Downes \and Morten H\o gholm} +\begin{document} + +\maketitle + + +\section{Tag placement} + +The method used by the breqn package to place the equation number is +rather more complicated than you might think, and the whole reason is +to allow the number to stay properly centered on the total height even +when the height fluctuates due to stretching or shrinking of the page. + + +Consider the following equation: +\begin{dmath}[number={3.15}] + N_{0} \simeq \left( \frac{\nu}{\lVert u\rVert_{H^{i}}} \right) + \lvert I\rvert^{-1/2} +\end{dmath} +It will have only one line, if the column width is not too narrow. + +Scrutinizing the vertical list will shed light on some of the basic properties +shared by all breqn equations. After that we will look at what would happen if +two or more lines were needed. The numbers added on the left in the following +\cs{showlists} output mark the points of interest. +\begin{verbatim} +[1] \penalty 10000 + \glue(\abovedisplayskip) 0.0 + \penalty 10000 + \glue(\belowdisplayskip) 0.0 +[2] \glue 4.0 plus 4.0 + \glue(\lineskip) 1.0 +[3] \vbox(16.53902+0.0)x0.0, glue set 16.53902fil + .\glue 0.0 plus 1.0fil minus 1.0fil + \penalty 10000 +[4] \glue -8.51945 +[5] \hbox(7.5+2.5)x25.55563 + .\OT1/cmr/m/n/10 ( + .\OT1/cmr/m/n/10 3 + .\OT1/cmr/m/n/10 . + .\OT1/cmr/m/n/10 1 + .\OT1/cmr/m/n/10 5 + .\kern 0.0 + .\OT1/cmr/m/n/10 ) + \penalty 10000 +[6] \glue(\parskip) -18.01956 +[7] \hbox(16.53902+9.50012)x360.0, glue set 1.78647 +\end{verbatim} +\begin{enumerate} +\item These four lines are a hidden display structure from \TeX's + primitive \texttt{\$\$} mechanism. It is used only to get the value + of \cs{predisplaysize} so that we can later calculate by hand + whether to use the short display skips or the regular ones. (The + reason that we have to do it by hand traces back to the fact that + \TeX\ 3.x does not allow unhboxing in math mode.) The penalties come + from \cs{predisplaypenalty} and \cs{postdisplaypenalty}, which were + locally set to 10000 to ensure there would be no unintended page + breaks at these glue nodes. + +\item These two glue nodes are the ones that would normally have been + produced at the top of a display; the first one is the above-display + skip node (though we had to put it in by hand with \cs{vskip}) and + the second one is the usual baselineskip/lineskip node. + +\item This is a dummy copy of the equation's first line, which is + thrown in here to get the proper value of baselineskip (or lineskip + in this case). Why do we need this? Because this ensures that we get + the top spacing right before we fiddle with the glue nodes + surrounding the equation number. And if the equation has a frame, + this box is a good place to add it from. + +\item This is a special glue node that brings us to the right vertical + position for adding the equation number. Its value is calculated + from the variables that you would expect, given the presence of the + dummy first line above the num- ber: starting position of the + equation, height of first line, total height of equation body. If + the equation body had more than one line, with stretchable glue + between the lines, half of the stretch would be added in this glue + node. + +\item The hbox containing the equation number. + +\item Backspace to bring the equation body to the right starting point. We use + \cs{parskip} to put this glue in place because we're going to get a + parskip node here in any case when we add the equation body with (in + essence). If we didn't do this we'd get two glue nodes instead of + one, to no purpose. + +\cs{\noindent} \cs{unhbox}\cs{EQ@box}. + + +\item And lastly we see here the first line of the equation body, + which appears to have height 16.5pt and depth 9.5pt. +\end{enumerate} + +For comparison, the vertical list produced from the above equation in +standard \LaTeX\ would look like this, if the same values of +columnwidth and abovedisplayskip are used: +\begin{verbatim} +[1] \penalty 10000 +[2] \glue(\abovedisplayskip) 4.0 plus 4.0 + \glue(\lineskip) 1.0 + \hbox(16.53902+9.50012)x232.94844 +[3] .\hbox(7.5+2.5)x25.55563 + ..\hbox(7.5+2.5)x25.55563 + ...\OT1/cmr/m/n/10 ( + ...\OT1/cmr/m/n/10 3 + ...\OT1/cmr/m/n/10 . + ...\OT1/cmr/m/n/10 1 + ...\OT1/cmr/m/n/10 5 + ...\kern 0.0 + ...\OT1/cmr/m/n/10 ) + .\kern101.49591 +[4] .\hbox(16.53902+9.50012)x105.8969 + ... +[5] \penalty 0 +[6] \glue(\belowdisplayskip) 4.0 plus 4.0 + \glue(\lineskip) 1.0 + \hbox(6.94444+1.94444)x345.0, glue set 62.1106fil +\end{verbatim} + +\begin{enumerate} + \item \cs{predisplaypenalty} + \item \cs{abovedisplayskip} + \item equation number box + \item equation body + \item \cs{postdisplaypenaltly} + \item \cs{belowdisplayskip} +\end{enumerate} + + + + + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/mh/breqn.dtx b/Master/texmf-dist/source/latex/mh/breqn.dtx index 0f01201b370..0f8d0d9a1f6 100644 --- a/Master/texmf-dist/source/latex/mh/breqn.dtx +++ b/Master/texmf-dist/source/latex/mh/breqn.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1997-2003 by Michael J. Downes -% Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +% Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -67,7 +67,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: breqn 2007/12/22 v0.97a Breqn (MH)} +\Msg{* Package: breqn 2008/07/28 v0.98 Breqn (MH)} \Msg{************************************************************************} \keepsilent @@ -78,7 +78,7 @@ This is a generated file. Copyright (C) 1997-2003 by Michael J. Downes -Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -128,7 +128,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{breqn.drv}% - [2007/12/22 v0.97a breqn (MH)] + [2008/07/28 v0.98 breqn (MH)] \documentclass{ltxdoc} \CodelineIndex \EnableCrossrefs @@ -230,7 +230,7 @@ and the derived files % \fi % % \title{The \pkg{breqn} package} -% \date{2007/12/22 v0.97a} +% \date{2008/07/28 v0.98} % \author{Morten H\o gholm \\\texttt{mh.ctan@gmail.com}} % % \maketitle @@ -648,6 +648,7 @@ and the derived files % \begin{verbatim} % \begin{dmath}[style={\small}] % \begin{dmath}[number={BV}] +% \begin{dmath}[labelprefix={eq:}] % \begin{dmath}[label={xyz}] % \begin{dmath}[relindent={1em}] % \begin{dmath}[compact] @@ -674,7 +675,9 @@ and the derived files % \end{verbatim} % % Use of the normal \cs{label} command instead of the \opt{label} option -% works, I think, most of the time (untested). +% works, I think, most of the time (untested). \opt{labelprefix} prepends +% its argument to the label (only useful as a global option, really), +% and must be called before \opt{label}. % % Use the \opt{relindent} option to specify something other than the % default amount for the indention of relation symbols. The default is @@ -1005,7 +1008,7 @@ and the derived files % % Declare package name and date. % \begin{macrocode} -\ProvidesPackage{breqn}[2007/12/22 v0.97a] +\ProvidesPackage{breqn}[2008/07/28 v0.98] % \end{macrocode} % % @@ -1171,7 +1174,6 @@ and the derived files % \begin{macrocode} \newcount\maxint \maxint=2147483647 % \end{macrocode} -% % \end{macro} % % @@ -1185,7 +1187,6 @@ and the derived files \let\int@b=\@tempcntb \let\int@c=\count@ % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1207,7 +1208,6 @@ and the derived files \let\dim@e\dimen@ii \let\dim@A\dimen@i % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1226,7 +1226,6 @@ and the derived files \let\skip@b\@tempskipb \let\skip@c\skip@ % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1248,7 +1247,6 @@ and the derived files \toksdef\toks@e=6 \toksdef\toks@f=8 % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1291,7 +1289,6 @@ and the derived files % \begin{macrocode} \def\@ifnexta{\ifx\@tempc\@tempd \let\@tempb\@tempa \fi \@tempb} % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -1323,7 +1320,6 @@ and the derived files % \begin{macrocode} \def\@optarg#1#2{\@ifnext[{#1}{#1[#2]}} % \end{macrocode} -% % \end{macro} % % @@ -1360,7 +1356,6 @@ and the derived files % \begin{macrocode} \def\freeze@glue#1{#11#1\relax} % \end{macrocode} -% % \end{macro} % \begin{macro}{\z@rule} % \begin{macro}{\keep@glue} @@ -1749,7 +1744,6 @@ and the derived files \newmuskip \Dmedmuskip \Dmedmuskip=4mu minus 3mu % medmuskip in displays \newmuskip \Dthickmuskip \Dthickmuskip=5mu minus 2mu % thickmuskip in displays % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -1861,7 +1855,6 @@ and the derived files % \begin{macrocode} \def\eq@overrun{0pt} % \end{macrocode} -% % \end{macro} % % @@ -2024,7 +2017,6 @@ and the derived files \mskip\thickmuskip \@@vadjust{\penalty\tw@}\penalty-\@Mi\@@vadjust{}% } % \end{macrocode} -% % \end{macro} % % @@ -2113,7 +2105,6 @@ and the derived files \let\m@@symDeB\@symDeB \let\m@@symDeA\@symDeA % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -2201,7 +2192,6 @@ and the derived files \let\left\@@left \let\right\@@right } % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -2239,11 +2229,20 @@ and the derived files % Options for the \env{dmath} and \env{dmath*} % environments. % \begin{literalcode} -% \begin{dmath}[label={xyz}] +% \begin{dmath}[label={eq:xyz}] +% \begin{dmath}[labelprefix={eq:},label={xyz}] % \end{literalcode} +% WSPR: added the option for a label prefix, designed to be used in the preamble like so: +% \begin{literalcode} +% \setkeys{breqn}{labelprefix={eq:}} +% \end{literalcode} % \begin{macrocode} -\define@key{breqn}{label}{\def\next@label{\label{#1}}} +\define@key{breqn}{label}{% + \edef\next@label{\noexpand\label{\next@label@pre#1}}% + \let\next@label@pre\@empty} +\define@key{breqn}{labelprefix}{\def\next@label@pre{#1}} \global\let\next@label\@empty +\global\let\next@label@pre\@empty % \end{macrocode} % Allow a variant number. % \begin{literalcode} @@ -2862,7 +2861,6 @@ and the derived files % % % \begin{macro}{\peek@branch} -% % This is a generalized \dquoted{look at next token and choose some action % based on it} function. % \begin{macrocode} @@ -2876,7 +2874,6 @@ and the derived files } \lowercase{\def\peek@skip@space} {\futurelet\@let@token\peek@a}% % \end{macrocode} -% % \end{macro} % % @@ -2954,7 +2951,6 @@ and the derived files \end{#2}% } % \end{macrocode} -% % \end{macro} % % @@ -2993,15 +2989,14 @@ and the derived files % \begin{macrocode} \def\check@punct@or@qed#1{% \xdef\found@punct{\@empty}% BRM: punctuation was being remembered past this eqn. + % WSPR: err, why isn't that just \global\let\found@punct\@empty ? \def\finish@end{\csname end@#1\endcsname\latex@end{#1}}% \check@punct } % \end{macrocode} -% % \end{macro} % \end{macro} % -% % \begin{macro}{\eqpunct} % User-settable function for handling % the punctuation at the end of an equation. You could, for example, @@ -3009,10 +3004,8 @@ and the derived files % \begin{macrocode} \newcommand\eqpunct[1]{\thinspace#1} % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\set@label} % \cs{set@label} just sets \cs{@currentlabel} but it % takes the counter as an argument, in the hope that \latex will some @@ -3021,10 +3014,8 @@ and the derived files % \begin{macrocode} \providecommand\set@label[2]{\protected@edef\@currentlabel{#2}} % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\eq@topspace} % \begin{macro}{\eq@botspace} % The action of \cs{eq@topspace} is complicated by the @@ -3147,7 +3138,6 @@ and the derived files % \end{macro} % \end{macro} % -% % \begin{macro}{\eq@resume@parshape} % This should calculate the total height of the equation, % including space above and below, and set prevgraf to the number it would @@ -3159,15 +3149,11 @@ and the derived files % \end{macrocode} % \end{macro} % -% -% -% % \section{Preprocessing the equation body} % \begin{macro}{\eq@startup} % Here is the function that initially collects the equation % material in a box. % -% % \begin{macrocode} \def\eq@startup{% \global\let\EQ@hasLHS\@False @@ -3466,7 +3452,6 @@ and the derived files % \begin{macrocode} \global\let\EQ@afterspace\@empty % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -3928,7 +3913,6 @@ and the derived files % % % \begin{macro}{\eq@trial} -% % The \cs{eq@trial} function tries each candidate % line width in \cs{eq@linewidths} until an equation layout is found % that yields satisfactory line breaks. @@ -4024,7 +4008,6 @@ and the derived files \begingroup #1% } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@failout} % @@ -4035,7 +4018,6 @@ and the derived files \global\let\EQ@trial\EQ@last@trial } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@save} % @@ -4069,7 +4051,6 @@ and the derived files }% } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@b} % @@ -4078,7 +4059,6 @@ and the derived files % \begin{macrocode} \def\eq@trial@b{\eq@trial@c} % \end{macrocode} -% % \end{macro} % % @@ -4118,7 +4098,6 @@ and the derived files \endgroup } % \end{macrocode} -% % \end{macro} % \begin{macro}{\eq@trial@d} % \begin{macrocode} @@ -4127,7 +4106,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@check@density} -% % \begin{macrocode} \def\eq@check@density{% %<trace> \breqn@debugmsg{Checking density for layout L}% @@ -4139,17 +4117,15 @@ and the derived files \fi\fi } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@shortLHS} -% % Test to see if we need to apply the \cs{eq@dense@enough} test. % \begin{macrocode} \def\eq@shortLHS{\ifdim\eq@wdL>.44\eq@wdT 1\else 0\fi 0} % \end{macrocode} -% % \end{macro} +% %\verb|\def\eq@shortLHS{\@False}| %======================================== % \begin{macro}{\eq@trial@p} @@ -4171,18 +4147,16 @@ and the derived files %<trace> \debug@showmeasurements } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\adjust@rel@penalty} -% % Normally this is a no-op. % \begin{macrocode} \let\adjust@rel@penalty\@empty % \end{macrocode} -% % \end{macro} +% % \begin{macro}{\eq@fix@lastline} % Remove parfillskip from the last line box. % \begin{macrocode} @@ -4198,10 +4172,9 @@ and the derived files }% } % \end{macrocode} -% % \end{macro} -% \begin{macro}{\eq@recalc} -% +% +% \begin{macro}{\eq@recalc} % Calculate \cs{eq@wdT} et cetera. % \begin{macrocode} \def\eq@recalc{% @@ -4209,12 +4182,10 @@ and the derived files \let\@elt\eq@recalc@a \eq@measurements \let\@elt\relax } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@recalc@a} -% % \begin{macrocode} \def\eq@recalc@a#1x#2+#3\@endelt{% \eq@firstht#2\relax @@ -4222,12 +4193,10 @@ and the derived files \@elt#1x#2+#3\@endelt } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@recalc@b} -% % \begin{macrocode} \def\eq@recalc@b#1X#2,#3x#4+#5@#6\@endelt{% \setlength\dim@a{#2+#3}% @@ -4241,16 +4210,14 @@ and the derived files \ifnum#6>\eq@badness \eq@badness#6\relax\fi } % \end{macrocode} -% % \end{macro} -% \begin{macro}{\eq@layout} -% +% +% \begin{macro}{\eq@layout} % A value of \verb"?" for \cs{eq@layout} means that we should % deduce which layout to use by looking at the size of the components. % Any other value means we have a user-specified override on the % layout. % -% % Layout Definitions. % Based on initial equation measurements, we can choose a sequence of % candidate parshapes that the equation might fit into. @@ -4264,7 +4231,6 @@ and the derived files % % % \begin{macro}{\eq@try@layout@?} -% % This is a branching function used to choose a suitable layout if % the user didn't specify one in particular. % @@ -4337,7 +4303,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@D} -% % Change the penalty before the first mathrel symbol to encourage a % break there. % @@ -4384,7 +4349,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@S} -% % In the \dquoted{stepped} layout there is no LHS, or LHS % is greater than the line width and RHS is small. % Then we want to split up the equation into lines of roughly equal @@ -4438,7 +4402,6 @@ and the derived files % \end{macro} % % \begin{macro}{\eq@try@layout@l} -% % This is the \dquoted{step-ladder} layout: similar to the drop-ladder % layout but the LHS is too wide and needs to be broken up. % @@ -4463,11 +4426,9 @@ and the derived files \eq@trial@b{l}{\eq@try@layout@A}% } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@try@layout@A} -% % In the \dquoted{almost-columnar} layout, which is the layout of last % resort, we let all lines run to the full width and leave the adjusting % of the indents to later. @@ -4481,15 +4442,14 @@ and the derived files \if\EQ@hasLHS \def\adjust@rel@penalty{\penalty-99 }\fi \eq@trial@b{A}{}% } -% \end{macrocode} -% +% \end{macrocode} % \end{macro} +% % \begin{macro}{\eq@shiftnumber} % MH: Should be moved to a section where all keys are set to defaults. % \begin{macrocode} \let\eq@shiftnumber\@False % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@retry@with@number@a} @@ -4587,8 +4547,8 @@ and the derived files } % \end{macrocode} % \end{macro} +% % \begin{macro}{\adjust@parshape} -% % Varies depending on the layout. % % Adjust a parshape variable for a given set of left\textbar right skips. @@ -4602,13 +4562,11 @@ and the derived files \edef#1{\temp@a}% } % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\adjust@parshape@a} % \begin{macro}{\adjust@parshape@b} -% % \begin{macrocode} \def\adjust@parshape@a#1 #2\relax{% \setlength\dim@a{\leftskip+\rightskip}% @@ -4631,8 +4589,8 @@ and the derived files % \end{macrocode} % \end{macro} % \end{macro} -% \begin{macro}{\eq@ml@record@indents} -% +% +% \begin{macro}{\eq@ml@record@indents} % Plunk the parshape's indent values into an array for easy access % when constructing \cs{eq@measurements}. % \begin{macrocode} @@ -4649,24 +4607,19 @@ and the derived files \@xp\@tempc\@parshape } % \end{macrocode} -% % \end{macro} % -% % \begin{macro}{\@endelt} -% % This is a scan marker. % It should get a non-expandable definition. % It could be \cs{relax}, but let's try a chardef instead. % \begin{macrocode} \chardef\@endelt=`\? % \end{macrocode} -% % \end{macro} % % % \begin{macro}{\eq@measurements} -% % This is similar to a parshape spec but for each line we record more % info: space above, indent, width x height + dp, and badness. % \begin{macrocode} @@ -4675,7 +4628,6 @@ and the derived files ... } % \end{macrocode} -% % \end{macro} % % @@ -4697,7 +4649,6 @@ and the derived files \eq@ml@a \eq@ml@continue } % \end{macrocode} -% % \end{macro} % % @@ -4745,7 +4696,6 @@ and the derived files \ifnum\eq@curline=\z@ \let\eq@ml@continue\relax\fi } % \end{macrocode} -% % \end{macro} % % @@ -4758,7 +4708,6 @@ and the derived files \ifdim\lastskip=\z@ \else \@xp\eq@ml@vspace \fi } % \end{macrocode} -% % \end{macro} % % @@ -4778,7 +4727,6 @@ and the derived files \fi } % \end{macrocode} -% % \end{macro} % % @@ -4854,7 +4802,6 @@ and the derived files % % % \begin{macro}{\eq@dense@enough@b} -% % This is an approximate calculation used to keep from going over % \cs{maxdimen} if the number of lines in our trial break is large % enough to make that a threat. @@ -4880,15 +4827,12 @@ and the derived files \ifdim\dim@b<\dim@c \true@true@true \else \false@true@false \fi } % \end{macrocode} -% % \end{macro} % % \begin{macro}{\eq@parshape} -% % \begin{macrocode} \let\eq@parshape\@empty % \end{macrocode} -% % \end{macro} % % @@ -5006,13 +4950,9 @@ and the derived files % \cs{intereqskip} if the math expressions are (vertically) smaller % than the tag. % -% -% -% % \section{Centered Right-Number Equations} % % \begin{macro}{\eq@dump@box} -% % \arg1 might be \cs{unhbox} or \cs{unhcopy}; \arg2 is % the box name. % \begin{macrocode} @@ -5032,23 +4972,16 @@ and the derived files \adjust@rel@penalty \unhbox\f@ur } % \end{macrocode} -% % \end{macro} % -% -% % Various typesetting bits, invoked from \cs{eq@finish} % BRM: This has been extensively refactored from the original breqn, % initially to get left\textbar right skips and parshape used consistently, % ultimately to get most things handled the same way, in the same order. % -% -% % Given that left and right skips have been set, % typeset the frame, number and equation with the % given number side and placement -% -% % % \begin{macrocode} \def\eq@typeset@Unnumbered{% @@ -5143,7 +5076,7 @@ and the derived files % % Set left \& right skips for centered equations, % making allowances for numbers (if any, right, left) and constraint. -% === +% % Amazingly, I've managed to collect all the positioning logic for % centered equations in one place, so it's more manageable. % Unfortunately, by the time it does all it needs to do, @@ -5349,9 +5282,6 @@ and the derived files } % \end{macrocode} % -% -% -% % \section{Delimiter handling} % The special handling of delimiters is rather complex, but % everything is driven by two motives: to mark line breaks inside @@ -5393,7 +5323,6 @@ and the derived files % \mathrel{\@@left \delimiter... \vrule...\@@right.} % \end{literalcode} % -% % First save the primitive meanings of \cs{left} and % \cs{right}. % \begin{macrocode} @@ -5401,7 +5330,6 @@ and the derived files \@saveprimitive\right\@@right % \end{macrocode} % -% % The variable \cs{lr@level} is used by the first mathrel in % an equation to tell whether it is at top level: yes? break and measure % the LHS, no? keep going. @@ -5409,7 +5337,6 @@ and the derived files \newcount\lr@level % \end{macrocode} % -% % It would be nice to have better error checking here if the % argument is not a delimiter symbol at all. % \begin{macrocode} @@ -5433,7 +5360,6 @@ and the derived files \def\eq@nullright#1{\@@right#1\after@close} % \end{macrocode} % -% % Here is the normal operation of \cs{biggl}, for example. % \begin{literalcode} % \biggl ->\mathopen \bigg @@ -5530,7 +5456,6 @@ and the derived files % \begin{macrocode} \let\m@@DeA\m@DeA\let\d@@DeA\m@DeA% % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -5585,7 +5510,6 @@ and the derived files \ifnum\lr@level<\@ne \eq@binoffset=\eqbinoffset\relax \fi } % \end{macrocode} -% % \end{macro} % \end{macro} % \end{macro} @@ -5868,7 +5792,6 @@ and the derived files \DeclareTwang{)}{-.33} \DeclareTwang{\rbrace}{-.25} % \end{macrocode} -% % \end{macro} % % @@ -6078,7 +6001,6 @@ and the derived files \let\grp@eqs@numbered\@False \let\grp@aligned\@True % \end{macrocode} -% % \end{macro} % \end{macro} % @@ -6532,42 +6454,35 @@ and the derived files % In a series of conditions, use less space between members of the % series than between the conditions and the main equation body. % -% BRM: Some modifications here, since I like for the condition -% to go flush right. (thus, it also affects centering, margins, etc) +% WSPR: tidied/fixed things up as it made sense to me but might have +% broken something else! % \begin{macrocode} \newskip\conditionsep \conditionsep=10pt minus5pt% \newcommand{\conditionpunct}{,} -\let\cond@gobble\@firstofone +% \end{macrocode} +% \begin{macro}{\condition} +% \begin{macrocode} \newcommand\condition{% \begingroup\@tempswatrue - \@ifstar{\@tempswafalse \condition@a}\condition@a -} + \@ifstar{\@tempswafalse \condition@a}{\condition@a}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\condition@a} +% \begin{macrocode} \newcommand\condition@a[2][\conditionpunct]{% \unpenalty\unskip\unpenalty\unskip % BRM Added \hbox{#1}% \penalty -201\relax\hbox{}% Penalty to allow breaks here. \hskip\conditionsep - \if@tempswa \@xp\hbox \else \@xp\condition@b\fi - {#2}% - \endgroup + \setbox\z@\if@tempswa\hbox{#2}\else\hbox{$\textmath@setup #2$}\fi % \end{macrocode} -% BRM: Testing if I can measure conditions? +% BRM's layout is achieved with this line commented out but it has the nasty side-effect of shifting the equation number to the next line: % \begin{macrocode} - \setbox\z@\if@tempswa\hbox{#2}\else\hbox{\textmath@setup #2}\fi - \global\eq@wdCond\wd\z@ - \let\cond@gobble\@gobble -} -% \end{macrocode} -% For a math condition. -% This is called inside a group so we don't need extra grouping to -% localize the effect of \cs{textmath@setup} which turns off the -% line-breaking features of bin, rel, and delimiter symbols. -% \begin{macrocode} -\newcommand\condition@b[1]{% - \cond@gobble{\hskip\conditionsep}% - \textmath@setup #1% -} +% \global\eq@wdCond\wd\z@ + \usebox\z@ + \endgroup} % \end{macrocode} +% \end{macro} % % The \env{dsuspend} environment. First the old one that didn't work. % \begin{macrocode} @@ -6677,7 +6592,6 @@ and the derived files \def\@nref#1#2{\ifx\relax#1??\else \@xp\@firstoftwo#1\fi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \end{macrocode} -% % \end{macro} % % diff --git a/Master/texmf-dist/source/latex/mh/empheq07.dtx b/Master/texmf-dist/source/latex/mh/empheq07.dtx deleted file mode 100644 index a8921940f1a..00000000000 --- a/Master/texmf-dist/source/latex/mh/empheq07.dtx +++ /dev/null @@ -1,1506 +0,0 @@ -% \iffalse meta-comment -% -% Copyright (C) 2002-2007 by Morten Hoegholm <mh.ctan@gmail.com> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either -% version 1.3 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.3 or later is part of all distributions of -% 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 work consists of the main source file empheq07.dtx -% and the derived files -% empheq07.sty, empheq07.pdf, empheq07.ins, empheq07.drv. -% -% Distribution: -% CTAN:macros/latex/contrib/mh/empheq07.dtx -% CTAN:macros/latex/contrib/mh/empheq07.pdf -% -% Unpacking: -% (a) If empheq07.ins is present: -% tex empheq07.ins -% (b) Without empheq07.ins: -% tex empheq07.dtx -% (c) If you insist on using LaTeX -% latex \let\install=y\input{empheq07.dtx} -% (quote the arguments according to the demands of your shell) -% -% Documentation: -% (a) If empheq07.drv is present: -% latex empheq07.drv -% (b) Without empheq07.drv: -% latex empheq07.dtx; ... -% The class ltxdoc loads the configuration file ltxdoc.cfg -% if available. Here you can specify further options, e.g. -% use A4 as paper format: -% \PassOptionsToClass{a4paper}{article} -% -% Programm calls to get the documentation (example): -% pdflatex empheq07.dtx -% makeindex -s gind.ist empheq07.idx -% pdflatex empheq07.dtx -% makeindex -s gind.ist empheq07.idx -% pdflatex empheq07.dtx -% -% Installation: -% TDS:tex/latex/mh/empheq07.sty -% TDS:doc/latex/mh/empheq07.pdf -% TDS:source/latex/mh/empheq07.dtx -% -%<*ignore> -\begingroup - \def\x{LaTeX2e} -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex -\Msg{************************************************************************} -\Msg{* Installation} -\Msg{* Package: empheq07 2007/12/03 v0.7e empheq07 (MH)} -\Msg{************************************************************************} - -\keepsilent -\askforoverwritefalse - -\preamble - -This is a generated file. - -Copyright (C) 2002-2007 by Morten Hoegholm <mh.ctan@gmail.com> - -This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either -version 1.3 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.3 or later is part of all distributions of -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 work consists of the main source file empheq07.dtx -and the derived files - empheq07.sty, empheq07.pdf, empheq07.ins, empheq07.drv. - -\endpreamble - -\generate{% - \file{empheq07.ins}{\from{empheq07.dtx}{install}}% - \file{empheq07.drv}{\from{empheq07.dtx}{driver}}% - \usedir{tex/latex/mh}% - \file{empheq07.sty}{\from{empheq07.dtx}{package}}% -} - -\obeyspaces -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* file into a directory searched by TeX:} -\Msg{*} -\Msg{* empheq07.sty} -\Msg{*} -\Msg{* To produce the documentation run the file `empheq07.drv'} -\Msg{* through LaTeX.} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} - -\endbatchfile -%</install> -%<*ignore> -\fi -%</ignore> -%<*driver> -\NeedsTeXFormat{LaTeX2e} -\ProvidesFile{empheq07.drv}% - [2007/12/03 v0.7e Emphasizing equations (MH)] -\documentclass{ltxdoc} -\usepackage{empheq07} -\usepackage{color,fancybox,ifpdf} -\ifpdf\else - \usepackage{pstricks} -\fi -\definecolor{lightblue}{rgb}{.8, .8, 1} -\OnlyDescription -\begin{document} -\DocInput{empheq07.dtx} -\end{document} -%</driver> -% \fi -% \DeclareRobustCommand{\mode}[1]{\texttt{#1}} -% \DeclareRobustCommand{\env}[1]{\textsf{#1}} -% \DeclareRobustCommand{\pkg}[1]{\texttt{#1}} -% \DeclareRobustCommand{\EQ}{\pkg{empheq07}} -% -% \changes{v0.7d}{2004/07/27}{Changed name to \pkg{empheq07} by request -% of Robin Fairbairns} -% -% \changes{v0.7c}{2004/04/01}{Separated \pkg{empheq} and -% \pkg{empheq-obsolete}} -% -% \changes{v0.7b}{2004/03/13}{Upgraded license to LPPL version 1.3. -% The package is still obsolete} -% -% \changes{v0.7a}{2004/02/15}{This package is now obsolete and has -% changed its name to \pkg{empheq-obsolete}} -% -% \changes{v0.6a}{2003/01/28}{Minor updates to documentation.} -% -% \changes{v0.5}{2002/12/30}{First experimental and very limited release} -% \newif\ifBonusExample -% \ifpdf\else -% \BonusExampletrue -% \fi -% \GetFileInfo{empheq07.drv} -% \CheckSum{1273} -% \title{The \EQ\ package\thanks{This file -% has version number \fileversion, last -% revised \filedate.}\\Emphasizing equations in \LaTeXe -% \thanks{Thanks to Lars Madsen for asking for the subtle feature -% that evolved into this package.}} -% \author{Morten H\o gholm} -% \date{\filedate} -% -% \maketitle -% -% -% \begin{abstract} -% \noindent The \EQ\ package automatically detects several \pkg{amsmath} -% environments and the size of the displayed math material. The user -% interface makes it easy to add various kinds of visual markup to -% these equations. -% \end{abstract} -% \tableofcontents -% \section{Important Notice} -% -% This package (\EQ\ \fileversion) is no longer supported. See the -% documentation of \pkg{empheq} for more details. -% -% -% \section{Introduction} -% Users who have wanted to put a system of equations inside boxes has -% hitherto been forced to use the features of \pkg{fancybox} or the \cmd{\boxed} command -% of \pkg{amsmath}. Both alternatives have serious limitations though. -% \pkg{fancybox} allows only \env{eqnarray}-style equations and at -% the end of the day they aren't all that pretty. Most mathematical -% typesetting in \LaTeX\ is done with the aid of \pkg{amsmath} -% anyway, but it only offers the single line quick-fix \cmd{\boxed}. -% What we really want is something that will enable us to do -% something along the likes of this: -% \begin{subequations}\label{eq:1} -% \begin{empheq}[boxtype=\fbox,Left= {\tilde{S}=1 \Rightarrow\empheqlbrace}] -% \begin{align} -% a&=\int_{-2}^3{t}b^t \, dt \quad\text{and} \label{eq:1a}\\ -% c&=d-a \label{eq:1b} -% \end{align} -% \end{empheq} -% \end{subequations} -% As you can see, \EQ\ can do all the tricks the \pkg{cases} package -% by Donald Arseneau can do and more. It even supports -% \env{subequations}---as shown in equations \eqref{eq:1a} and -% \eqref{eq:1b}---from \pkg{amsmath} without complaining. -% -% In order to combine the best of two worlds the \EQ\ package -% tries to take advantage of the widespread features of \pkg{amsmath}. -% As it should be well known if you read this, \pkg{amsmath} has -% amongst its arsenal of structures \env{align}, \env{gather}, \env{alignat} and \env{multline}. -% \EQ\ works with these as well as their starred -% variants. -% -% ``But what about \env{equation}?'' you say. \env{equation} is (in -% my opinion) merely a poor man's \env{gather}. If you really want -% to use \EQ's features on a one-liner (no pun intended) go with -% \env{gather}. Anyway the real goal of this package is to do nifty -% tricks with multi line equations \ldots -% -% -% \section{Examples} -% \changes{v0.7}{2003/05/11}{Added further examples and changed existing ones} -% Any options given to \EQ\ is passed on to \pkg{amsmath}, thus the -% line\par -% \cmd{\usepackage}\oarg{options}|{empheq07}|\\ -% will load \pkg{amsmath} with exactly those options. \EQ\ doesn't -% redefine anything so to use it in an existing document you need -% only replace \pkg{amsmath} with \EQ---no harm done. -% -% -% \EQ\ is \emph{really} easy to use; you simply put an \env{empheq} -% environment around your \pkg{amsmath} environment: -% \begin{verbatim} -% \begin{empheq} -% \begin{align} -% E&=mc^2 \\ -% Y&= \sum_{n=1}^\infty \frac{1}{n^2} -% \end{align} -% \end{empheq} -% \end{verbatim} -% \begin{empheq} -% \begin{align} -% E&=mc^2 \\ -% Y&= \sum_{n=1}^\infty \frac{1}{n^2} -% \end{align} -% \end{empheq} -% Impressed? No? Well then I guess it's about time I told you about -% the \emph{optional} argument of the \env{empheq} environment. It allows -% you control what material to put on either side of the math and -% the sort of box to go around it all. That means that we can say -% \begin{verbatim} -% \begin{empheq}[boxtype=\fbox] -% \begin{align} -% E&=mc^2 \\ -% Y&= \sum_{n=1}^\infty \frac{1}{n^2} -% \end{align} -% \end{empheq} -% \end{verbatim} -% to obtain the display -% \begin{empheq}[boxtype=\fbox] -% \begin{align} -% E&=mc^2 \\ -% Y&= \sum_{n=1}^\infty \frac{1}{n^2} -% \end{align} -% \end{empheq} -% This requires the use of the \pkg{keyval} package from the tools -% bundle, which is undoubtedly installed on your system. When using -% the \pkg{keyval} package there are a few things we need to keep in -% mind. In mathematical typesetting `|=|' and `|,|' are quite -% frequently used, thus requiring the user to enclose them in -% braces: -% \begin{verbatim} -% \begin{empheq}[boxtype=\fbox, -% Left={(a,b)=(c,i) \Rightarrow\empheqlbrace}] -% \begin{alignat}{2} -% (a,b)&= (\cos^a c, \tan^b i)&& \quad\text{for $i>1$}\\ -% (a,b)&= (\arccos x^a, \arctan i^b)&& \quad\text{for $i\leq1$} -% \end{alignat} -% \end{empheq} -% \end{verbatim} -% \begin{empheq}[boxtype=\fbox, -% Left={(a,b)=(c,i) \Rightarrow\empheqlbrace}] -% \begin{alignat}{2} -% (a,b)&= (\cos^a c, \tan^b i)&& \quad\text{for $i>1$}\\ -% (a,b)&= (\arccos c^a, \arctan i^b)&& \quad\text{for $i\leq1$} -% \end{alignat} -% \end{empheq} -% The same with \env{cases} from \pkg{amsmath} for comparison: -% \[ -% \boxed{(a,b)=(c,i) \Rightarrow -% \begin{cases} (a,b)= (\cos^a c, \tan^b i)& \text{for $i>1$}\\ -% (a,b)= (\arccos x^a, \arctan i^b)& \text{for $i\leq1$} -% \end{cases}} -% \] -% Notice that \env{cases} uses an array for the conditions, so you -% have to force \cmd{\displaystyle} yourself. This is not needed with -% \EQ\ as you're already using a \cmd{\displaystyle} environment such as -% \env{gather} etc. -% -% \changes{v0.6b}{2003/03/04}{Added example for changing margins inside the boxtype.} -% Observe what can be done if we replace -% |\fbox| with another framed box and add some space on all sides: -% \begin{verbatim} -% \definecolor{lightblue}{rgb}{.8, .8, 1} -% \begin{empheq}[boxtype={\setlength{\fboxsep}{10pt}% -% \colorbox{lightblue}}, -% Right={\empheqrbrace \beta}] -% . -% . -% . -% \end{empheq} -% \end{verbatim} -% \begin{empheq}[boxtype={\setlength{\fboxsep}{10pt}% -% \colorbox{lightblue}},Right={\empheqrbrace \beta}] -% \begin{align} -% a&=\int_{-2}^3{t}b^t \, dt \quad\text{and}\\ -% c&=d-a -% \end{align} -% \end{empheq} -% -% As a convenience for the user, it is also possible to declare -% delimiters with the commands -% \cmd{\DeclareRightDelimiter}\marg{delimiter} and its companion -% \cmd{\DeclareLeftDelimiter}\marg{delimiter}. For instance the commands -% \begin{quote} -% |\DeclareRightDelimiter{\rangle}| defines \cmd{\empheqrangle} -% \end{quote} -% and -% \begin{quote} -% |\DeclareLeftDelimiter{\langle}| defines \cmd{\empheqlangle}. -% \end{quote} -% The usage is simple. \DeclareRightDelimiter{\rangle} \DeclareLeftDelimiter{\langle} -% \begin{verbatim} -% \begin{empheq}[Right=\empheqrangle, -% Left=\empheqlangle] -% \begin{gather} -% a=b \\ -% c=d -% \end{gather} -% \end{empheq} -% \end{verbatim} -% \begin{empheq}[Right=\empheqrangle,Left=\empheqlangle] -% \begin{gather} -% a=b \\ -% c=d -% \end{gather} -% \end{empheq} -% \cmd{\DeclareRightDelimiter} and its companion have an optional -% argument which controls spacing (default is a negative thinspace), -% but beware: It will simply overwrite the original definition and -% it might not look all that pretty as the following example shows: -% \DeclareRightDelimiter[\>]{\rangle} -% \DeclareLeftDelimiter[\mkern-10mu]{\langle} -% \begin{verbatim} -% \DeclareRightDelimiter[\>]{\rangle} -% \DeclareLeftDelimiter[\mkern-10mu]{\langle} -% \end{verbatim} -% \begin{empheq}[Right=\empheqrangle,Left=\empheqlangle] -% \begin{gather} -% a=b \\ -% c=d -% \end{gather} -% \end{empheq} -% -% These examples will have given you a glimpse of the possibilities -% \EQ\ offers. In particular the commands \cmd{\empheqlbrace} and -% \cmd{\empheqrbrace} produce braces just tall enough to encompass -% the display. You can of course use \cmd{\big...} delimiters if you -% want. -% -% \ifBonusExample -% If you want you can even create your own box and use it with -% \env{empheq}. In the following silly example I have created -% \cmd{\ErrorBox} with \pkg{PSTricks} to achieve a disturbing -% effect: -% \makeatletter -% \newcommand{\ErrorBox}[1]{% -% \setlength{\@tempdima}{\heightof{#1}}% -% \addtolength{\@tempdima}{\depthof{#1}}% -% \setlength{\@tempdimb}{\widthof{#1}}% -% \psset{yunit=\@tempdima}% -% \psset{xunit=\@tempdimb}% -% \psframebox[fillstyle=vlines,linestyle=none,hatchsep=.2\@tempdimb,hatchcolor=red,hatchangle=-60]{% -% \rlap{\kern.5\@tempdimb\makebox[0pt]{{\Large\color{gray} \textbf{Error!}}}}#1}% -% } -% \makeatother -% \begin{empheq}[boxtype=\ErrorBox] -% \begin{align*} -% E&=mc^3 \\ -% F&=G\frac{m+M}{r^2} -% \end{align*} -% \end{empheq} -% Remember one thing when creating your own box: Make it -% symmetrical. -% \fi -% -% \section{Bugs and shortcomings} -% This package (\EQ) is not supported anymore. Try with the new -% version and see if it works; if not, then contact me. See how in -% the manual of \pkg{empheq}. -% -% \StopEventually{} -% \section{Implementation} -% \subsection{Strategy} -% -% Whenever \pkg{amsmath} is typesetting a display environment it -% actually does it twice; the first for the ``measuring'' phase and -% the second for the ``production'' phase. The \EQ\ package uses a -% similar approach: -% \begin{itemize} -% \item Collects the input in a token register for later use. -% \item Typesets the input in the background and checks certain values to determine the kind of math structure you just typed. -% \item Based on the given information, alterations are made to various lengths. -% \item Then the equations are typeset again and stored in a box -% for easy retrieval. -% \item Finally the saved box is put into a box of the user's liking. -% Any material to the right or left of the math structure (added with -% the |Left| and |Right| keys) are put into the box as well. -% \end{itemize} -% Assuming we have found out which \pkg{amsmath} structure the -% user typed, there are still a few things we need to sort out -% before we proceed. -% -% First of all the equation number should still be aligned with -% those of the ordinary math structures, which is a problem as soon -% as the additions we make to the left and the right -% differ---presumably they will. And when we are in \mode{fleqn} -% mode, we should make sure that the structure is shifted just -% enough to the right so that all equations still are right -% adjusted. Therefore we need to make clever changes to the -% line width to make sure the margins come out right. -% -% Then assuming we have overcome all of this there's still the final -% step: Placing the math structure in the appropriate box at the -% appropriate position. Once again we need to do some manipulation -% with spacing to make it just right. -% -% \subsection{Preliminary actions} -% -% To avoid clashes with other packages, all private commands will contain the sequence \verb|@emphEQ@|. -% -% We will need \pkg{amsmath} of course and it would be nice if \EQ\ -% would recognize all the \pkg{amsmath} options so we make that -% happen. To make sure the user has an updated system the newest -% release of \pkg{amsmath} is required. -% -% \pkg{calc} is used to increase readability of the code -% (thus making it \emph{far} easier to write too) and \pkg{keyval} -% is used for user friendliness. They should all be part of any -% \LaTeX\ system. -% \begin{macrocode} -%<*package> -\ProvidesPackage{empheq07}% - [2007/12/03 v0.7e Emphasizing equations (MH)] -\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}} -\ProcessOptions\relax -\RequirePackage{amsmath}[2000/07/18] -\RequirePackage{calc,keyval} -% \end{macrocode} -% \begin{macro}{\if@emphEQ@FLL}\begin{macro}{\if@emphEQ@FLR}\begin{macro}{\if@emphEQ@L}\begin{macro}{\if@emphEQ@R} -% There are four available layouts for mathematical displays: -% |[fleqn,leqno]| (FLL), |[fleqn,reqno]| (FLR), |[leqno]| (L) and |[reqno]| (R). We create four \TeX\ conditionals -% to make the algorithm easier to read as well as to speed up things a bit. -% \begin{macrocode} -\newif\if@emphEQ@FLL -\newif\if@emphEQ@FLR -\newif\if@emphEQ@L -\newif\if@emphEQ@R -% \end{macrocode} -%\end{macro}\end{macro}\end{macro}\end{macro} -% We then perform a simple test to determine the current mode. -% \begin{macrocode} -\if@fleqn - \iftagsleft@ - \@emphEQ@FLLtrue - \else - \@emphEQ@FLRtrue - \fi -\else - \iftagsleft@ - \@emphEQ@Ltrue - \else - \@emphEQ@Rtrue - \fi -\fi -% \end{macrocode} -% \begin{macro}{\if@emphEQ@gather}\begin{macro}{\if@emphEQ@align}\begin{macro}{\if@emphEQ@alignat} -% \begin{macro}{\if@emphEQ@multline}\begin{macro}{\if@emphEQ@NoNumEq} -% Since we're going to determinate which math structure the user has -% input, we create some more conditionals to improve speed and -% readability. Furthermore it will show crucial to know whether or -% not the equation counter has been stepped since \env{multline$*$} -% and \env{multline} don't have exactly the same structure. -% \begin{macrocode} -\newif\if@emphEQ@gather -\newif\if@emphEQ@align -\newif\if@emphEQ@alignat -\newif\if@emphEQ@multline -\newif\if@emphEQ@NoNumEq -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} -% -% -% -% \begin{macro}{\@emphEQ@Box}\begin{macro}{\@emphEQ@BoxWidth} -% \begin{macro}{\@emphEQ@displaywidth}\begin{macro}{\@emphEQ@mathbody} -% We need a single box to hold the math structure, a length so we -% can remember the size of the displayed math for later use and a -% token register for the math environment. -% \begin{macrocode} -\newsavebox{\@emphEQ@Box} -\newlength{\@emphEQ@BoxWidth} -\newlength{\@emphEQ@displaywidth} -\newtoks\@emphEQ@mathbody -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro} -% \begin{macro}{\@emphEQ@Left}\begin{macro}{\@emphEQ@Right}\begin{macro}{\@emphEQ@lwd}\begin{macro}{\@emphEQ@rwd} -% Here are some vital parts: The additional informations the user -% want to display on either side of the math structure are saved by -% \cmd{\@emphEQ@Left} and \cmd{\@emphEQ@Right} and \cmd{\@emphEQ@lwd} and \cmd{\@emphEQ@rwd} -% measure the width of them for later use. -% \begin{macrocode} -\newcommand{\@emphEQ@Left}{} -\newcommand{\@emphEQ@Right}{} -\newlength{\@emphEQ@lwd} -\newlength{\@emphEQ@rwd} -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro} -% \begin{macro}{\@emphEQ@boxtype}\begin{macro}{\@emphEQ@boxtypelength} -% \begin{macro}{\@emphEQ@shadowbox}\begin{macro}{\if@emphEQ@shadowbox} -% To make sure spacing is right when putting the math structure into -% a box, we need to know what kind of box it is: The width is -% extremely important. Often we will have to subtract or add half of -% an empty (but \emph{not} zero-width) box' width to certain -% lengths. When using an \cmd{\fbox} or \cmd{\colorbox} this is just -% \cmd{\fboxrule}+\cmd{\fboxsep}, but when using say, -% \cmd{\doublebox} of \pkg{fancybox} fame the necessity arises. -% \pkg{fancybox} also defines \cmd{\shadowbox} which needs extra -% taking care of, since it's asymmetrical unlike most other framed -% boxes. -% -% Thus we test whether or not \pkg{fancybox} has been loaded at the -% beginning of the document. If it has, we don't lift a finger; if -% it hasn't, we let \cmd{\fbox} be an alias for \cmd{\shadowbox}. -% Then we create a private version of \cmd{\shadowbox} for -% testing purposes and a conditional for the algorithm. -% \begin{macrocode} -\newcommand{\@emphEQ@boxtype}{} -\newlength{\@emphEQ@boxtypelength} -\AtBeginDocument{% - \@ifpackageloaded{fancybox}{}{% - \let\shadowbox=\fbox}} -\newcommand{\@emphEQ@shadowbox}{\shadowbox} -\newif\if@emphEQ@shadowbox -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro} -% \begin{macro}{\@emphEQ@templength}\begin{macro}{@emphEQ@EqCtr} -% We are almost ready to go. We only need two temporary little -% helpers: one length and one counter. -% \begin{macrocode} -\newlength{\@emphEQ@templength} -\newcounter{@emphEQ@EqCtr} -% \end{macrocode} -% \end{macro}\end{macro} -% -% \subsubsection{Faraway, so close}\label{sec:CloseEnough} -% \begin{macro}{\@emphEQ@CloseEnough} -% \changes{v0.6}{2003/01/10}{Added a test for lengths being almost identical} -% When determining the display type we will occasionally have to check if an equation of the -% form -% \[ -% \cmd{\totwidth@}-\cmd{\tagshift@}=\cmd{\linewidth} -% \] -% is true. However small rounding errors \emph{can} occur in -% \env{alignat} so we would rather see if the equation -% \[ -% -\delta<\cmd{\totwidth@}-\cmd{\tagshift@}-\cmd{\linewidth}<\delta -% \] -% holds for some sufficiently small $\delta>\text{$0$ pt}$. I have used $\delta=\text{$5$ sp}$. -% \begin{macrocode} -\newcommand{\@emphEQ@CloseEnough}[4]{% - \setlength{\@tempdima}{#1-#2}% - \ifdim\@tempdima>-5sp - \ifdim\@tempdima<5sp - #3 - \else - #4 - \fi - \else - #4 - \fi -} -% \end{macrocode} -% \end{macro} -% -% \subsection{Saving the input} -% \begin{macro}{\@emphEQ@MainEnv} -% \changes{v0.7}{2003/05/11}{Added use of token register to remove the -% need for an extra \cmd{\write} and \pkg{verbatim}} -% \begin{macro}{\end@emphEQ@MainEnv} -% \begin{macro}{\@emphEQ@get@body}\begin{macro}{\@emphEQ@findend} -% \begin{macro}{\@emphEQ@EnvName} -% We start out by saving the input in the token register -% \cmd{\@emphEQ@mathbody}. The method is heavily inspired by -% \pkg{tabularx} \dots\@ No need to copy the words of David Carlisle here---his code will do! -% \begin{macrocode} -\def\@emphEQ@MainEnv{% - \edef\@emphEQ@EnvName{\@currenvir}% - {\ifnum0=`}\fi - \@emphEQ@mathbody{}\@emphEQ@get@body -} -\let\end@emphEQ@MainEnv\relax -\long\def\@emphEQ@get@body#1\end{% - \@emphEQ@mathbody\expandafter{\the\@emphEQ@mathbody #1}% - \@emphEQ@findend -} -\def\@emphEQ@findend#1{% - \def\@tempa{#1}% - \ifx\@tempa\@emphEQ@EnvName - \expandafter\@emphEQ@PostProcess - \else - \@emphEQ@mathbody\expandafter{\the\@emphEQ@mathbody\end{#1}}% - \expandafter\@emphEQ@get@body - \fi -} -\def\@emphEQ@EnvName{@emphEQ@MainEnv} -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} -% \begin{macro}{@emphEQ@PostProcess} -% Now we can go on with the post processing, which is the real -% workhorse in this package. The first job is to test if we're -% using a \cmd{\shadowbox} and then we set some \pkg{amsmath} -% dimensions to zero---\pkg{amsmath} doesn't do this by itself, and -% for that we can be thankful. Otherwise you wouldn't be reading -% this now~;-) -% \begin{macrocode} -\newcommand*{\@emphEQ@PostProcess}{% - \ifx\@emphEQ@boxtype\@emphEQ@shadowbox - \@emphEQ@shadowboxtrue - \else - \@emphEQ@shadowboxfalse - \fi - \tagshift@=0pt \tagwidth@=0pt \totwidth@=0pt - \eqnshift@=0pt \alignsep@=0pt -% \end{macrocode} -% \subsection{The first pass} -% We then run the first pass to find out which environment we've -% got. However we have to store the equation counter because it is -% stepped in this pass, and we certainly don't want that to happen. -% As a side effect this will also tell us if the equations are -% numbered. -% -% If we are to put a brace to the left of the display, it would be -% rather pleasant to know just how high the structure is, since this -% will affect the height and more importantly the width the brace: -% we will need to know the \emph{exact} width of such material. -% Hence we put it in a box which is easy to measure and fiddle -% around with. To achieve this we put the contents of the token register -% \cmd{\@emphEQ@mathbody} in a \env{minipage} inside a \env{lrbox}. Alas, -% \env{lrbox} won't let us escape into display math mode, so we play -% a dirty trick on it and use a \env{minipage}, which will let us -% have our way with it. -% -% The \env{minipage} starts in horizontal mode and then goes -% straight to display math mode, thus adding some space before the -% display math. However there was nothing on the first line in the -% \env{minipage} thus leading \TeX\ to add a \cmd{\abovedisplayskip} -% before the display. We subtract this as fast as we can! -% Furthermore it showed in test runs, that an additional~1~pt had to -% be subtracted in the top---but not in the bottom. It has nothing -% to do with any of the standard page dimensions or parameters. -% Strange indeed. -% \begin{macrocode} - \setcounter{@emphEQ@EqCtr}{\value{equation}}% - \begin{lrbox}{\@emphEQ@Box}% - \begin{minipage}{\linewidth}% - \vskip-\abovedisplayskip\relax\vskip-1pt\relax - \the\@emphEQ@mathbody - \end{minipage}% - \end{lrbox}% -% \end{macrocode} -% We then look at the equation counter to see if we had any numbered -% equations and reset it if that was the case. If we used a -% \env{multline$*$} we can detect this by measuring |\tagwidth@|. -% \begin{macrocode} - \ifnum\value{equation}=\value{@emphEQ@EqCtr}% - \ifdim\tagwidth@>0pt - \else - \@emphEQ@NoNumEqtrue - \fi - \else - \setcounter{equation}{\value{@emphEQ@EqCtr}}% - \fi -% \end{macrocode} -% Now we can determine the various math environments. Firstly we -% measure an empty \cmd{\@emphEQ@boxtype}---we will need this -% information when the math structure is finally put into a box of -% this type, but we have to take it into account when calculating -% the allowable width of \env{multline} displays because we want to -% use the margins already set for this environment. -% \begin{macrocode} - \settowidth{\@emphEQ@boxtypelength}{\@emphEQ@boxtype{}}% -% \end{macrocode} -% The idea is that each of the \pkg{amsmath} multiple line -% environments can be singled out because it uses a certain -% dimension in a way none of the others use it. -% \begin{list}{}{} -% \item[\env{align}:] Uses \cmd{\alignsep@} and sets it to something -% positive. None of the others use it. -% \item[\env{multline}:] Doesn't use \cmd{\eqnshift@}. -% \item[\env{gather}:] Doesn't use \cmd{\tagshift@}. -% \item[\env{alignat}:] Can be determined because some dimensions -% will have special relations e.g., when in |[fleqn,reqno]| mode -% the equation -% \[ -% \cmd{\totwidth@}-\cmd{\tagshift@}=\cmd{\linewidth} -% \] -% holds\footnote{Well almost---they may be off by a few scaled points. -% See section~\ref{sec:CloseEnough} for further details.} -% and similarly for the other three display modes. See the -% code for these equations. -% \end{list} -% -% \subsubsection{\mode{[fleqn,leqno]}} -% ~ -% \begin{macrocode} - \if@emphEQ@FLL % fleqn and leqno - \ifdim\alignsep@>0pt % => align - \@emphEQ@aligntrue - \setlength{\@emphEQ@displaywidth}{\tagshift@-\@mathmargin}% - \else - \ifdim\eqnshift@=0pt % => multline %tagwidth@> - \@emphEQ@multlinetrue - \if@emphEQ@NoNumEq - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\multlinegap-\@mathmargin - -\@emphEQ@boxtypelength}% - \else - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\tagwidth@-\multlinegap - -\multlinetaggap-\@emphEQ@boxtypelength}% - \fi - \else - \ifdim\tagshift@=0pt % => gather - \@emphEQ@gathertrue - \setlength{\@emphEQ@displaywidth}{% - \totwidth@-\@mathmargin}% - \else - \ifdim\tagshift@=\totwidth@ % => alignat - \@emphEQ@alignattrue - \setlength{\@emphEQ@displaywidth}{% - \totwidth@-\@mathmargin}% - \else - %Nothing thus far... - \fi - \fi - \fi - \fi - \fi -% \end{macrocode} -% \subsubsection{\mode{[fleqn,reqno]}} -% ~ -% \begin{macrocode} - \if@emphEQ@FLR % fleqn and reqno - \ifdim\alignsep@>0pt % => align - \@emphEQ@aligntrue - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\@mathmargin+\tagshift@}% - \else - \ifdim\eqnshift@=0pt % => multline - \@emphEQ@multlinetrue - \if@emphEQ@NoNumEq - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\multlinegap-\@mathmargin - -\@emphEQ@boxtypelength}% - \else - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\tagwidth@-\@mathmargin - -\multlinetaggap-\@emphEQ@boxtypelength}% - \fi - \else - \ifdim\tagshift@=0pt % => gather - \@emphEQ@gathertrue - \setlength{\@emphEQ@displaywidth}{% - \totwidth@-\@mathmargin}% - \else - \@emphEQ@CloseEnough{\totwidth@-\tagshift@}% - {\linewidth}% - {\@emphEQ@alignattrue - \setlength{\@emphEQ@displaywidth}% - {\totwidth@-\eqnshift@}}{}% - \fi - \fi - \fi - \fi -% \end{macrocode} -% \subsubsection{\mode{[reqno]}} -% ~ -% \begin{macrocode} - \if@emphEQ@R % reqno - \ifdim\alignsep@>0pt % => align - \@emphEQ@aligntrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}% - \else - \ifdim\eqnshift@=0pt % => multline - \@emphEQ@multlinetrue - \if@emphEQ@NoNumEq - \setlength{\@emphEQ@displaywidth}{% - \linewidth-2\multlinegap - -\@emphEQ@boxtypelength}% - \else - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\tagwidth@-\multlinegap - -\multlinetaggap-\@emphEQ@boxtypelength}% - \fi - \else - \ifdim\tagshift@=0pt % => gather - \@emphEQ@gathertrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}% - \else - \@emphEQ@CloseEnough{\tagshift@}{-\eqnshift@}% - {\@emphEQ@alignattrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}}{}% - \fi - \fi - \fi - \fi -% \end{macrocode} -% \subsubsection{\mode{[leqno]}} -% ~ -% \begin{macrocode} - \if@emphEQ@L % leqno - \ifdim\alignsep@>0pt % => align - \@emphEQ@aligntrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}% - \else - \ifdim\eqnshift@=0pt % => multline - \@emphEQ@multlinetrue - \if@emphEQ@NoNumEq - \setlength{\@emphEQ@displaywidth}{% - \linewidth-2\multlinegap - -\@emphEQ@boxtypelength}% - \else - \setlength{\@emphEQ@displaywidth}{% - \linewidth-\tagwidth@-\multlinegap - -\multlinetaggap-\@emphEQ@boxtypelength}% - \fi - \else - \ifdim\tagshift@=0pt % => gather - \@emphEQ@gathertrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}% - \else - \@emphEQ@CloseEnough{% - \linewidth-\eqnshift@}{\tagshift@}{% - \@emphEQ@alignattrue - \setlength{\@emphEQ@displaywidth}{\totwidth@}}% - {}% - \fi - \fi - \fi - \fi -% \end{macrocode} -% Phew! That was tedious, but necessary. I wish I could say it got -% better further down the road, but it doesn't. Now we can measure -% the width of the additional material on both sides of the math -% structure. We add braces here and there to avoid any -% \cmd{\thinmuskip}'s. -% \begin{macrocode} - \settowidth{\@emphEQ@lwd}{${\@emphEQ@Left}% - {\vphantom{\usebox{\@emphEQ@Box}}}$}% - \settowidth{\@emphEQ@rwd}{${\vphantom{\usebox{\@emphEQ@Box}}}% - {\@emphEQ@Right}$}% -% \end{macrocode} -% -% \subsection{The second pass} -% -% When we try to create an effect as in the preliminary example -% there are a few things we need to tell \LaTeX\ for the overall -% result to be acceptable. If the display math is centered, then the -% new one should also be centered. This means that when typesetting -% the math structure for the second time, we need to make -% adjustments to \cmd{\linewidth}, \cmd{\@mathmargin} etc.\ for the -% equation tag to be placed correctly. -% -% That process is extremely tedious, but there are only few -% shortcuts, so we just go through each of the four environments, check -% each of the four display modes and alter dimensions a we trudge -% along. First we check if we are trying to put something into an -% asymmetrical box and then make it symmetrical be removing the size -% of the shadow. -% \begin{macrocode} - \begin{lrbox}{\@emphEQ@Box}% - \if@emphEQ@shadowbox - \addtolength{\@emphEQ@boxtypelength}{-\shadowsize}% - \fi -% \end{macrocode} -% \subsubsection{\env{align}} -% ~ -% \begin{macrocode} - \if@emphEQ@align - \if@emphEQ@FLL - \begin{minipage}{\linewidth+\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@FLR - \begin{minipage}{\linewidth}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@L - \begin{minipage}{\linewidth+\@emphEQ@lwd-\@emphEQ@rwd}% - \fi - \if@emphEQ@R - \begin{minipage}{\linewidth-\@emphEQ@lwd+\@emphEQ@rwd}% - \fi - \fi -% \end{macrocode} -% \subsubsection{\env{gather}} -% ~ -% \begin{macrocode} - \if@emphEQ@gather - \if@emphEQ@FLL - \begin{minipage}{\linewidth+\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@FLR - \begin{minipage}{\linewidth}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@R - \setlength{\@emphEQ@templength}{\linewidth-\totwidth@ - -\eqnshift@}% - \begin{minipage}{\linewidth-\@emphEQ@lwd+\@emphEQ@rwd - +\@emphEQ@templength-\eqnshift@}% - \fi - \if@emphEQ@L - \setlength{\@emphEQ@templength}{\linewidth-\totwidth@ - -\eqnshift@}% - \begin{minipage}{\linewidth+\@emphEQ@lwd-\@emphEQ@rwd - -\@emphEQ@templength+\eqnshift@}% - \fi - \fi -% \end{macrocode} -% \subsubsection{\env{alignat}} -% ~ -% \begin{macrocode} - \if@emphEQ@alignat - \if@emphEQ@FLL - \begin{minipage}{\linewidth+\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@FLR - \begin{minipage}{\linewidth}% - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}%% - \fi - \if@emphEQ@L - \begin{minipage}{\linewidth+\@emphEQ@lwd-\@emphEQ@rwd}% - \fi - \if@emphEQ@R - \begin{minipage}{\linewidth-\@emphEQ@lwd+\@emphEQ@rwd}% - \fi - \fi -% \end{macrocode} -% \subsubsection{\env{multline}} -% ~ -% \begin{macrocode} - \if@emphEQ@multline - \if@emphEQ@FLL - \begin{minipage}{\linewidth}% - \if@emphEQ@NoNumEq - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\@mathmargin}{\shadowsize} - \fi% - \else - \addtolength{\multlinetaggap}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinegap}{\shadowsize}% - \fi - \fi - \addtolength{\multlinegap}{\@emphEQ@rwd - +.5\@emphEQ@boxtypelength}% - \fi - \if@emphEQ@FLR - \begin{minipage}{\linewidth}% - \if@emphEQ@NoNumEq - \addtolength{\multlinegap}{\@emphEQ@rwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinegap}{\shadowsize}% - \fi - \else - \addtolength{\multlinetaggap}{\@emphEQ@rwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinetaggap}{\shadowsize}% - \fi - \fi - \addtolength{\@mathmargin}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \fi - \if@emphEQ@L - \begin{minipage}{\linewidth}% - \if@emphEQ@NoNumEq - \addtolength{\multlinegap}{.5\@emphEQ@rwd - +.5\@emphEQ@lwd+.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinegap}{.5\shadowsize}% - \fi - \else - \addtolength{\multlinetaggap}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \addtolength{\multlinegap}{\@emphEQ@rwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinegap}{\shadowsize}% - \fi - \fi - \fi - \if@emphEQ@R - \begin{minipage}{\linewidth}% - \if@emphEQ@NoNumEq - \addtolength{\multlinegap}{.5\@emphEQ@rwd - +.5\@emphEQ@lwd+.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinegap}{.5\shadowsize} - \fi - \else - \addtolength{\multlinetaggap}{\@emphEQ@rwd - +.5\@emphEQ@boxtypelength}% - \addtolength{\multlinegap}{\@emphEQ@lwd - +.5\@emphEQ@boxtypelength}% - \if@emphEQ@shadowbox - \addtolength{\multlinetaggap}{\shadowsize} - \fi - \fi - \fi - \fi -% \end{macrocode} -% Finally we get to typeset the contents of \cmd{\@emphEQ@mathbody} for -% the second time\ldots -% \begin{macrocode} - \vskip-\abovedisplayskip\relax\vskip-1pt\relax - \the\@emphEQ@mathbody - \end{minipage}% - \end{lrbox}% -% \end{macrocode} -% -% \subsection{Putting it into the box} -% -% Because we were clever to start with---by measuring the width of -% the display math and storing it in -% \cmd{\@emphEQ@displaywidth}---we can now put it into a box of -% width -% \cmd{\@emphEQ@displaywidth}+\cmd{\@emphEQ@rwd}+\cmd{\@emphEQ@lwd}. -% This doesn't apply to \env{multline} though: it has to be set in a -% box of width \cmd{\@emphEQ@displaywidth}. -% \begin{macrocode} -\setlength{\@emphEQ@BoxWidth}{\@emphEQ@displaywidth+\@emphEQ@rwd - +\@emphEQ@lwd}% -% \end{macrocode} -% \subsubsection{\env{align}} -% ~ -% \begin{macrocode} -\if@emphEQ@align - \if@emphEQ@FLL - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength% - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern-\@emphEQ@displaywidth - \kern-\@emphEQ@rwd - \kern-\@emphEQ@lwd - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@FLR - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength% - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern-\alignsep@ - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@L - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - %\kern\eqnshift@ - %\kern-\alignsep@ - $\@emphEQ@Left$% - \kern-\eqnshift@ - %\kern-\alignsep@ - \usebox{\@emphEQ@Box}% - %\kern-\eqnshift@ - \kern-\alignsep@ - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@R - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - $\@emphEQ@Left$% - \kern-\eqnshift@ - \usebox{\@emphEQ@Box}% - \kern-\eqnshift@ - $\@emphEQ@Right$}}% - \fi -\fi -% \end{macrocode} -% \subsubsection{\env{alignat}} -% ~ -% \begin{macrocode} -\if@emphEQ@alignat - \if@emphEQ@FLL - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern\@mathmargin - \kern\@emphEQ@displaywidth - \kern-\linewidth - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@FLR - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern\@mathmargin - \kern\@emphEQ@displaywidth - \kern-\linewidth - \kern\@emphEQ@lwd - \kern.5\@emphEQ@boxtypelength - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@L - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - $\@emphEQ@Left$% - \kern-\eqnshift@ - \usebox{\@emphEQ@Box}% - \kern-\eqnshift@ - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@R - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - $\@emphEQ@Left$% - \kern-\eqnshift@ - \usebox{\@emphEQ@Box}% - \kern-\eqnshift@ - $\@emphEQ@Right$}}% - \fi -\fi -% \end{macrocode} -% \subsubsection{\env{gather}} -% ~ -% \begin{macrocode} -\if@emphEQ@gather - \if@emphEQ@FLL - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern-\linewidth - \kern\@mathmargin - \kern\@emphEQ@displaywidth - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@FLR - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize - \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@mathmargin - \kern-\@emphEQ@lwd - \usebox{\@emphEQ@Box}% - \kern-\linewidth - \kern.5\@emphEQ@boxtypelength - \kern\@mathmargin - \kern\@emphEQ@displaywidth - \kern\@emphEQ@lwd - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@L - \setlength{\tagwidth@}{\eqnshift@+\@emphEQ@rwd}% - \setlength{\@emphEQ@templength}{\linewidth-\totwidth@ - -\eqnshift@}% - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - \ifdim\@emphEQ@templength<\tagwidth@ - \setlength{\tagwidth@}{\@emphEQ@templength - +\@emphEQ@lwd}% - \ifdim\tagwidth@<\eqnshift@ - \kern-\@emphEQ@templength - \kern\eqnshift@ - \fi - \else - \kern-\@emphEQ@lwd - \kern\@emphEQ@rwd - \kern-\@emphEQ@templength - \kern\eqnshift@ - \fi - $\@emphEQ@Left$% - \kern-\eqnshift@ - \usebox{\@emphEQ@Box}% - %\kern-\eqnshift@ - \kern-\@emphEQ@lwd - \kern\@emphEQ@rwd - \kern-\@emphEQ@templength - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@R - \setlength{\tagwidth@}{\eqnshift@+\@emphEQ@rwd}% - \setlength{\@emphEQ@templength}{\linewidth-\totwidth@ - -\eqnshift@}% - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@BoxWidth][c]{% - \kern-\@emphEQ@lwd - \kern\@emphEQ@rwd - \kern\@emphEQ@templength - \kern-\eqnshift@ - $\@emphEQ@Left$% - \ifdim\@emphEQ@templength>\tagwidth@ - \kern-\eqnshift@ - \else - \kern\@emphEQ@lwd - \kern-\@emphEQ@rwd - \kern-\@emphEQ@templength - \fi - \usebox{\@emphEQ@Box}% - \kern-\eqnshift@ - $\@emphEQ@Right$}}% - \fi -\fi -% \end{macrocode} -% \subsubsection{\env{multline}} -% -% \env{multline} is somewhat more difficult because \env{multline$*$} -% differs on several accounts. Thus we make use of our little test -% to see if the math structure was numbered to begin with -% (\verb|\if@emphEQ@NoNumEq|). -% \begin{macrocode} -\if@emphEQ@multline - \if@emphEQ@FLL - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@displaywidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@emphEQ@lwd - \if@emphEQ@NoNumEq - \if@emphEQ@shadowbox \kern-\shadowsize \fi - \kern-\@mathmargin - \else - \kern-\tagwidth@ - \kern-\multlinetaggap - \fi - \usebox{\@emphEQ@Box}% - \kern-\@emphEQ@boxtypelength - \if@emphEQ@NoNumEq - \kern-\multlinegap - \else - \kern\multlinegap - \fi - \kern-\@emphEQ@rwd - \kern-\@emphEQ@lwd - \kern-\@mathmargin - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@FLR - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@displaywidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@emphEQ@lwd - \kern-\@mathmargin - \usebox{\@emphEQ@Box}% - \kern-\@emphEQ@boxtypelength - \kern-\@emphEQ@rwd - \kern-\@emphEQ@lwd - \if@emphEQ@NoNumEq - \kern-\multlinegap - \else - \kern-\multlinetaggap - \fi - \kern-\@mathmargin - \kern-\tagwidth@ - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@L - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@displaywidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \kern-\@emphEQ@lwd - \if@emphEQ@NoNumEq - \kern-\multlinegap - \kern.5\@emphEQ@lwd - \kern-.5\@emphEQ@rwd - \if@emphEQ@shadowbox \kern-.5\shadowsize \fi - \else - \kern-\multlinetaggap - \kern-\tagwidth@ - \fi - \usebox{\@emphEQ@Box}% - \kern-.5\@emphEQ@boxtypelength - \if@emphEQ@NoNumEq - \kern.5\@emphEQ@rwd - \kern-.5\@emphEQ@lwd - \fi - \kern-\@emphEQ@rwd - \kern-\multlinegap - $\@emphEQ@Right$}}% - \fi - \if@emphEQ@R - \savebox{\@emphEQ@Box}{\makebox[\@emphEQ@displaywidth][l]{% - \if@emphEQ@shadowbox \kern.5\shadowsize \fi - $\@emphEQ@Left$% - \kern-.5\@emphEQ@boxtypelength - \if@emphEQ@NoNumEq - \if@emphEQ@shadowbox \kern-.5\shadowsize \fi - \kern-.5\@emphEQ@rwd - \kern.5\@emphEQ@lwd - \fi - \kern-\@emphEQ@lwd - \kern-\multlinegap - \usebox{\@emphEQ@Box}% - \kern-.5\@emphEQ@boxtypelength - \kern-\@emphEQ@rwd - \if@emphEQ@NoNumEq - \kern-\multlinegap - \kern-.5\@emphEQ@lwd - \kern.5\@emphEQ@rwd - \else - \kern-\multlinetaggap - \fi - \kern-\tagwidth@ - $\@emphEQ@Right$}}% - \fi -\fi -% \end{macrocode} -% -% \subsubsection{The final step} -% -% At last here comes the good part! We are now ready to place the -% box containing all of our math material. If we have used a -% \env{multline} we have to do a few kerning tricks but at least we -% would seem to know the drill by now\ldots To make sure vertical -% spacing is ok, we put it all into a simple math environment -% \verb|\[...\]|. -% \begin{macrocode} -\[ - \if@emphEQ@align - \if@emphEQ@L - \kern-\alignsep@ - \kern\eqnshift@ - \fi - \fi - \if@emphEQ@gather - \if@emphEQ@L - \kern-\@emphEQ@templength - \kern\eqnshift@ - \kern\@emphEQ@rwd - \kern-\@emphEQ@lwd - \fi - \if@emphEQ@R - \setlength{\tagwidth@}{\eqnshift@+\@emphEQ@rwd}% - \ifdim\@emphEQ@templength>\tagwidth@ - \kern-\@emphEQ@templength - \kern\eqnshift@ - \kern\@emphEQ@lwd - \else - \kern\@emphEQ@templength - \kern-\eqnshift@ - \kern\@emphEQ@rwd - \kern-\@emphEQ@lwd - \fi - \fi - \fi - \if@emphEQ@multline - \if@emphEQ@NoNumEq - % naught - \else - \if@emphEQ@FLL - \kern-\@mathmargin - \kern\tagwidth@ - \kern\multlinetaggap - \fi - \if@emphEQ@L - \kern\tagwidth@ - \kern\multlinetaggap - \kern-\multlinegap - \fi - \if@emphEQ@R - \kern-\tagwidth@ - \kern-\multlinetaggap - \kern\multlinegap - \fi - \fi - \else -% \end{macrocode} -% If we are using a \cmd{\shadowbox} in centered display mode, I -% would rather that the shadowsize is ignored when placing the box. -% Reason: I think it looks better. Judge for yourself: -% \begin{gather} -% a=b\\ -% \Phi(x)=\int_{-\infty}^x e^{-t^2/2}\, dt -% \end{gather} -% -% \begin{empheq}[boxtype=\shadowbox] -% \begin{gather} -% a=b\\ -% \Phi(x)=\int_{-\infty}^x e^{-t^2/2}\, dt -% \end{gather} -% \end{empheq} -% \begin{macrocode} - \if@emphEQ@shadowbox - \if@emphEQ@R - \kern\shadowsize - \fi - \if@emphEQ@L - \kern\shadowsize - \fi - \fi - \fi - \@emphEQ@boxtype{\usebox{\@emphEQ@Box}}% -% \end{macrocode} -% After all is done, we empty out the added material and the -% boxtype. -% \begin{macrocode} - \gdef\@emphEQ@Left{}\gdef\@emphEQ@Right{}% - \gdef\@emphEQ@boxtype{}% - \]% - \ifnum0=`{\fi}% - \expandafter\end\expandafter{\@emphEQ@EnvName}% -} -% \end{macrocode} -% -% \subsection{Going public\ldots} -% \begin{macro}{boxtype}\begin{macro}{Left}\begin{macro}{Right}\begin{macro}{empheq} -% In order to simplify the user interface, we make use of -% \pkg{keyval}. We define three keys to be used along with a more -% accessible version of \env{@emphEQ@MainEnv}. -% \changes{v0.7}{2003/05/11}{Changed the user interface slightly} -% \begin{macrocode} -\define@key{empheq}{boxtype}{\renewcommand\@emphEQ@boxtype{#1}} -\define@key{empheq}{Left}{\def\@emphEQ@Left{#1}} -\define@key{empheq}{Right}{\def\@emphEQ@Right{#1}} -\newenvironment{empheq}[1][]{\setkeys{empheq}{#1}\@emphEQ@MainEnv}% - {\end@emphEQ@MainEnv\ignorespacesafterend}% -% \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro} -% \begin{macro}{\DeclareLeftDelimiter} -% \changes{v0.7}{2003/05/11}{Added delimiter interface} -% \begin{macro}{\DeclareRightDelimiter} -% \changes{v0.7}{2003/05/11}{Added delimiter interface} -% It might come in handy to have delimiters of the appropriate size -% available to cover the math display as in \eqref{eq:1}. Therefore -% we define two commands that will create such delimiters once and -% for all. -% Use this as an inspiration for further kinds of delimiters. -% \begin{macrocode} -\newcommand{\DeclareLeftDelimiter}[2][\!]{% - \@namedef{empheq\expandafter\@gobble\string#2}{ - \left#2 - \vphantom{\usebox{\@emphEQ@Box}}% - \right.#1}} -\newcommand{\DeclareRightDelimiter}[2][\!]{% - \@namedef{empheq\expandafter\@gobble\string#2}{% - #1\left. - \vphantom{\usebox{\@emphEQ@Box}}% - \right#2}}% -\DeclareRightDelimiter{\rbrace} -\DeclareLeftDelimiter{\lbrace} -%</package> -% \end{macrocode} -% \end{macro}\end{macro}\end{macro} -% \Finale -\endinput diff --git a/Master/texmf-dist/source/latex/mh/flexisym.dtx b/Master/texmf-dist/source/latex/mh/flexisym.dtx index 6aecf24551c..08aeef1ec7e 100644 --- a/Master/texmf-dist/source/latex/mh/flexisym.dtx +++ b/Master/texmf-dist/source/latex/mh/flexisym.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % Copyright (C) 1997-2003 by Michael J. Downes -% Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +% Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -18,7 +18,7 @@ % This work consists of the main source file flexisym.dtx % and the derived files % flexisym.sty, flexisym.pdf, flexisym.ins, flexisym.drv, -% cmbase.sym, msabm.sym. +% cmbase.sym, mathpazo.sym, mathptmx.sym, msabm.sym. % % Distribution: % CTAN:macros/latex/contrib/mh/flexisym.dtx @@ -72,7 +72,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: flexisym 2007/12/19 v0.96 Flexisym (MH)} +\Msg{* Package: flexisym 2008/07/23 v0.97 Flexisym (MH)} \Msg{************************************************************************} \keepsilent @@ -83,7 +83,7 @@ This is a generated file. Copyright (C) 1997-2003 by Michael J. Downes -Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -138,7 +138,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{flexisym.drv}% - [2007/12/19 v0.96 flexisym (MH)] + [2008/07/23 v0.97 flexisym (MH)] \documentclass{ltxdoc} \CodelineIndex \EnableCrossrefs @@ -162,7 +162,7 @@ and the derived files % \fi % % \title{The \textsf{flexisym} package} -% \date{2007/12/19 v0.96} +% \date{2008/07/23 v0.97} % \author{Morten H\o gholm \\\texttt{mh.ctan@gmail.com}} % % \maketitle @@ -178,7 +178,7 @@ and the derived files % % \begin{macrocode} %<*package> -\ProvidesPackage{flexisym}[2007/12/19 v0.96] +\ProvidesPackage{flexisym}[2008/07/23 v0.97] \let\@xp\expandafter \let\@nx\noexpand \edef\do{% \@nx\AtEndOfPackage{% @@ -472,7 +472,8 @@ and the derived files % % And we then continue with the options. % \begin{macrocode} -\DeclareOption{mathstyleoff}{\PassOptionsToPackage{mathactivechars}{mathstyle}} +\DeclareOption{mathstyleoff}{% + \PassOptionsToPackage{noactivechars}{mathstyle}} \DeclareOption{cmbase}{\usesymbols{cmbase}} \DeclareOption{mathpazo}{\usesymbols{mathpazo}} \DeclareOption{mathptmx}{\usesymbols{mathptmx}} diff --git a/Master/texmf-dist/source/latex/mh/mathstyle.dtx b/Master/texmf-dist/source/latex/mh/mathstyle.dtx index 9c65737aa88..34a1913112d 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 by Morten Hoegholm <mh.ctan@gmail.com> +% Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -67,7 +67,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: mathstyle 2007/12/19 v0.84 Mathstyle (MH)} +\Msg{* Package: mathstyle 2008/07/23 v0.85 Mathstyle (MH)} \Msg{************************************************************************} \keepsilent @@ -78,7 +78,7 @@ This is a generated file. Copyright (C) 1997-2003 by Michael J. Downes -Copyright (C) 2007 by Morten Hoegholm <mh.ctan@gmail.com> +Copyright (C) 2007-2008 by Morten Hoegholm <mh.ctan@gmail.com> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -128,7 +128,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathstyle.drv}% - [2007/12/19 v0.84 mathstyle (MH)] + [2008/07/23 v0.85 mathstyle (MH)] \documentclass{ltxdoc} \CodelineIndex \EnableCrossrefs @@ -141,7 +141,7 @@ and the derived files % \fi % % \title{The \textsf{mathstyle} package} -% \date{2007/12/19 v0.84} +% \date{2008/07/23 v0.85} % \author{Morten H\o gholm \\\texttt{mh.ctan@gmail.com}} % % @@ -206,7 +206,7 @@ and the derived files % % \begin{macrocode} %<*package> -\ProvidesPackage{mathstyle}[2007/12/19 v0.84] +\ProvidesPackage{mathstyle}[2008/07/23 v0.85] % \end{macrocode} % \begin{macro}{\@saveprimitive} % A straight copy from \pkg{breqn}, see implementation details @@ -384,15 +384,30 @@ and the derived files % \end{macrocode} % Finally, we declare the package options. % \begin{macrocode} -\DeclareOption{mathactivechars}{\catcode`\^=7\relax \catcode`\_=8\relax } -\DeclareOption{activechars}{\catcode`\^=13\relax \catcode`\_=13\relax } +\DeclareOption{mathactivechars}{% + \catcode`\^=12\relax + \catcode`\_=12\relax} +\DeclareOption{activechars}{% + \catcode`\^=13\relax + \catcode`\_=13\relax} +\DeclareOption{noactivechars}{% + \catcode`\^=7\relax + \catcode`\_=8\relax} +\ExecuteOptions{mathactivechars} \ProcessOptions\relax +% \end{macrocode} +% WSPR: Set up the active behaviours: (this is set even in the |noactivechars| case but they are never activated. no worries?) +% \begin{macrocode} \ifnum\catcode`\^=13\relax \let^=\sp \let_=\sb \else - \mathcode`\^="8000\relax \mathcode`\_="8000\relax - \begingroup \catcode`\^=\active \catcode`\_=\active - \global\let^=\sp \global\let_=\sb + \mathcode`\^="8000\relax + \mathcode`\_="8000\relax + \begingroup + \catcode`\^=\active + \catcode`\_=\active + \global\let^=\sp + \global\let_=\sb \endgroup \fi %</package> diff --git a/Master/texmf-dist/source/latex/mh/mathtools.dtx b/Master/texmf-dist/source/latex/mh/mathtools.dtx index 585ec5d9b9c..3b43779df59 100644 --- a/Master/texmf-dist/source/latex/mh/mathtools.dtx +++ b/Master/texmf-dist/source/latex/mh/mathtools.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2004-2007 by Morten Hoegholm <mh.ctan@gmail.com> +% Copyright (C) 2004-2008 by Morten Hoegholm <mh.ctan@gmail.com> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -66,7 +66,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: mathtools 2007/12/03 v1.03 (MH)} +\Msg{* Package: mathtools 2008/08/01 v1.06 (MH)} \Msg{************************************************************************} \keepsilent @@ -126,7 +126,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathtools.drv}% - [2007/12/03 v1.03 mathematical typesetting tools (MH)] + [2008/08/01 v1.06 mathematical typesetting tools (MH)] \documentclass{ltxdoc} \IfFileExists{fourier.sty}{\usepackage{fourier}}{} \addtolength\marginparwidth{-25pt} @@ -171,6 +171,17 @@ and the derived files }% } +\newcommand*\ProvidedBy[2]{% + \hskip1sp + \marginpar{% + \parbox[b]{\marginparwidth}{\small\sffamily\raggedright + \strut Feature provided by\\#1\\#2% + } + }% +} + + + \newcommand*\cttPosting[2]{% \hskip1sp \marginpar{% @@ -814,6 +825,15 @@ and the derived files % Note that this feature only works if you use \cs{eqref} or % \cs{refeq} to reference your equations. % +% When using \key{showonlyrefs} it might be usefull to be able to +% actually add a few equation numbers without having to actually +% refer to them. +% \begin{codesyntax} +% \SpecialUsageIndex{\noeqref}\cs{noeqref}\marg{label,label,\dots} +% \end{codesyntax} +% \FeatureRequest{Rasmus Villemoes}{2008/03/26} +% The syntax is somewhat similar to \cs{nocite}. +% % \subsection{Extensible symbols} % % The number of horizontally extensible symbols in standard \LaTeX{} @@ -1165,6 +1185,98 @@ and the derived files % \end{dcases*} % \] % +% +% \subsubsection{Emulating indented lines in alignments} +% \begin{codesyntax} +% \SpecialEnvIndex{\MoveEqLeft}\cs{MoveEqLeft}\oarg{number} +% \end{codesyntax} +% \ProvidedBy{Lars Madsen}{2008/06/05} +% In \cite{Swanson}, Ellen Swanson recommends that when ever one has +% a long displayed formula, spannig several lines, and it is +% unfeasible to align against a relation within the first line, then +% all lines in the display should be aligned at the left most edge of +% the first line, and all subsequent lines should be indented by 2em +% (or if needed by a smaller amount). That is we are talking about +% displayes that end up looking like this +% \begin{align*} +% \MoveEqLeft \framebox[10cm][c]{Long first line}\\ +% & = \framebox[6cm][c]{ \hphantom{g} 2nd line}\\ +% & \leq \dots +% \end{align*} +% Traditionally one could do this by starting subsequent lines by +% \verb+&\qquad ...+, but that is tedious. Instead the example above +% was made using \cs{MoveEqLeft}: +% \begin{verbatim} +% \begin{align*} +% \MoveEqLeft \framebox[10cm][c]{Long first line}\\ +% & = \framebox[6cm][c]{ \hphantom{g} 2nd line}\\ +% & \leq \dots +% \end{align*} +% \end{verbatim} +% \cs{MoveEqLeft} is placed instead of the \verb+&+ on the first +% line, and will effectively \emph{move} the entire first line +% \oarg{number} of ems to the left (default is 2). If you choose to +% align to the right of the relation, use \cs{MoveEqLeft}\verb+[3]+ +% to accommodate the extra distance to the alignment point: +% \begin{verbatim} +% \begin{align*} +% \MoveEqLeft[3] \framebox[10cm][c]{Part 1}\\ +% = {} & \framebox[8cm][c]{2nd line}\\ +% & + \framebox[4cm][c]{ last part} +% \end{align*} +% \end{verbatim} +% \begin{align*} +% \MoveEqLeft[3] \framebox[10cm][c]{Long first line}\\ +% = {} & \framebox[6cm][c]{ 2nd line}\\ +% & + \framebox[4cm][c]{ last part} +% \end{align*} +% +% \subsubsection{Adding arrows between lines in an alignment} +% +% \begin{codesyntax} +% \SpecialEnvIndex{\ArrowBetweenLines}\cs{ArrowBetweenLines}\oarg{symbol}\\ +% \SpecialEnvIndex{\ArrowBetweenLines*}\cs{ArrowBetweenLines*}\oarg{symbol} +% \end{codesyntax} +% \hskip1sp +% \marginpar{% +% \parbox[b]{\marginparwidth}{\small\sffamily\raggedright +% \strut Evolved from a request by\\Christian +% Bohr-Halling\\2004/03/31\\on dk.edb.tekst% +% } +% }% +% To add, say $\Updownarrow$ between two lines in an alignment use +% \cs{ArrowBetweenLines} and the \env{alignat} environment: +% \begin{verbatim} +% \begin{alignat*}{2} +% && \framebox[1.5cm]{} &= \framebox[3cm]{}\\ +% \ArrowBetweenLines % \Updownarrow is the default +% && \framebox[1.5cm]{} &= \framebox[2cm]{} +% \end{alignat*} +% \end{verbatim} +% resulting in +% \begin{alignat*}{2} +% && \framebox[1.5cm]{} &= \framebox[3cm]{}\\ +% \ArrowBetweenLines +% && \framebox[1.5cm]{} &= \framebox[2cm]{} +% \end{alignat*} +% Note the use of \verb+&&+ starting each \emph{regular} line of +% math. For adding the arrow on the right, use +% \cs{ArrowBetweenLines*}\oarg{symbol}, and end each line of math +% with \verb+&&+. +% \begin{verbatim} +% \begin{alignat*}{2} +% \framebox[1.5cm]{} &= \framebox[3cm]{} &&\\ +% \ArrowBetweenLines*[\Downarrow] +% \framebox[1.5cm]{} &= \framebox[2cm]{} && +% \end{alignat*} +% \end{verbatim} +% resulting in +% \begin{alignat*}{2} +% \framebox[1.5cm]{} &= \framebox[3cm]{} &&\\ +% \ArrowBetweenLines*[\Downarrow] +% \framebox[1.5cm]{} &= \framebox[2cm]{} && +% \end{alignat*} +% % \subsection{Short intertext} % % @@ -1743,11 +1855,16 @@ and the derived files % \emph{Math mode}, Version 1.71, % 2004/07/06. % (Available from CTAN as file \texttt{Voss-Mathmode.pdf}.) -% +% +% \bibitem{Swanson} +% Ellen Swanson, +% \emph{Mathematics into type}. +% American Mathematical Society, updated edition, 1999. +% Updated by Arlene O'Sean and Antoinette Schleyer. % \end{thebibliography} % % -% \StopEventually{} +% \StopEventually{} % % % \section{Options and package loading} @@ -1757,7 +1874,7 @@ and the derived files % \begin{macrocode} %<*package> \ProvidesPackage{mathtools}% - [2007/12/03 v1.03 mathematical typesetting tools (MH)] + [2008/08/01 v1.06 mathematical typesetting tools (MH)] % \end{macrocode} % \begin{macrocode} \RequirePackage{keyval,calc} @@ -2133,6 +2250,22 @@ and the derived files % \end{macrocode} % \end{macro} % +% \begin{macro}{\noeqref} +% \changes{v1.04}{2008/03/26}{Added \cs{noeqref} (daleif)} +% Macro for adding numbers to non-refered equations. Syntax similar +% to \cs{nocite}. +% \begin{macrocode} +\MHInternalSyntaxOff +\newcommand\noeqref[1]{\@bsphack + \@for\@tempa:=#1\do{% + \edef\@tempa{\expandafter\@firstofone\@tempa}% + \if@filesw\protected@write\@auxout{}% + {\string\MT@newlabel{\@tempa}}\fi} + \@esphack} +\MHInternalSyntaxOn +% \end{macrocode} +% \end{macro} +% % \subsection{Extensible arrows etc.} % % \begin{macro}{\xleftrightarrow} @@ -2746,6 +2879,7 @@ and the derived files % \subsection{Paired delimiters} % % \begin{macro}{\DeclarePairedDelimiter} +% \changes{v1.06}{2008/08/01}{Made user command robust} % This macro defines |#1| to be a control sequence that takes either % a star or an optional argument. % \begin{macrocode} @@ -2776,7 +2910,7 @@ and the derived files % The user command comes here. Just check for the star and choose % the right internal command. % \begin{macrocode} - \newcommand{#1}{ + \DeclareRobustCommand{#1}{ \@ifstar {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _star:}} {\@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar:}} @@ -3214,6 +3348,56 @@ and the derived files % \end{macrocode} % \end{macro} % +% \subsection{An aid to alignment} +% +% \begin{macro}{\MoveEqLeft} +% \changes{v1.05}{2008/06/05}{Added \cs{MoveEqLeft} (daleif)} +% \changes{v1.05b}{2008/06/18}{We don't need \cs{setlength} here +% (daleif), after discussion about \cs{global} and \cs{setlength} on +% ctt} +% This is a very simple macro, we `pull' a line in an alignment +% backwards in order to simulate that all subsequent lines have been +% indented. Note that simply using \verb+\kern-2m+ after the +% \verb+&+ is not enough, then the alignemnt environment never +% detects that there are anything in the cell before the \verb+&+. +% \begin{macrocode} +\newcommand\MoveEqLeft[1][2]{% + \global\@tempdima=#1em% + \kern\@tempdima% + & + \kern-\@tempdima} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ArrowBetweenLines} +% \changes{v1.05}{2008/06/05}{Added \cs{ArrowBetweenLines} as it +% belongs here and not just in my \LaTeX book (daleif)} +% ????Implementation notes are needed???? +% \begin{macrocode} +\MHInternalSyntaxOff +\def\ArrowBetweenLines{\relax + \iffalse{\fi\ifnum0=`}\fi + \@ifstar{\ArrowBetweenLines@auxI{00}}{\ArrowBetweenLines@auxI{01}}} +\def\ArrowBetweenLines@auxI#1{% + \@ifnextchar[% + {\ArrowBetweenLines@auxII{#1}}% + {\ArrowBetweenLines@auxII{#1}[\Updownarrow]}} +\def\ArrowBetweenLines@auxII#1[#2]{% + \ifnum0=`{\fi \iffalse}\fi + \crcr + \noalign{\nobreak\vskip-\baselineskip\vskip-\lineskip}% + \noalign{\expandafter\in@\expandafter{\@currenvir}% + {alignedat,aligned,gathered}% + \ifin@ \else\notag\fi% + }% + \if#1 &&\quad #2\else #2\quad\fi + \\\noalign{\nobreak\vskip-\lineskip}} +\MHInternalSyntaxOn +% \end{macrocode} +% \end{macro} +% +% +% % \section{Macros by other people} % % \subsection{Short intertext} diff --git a/Master/texmf-dist/source/latex/mh/xfrac.dtx b/Master/texmf-dist/source/latex/mh/xfrac.dtx new file mode 100644 index 00000000000..a2e9c9c50fa --- /dev/null +++ b/Master/texmf-dist/source/latex/mh/xfrac.dtx @@ -0,0 +1,1037 @@ +% \iffalse meta-comment +% +% Copyright (C) 2004, 2008 by Morten Hoegholm <mh.ctan@gmail.com> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 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.3 or later is part of all distributions of +% 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 work consists of the main source file xfrac.dtx +% and the derived files +% xfrac.sty, xfrac.pdf, xfrac.ins, xfrac.drv. +% +% Distribution: +% CTAN:macros/latex/contrib/mh/xfrac.dtx +% CTAN:macros/latex/contrib/mh/xfrac.pdf +% +% Unpacking: +% (a) If xfrac.ins is present: +% tex xfrac.ins +% (b) Without xfrac.ins: +% tex xfrac.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{xfrac.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If xfrac.drv is present: +% latex xfrac.drv +% (b) Without xfrac.drv: +% latex xfrac.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex xfrac.dtx +% makeindex -s gind.ist xfrac.idx +% pdflatex xfrac.dtx +% makeindex -s gind.ist xfrac.idx +% pdflatex xfrac.dtx +% +% Installation: +% TDS:tex/latex/mh/xfrac.sty +% TDS:doc/latex/mh/xfrac.pdf +% TDS:source/latex/mh/xfrac.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e} +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: xfrac 2008/08/03 v0.2 textstyle fractions (MH)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2004, 2008 by Morten Hoegholm <mh.ctan@gmail.com> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 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.3 or later is part of all distributions of +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 work consists of the main source file xfrac.dtx +and the derived files + xfrac.sty, xfrac.pdf, xfrac.ins, xfrac.drv. + +\endpreamble + +\generate{% + \file{xfrac.ins}{\from{xfrac.dtx}{install}}% + \file{xfrac.drv}{\from{xfrac.dtx}{driver}}% + \usedir{tex/latex/mh}% + \file{xfrac.sty}{\from{xfrac.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* xfrac.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `xfrac.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{xfrac.drv}% + [2008/08/04 v0.2 textstyle fractions (MH)] +\RequirePackage{fix-cm} +\documentclass{ltxdoc} + + +\usepackage{xfrac} +\usepackage{nicefrac} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\makeatletter +\newenvironment{TemplateInterfaceDescription}[1] + {\subsection{The Template Type `#1'}% + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateArgument##1##2{\item[Arg: ##1]##2\par}% + \def\TemplateSemantics{\enddescription\endgroup + \subsubsection*{Semantics:}}% + } + {\par\bigskip} + +\newenvironment{TemplateDescription}[2] + {\subsection{The Template `#2' (type #1)}% + \subsubsection*{Attributes:}% + \begingroup + \@beginparpenalty\@M + \description + \def\TemplateKey##1##2##3##4{\item[##1 (##2)]##3% + \ifx\TemplateKey##4\TemplateKey\else +% \hskip0ptplus3em\penalty-500\hskip 0pt plus 1filll Default:~##4% + \hfill\penalty500\relax\qquad \hbox{}\hfill Default:~##4% + \nobreak\hskip-\parfillskip\hskip0pt\relax + \fi + \par}% + \def\TemplateSemantics{\enddescription\endgroup + \subsubsection*{Semantics \& Comments:}}% + } + {\par\bigskip} + +\renewcommand*\MakePrivateLetters{\makeatletter\catcode`\_=11\relax} +\makeatother + +\providecommand*\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX} +\providecommand*\LaTeXplus{\LaTeXe$*$} +\providecommand*\key[1]{\textbf{#1}} +\providecommand*\pkg[1]{\textsf{#1}} +\newcommand*\switch[2]{{\fontfamily{#1}\selectfont #2}} + + +\begin{document} + \catcode`\_=12 + \DocInput{xfrac.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{xfrac.drv} +% \CheckSum{249} +% +% \changes{v0.2}{2008/08/04}{Require expl3 and get rid of .ins file} +% \changes{v0.2}{2008/08/04}{Move to macros/latex/contrib/mh on CTAN} +% +% \changes{v0.11}{2004/05/08}{Consistent naming} +% +% \changes{v0.10a}{2004/04/06}{Added a dependency of the latest +% \LaTeX{} release} +% \changes{v0.10a}{2004/04/06}{First version on \textsc{ctan}} +% +% \changes{v0.10}{2004/04/05}{First publicly available prototype +% implementation} +% +% \title{The \pkg{xfrac} package\thanks{This file has version number +% \fileversion, last revised \filedate.}} +% +% \author{Morten H\o gholm} +% \date{\filedate} +% +% \maketitle +% +% \begin{abstract} +% This package uses a template interface to produce nicely looking +% \emph{split level} fractions like \nicefrac{7}{9}\ldots{} +% ehrm\ldots{} I mean \sfrac{7}{9}. +% \end{abstract} +% +% \tableofcontents +% +% \section{User Interface} +% +% The \pkg{xfrac} package defines a document command \cs{sfrac} +% with the following syntax: +% \begin{quote} +% \cs{sfrac}\oarg{instance}\marg{num}\oarg{sep}\marg{denom} +% \end{quote} +% Let's show a few examples: +% \begin{verbatim} +% \sfrac{1}{2}, $\sfrac{1}{2}$, +% $\mathbf{3\times\sfrac{1}{2}}$ +% \quad \fontfamily{ppl}\selectfont Palatino: \sfrac{1}{2} +% \quad \fontfamily{ptm}\selectfont Times: \sfrac{1}{2} +% \end{verbatim} +% \begin{quote} +% \sfrac{1}{2}, $\sfrac{1}{2}$, $\mathbf{3\times\sfrac{1}{2}}$ +% \quad \fontfamily{ppl}\selectfont Palatino: \sfrac{1}{2} +% \quad \fontfamily{ptm}\selectfont Times: \sfrac{1}{2} +% \end{quote} +% You'll notice something interesting: Not only does the \cs{sfrac} +% command work as it should in math mode, it also gets the job done +% for other fonts as well. +% +% +% \section{A Bit of History} +% +% \subsection{The Past} +% +% One of the first exercises in \emph{The \TeX Book} is to design a +% macro for split level fractions. The solution presented is fairly +% simple, using a \emph{virgule} (a slash) for separating the two +% components. It looks okay because the text font and math font of +% Computer Modern look almost identical. +% +% The proper symbol to use instead of the virgule is a \emph{solidus} +% which does not exist in Computer Modern. It is however available in +% the European Computer Modern fonts, but I'll get back to that. +% +% \subsection{The Present} +% +% +% The most common way to produce split level fractions within \LaTeX\ +% is by means of the \pkg{nicefrac} package. Part of the reason it +% has found widespread use is due to the strange design of the +% built-in text fractions of the EC fonts, which look like this: +% \textonehalf. The package is very simple to use but there are a few +% issues: +% \begin{itemize} +% \item It uses the virgule instead of the solidus. +% \item Font size of numerator and denominator is bigger than in the +% built-in symbol. Compare Palatino: \switch{ppl}{\nicefrac{1}{2}} +% vs. \switch{ppl}{\textonehalf }. +% \item It doesn't correct for fonts using text figures such as in the +% \pkg{eco} package. Compare \switch{cmor}{\nicefrac{1}{2}} and +% \switch{cmor}{\nicefrac{8}{9}}. +% \item In math mode, it doesn't always pick up the correct math +% alphabet. +% \end{itemize} +% In short: \pkg{nicefrac} doesn't attempt to be the answer to +% everything and so this is not a criticism of the package. It works +% quite well for Computer Modern which was pretty much what was widely +% available at the time it was developed. Users these days, however, +% have a choice of many fonts when they write their documents. +% +% +% +% +% +% \subsection{The Future} +% +% Fonts are wildly different; one macro that works fine for Computer +% Modern obviously doesn't work well at all in Palatino. For one we +% have to make the separator symbol configurable, and we need to +% take care of several details as well: font scaling of the +% numerator/denominator pair (ND), font selection of ND etc. If we +% are to have a single package for this in the future\footnote{As +% this is intended to be about the future, the \pkg{xfrac} package +% requires the \eTeX{} extensions.} we have to define a totally +% generic interface for the fraction commands and then adjust +% parameters depending on the current font. What you see in this +% prototype implementation of \pkg{xfrac} is just that. +% +% +% \section{Advanced User Interface} +% +% +% \subsection{Text mode} +% +% The usual problem in text mode has a name: Computer Modern. The +% solidi of all the Computer Modern fonts leave a lot to be desired, +% although things are potentially looking better as the Latin Modern +% fonts are becoming more stable and widespread. As long as the +% default fonts are Computer Modern variants we must however work +% around this. One idea that comes to mind is to see what happens +% when you use a solidus from another font instead. Let's try with +% Times: +% \begin{quote} +% \DeclareInstance{xfrac}{cmr2}{text}{ +% slash-symbol-font = ptm, +% } +% ``You take \sfrac[cmr2]{1}{2} cup of sugar, \ldots'' +% \end{quote} +% That looks quite good actually, so it was probably very difficult +% to obtain that result. Nope, it was extremely easy---if you happen +% to know about \emph{instances}: +% \begin{verbatim} +% \DeclareInstance{xfrac}{cmr}{text}{ +% slash-symbol-font = ptm, +% } +% \end{verbatim} +% So we define an instance with the name `cmr' from the template +% `text' which in turn is of template type `xfrac'. You'll notice +% the `cmr' is also the name of the font family for Computer Modern +% Roman and the reasoning behind is that every font family should +% have it's own settings, and if a document command is to work well +% in that scheme, letting it use the name of the current font family +% seems like a good idea. Thus the \cs{sfrac} command checks to see +% whether an instance with same name as the current font family +% exists and uses it if the test is true; otherwise the default +% setting is used. Here we defined the instance to be used for the +% font family `cmr' and just told it to use the Times font for +% typesetting the slash symbol which turns out to be a solidus by +% default. +% +% The option \texttt{cm-recommended} which is loaded by default uses +% the Times solidus for Computer Modern Roman and Computer Modern +% Sans Serif and the Palatino solidus for Computer Modern Typewriter +% Type. This looks quite good. Should you however not want this you +% can use the option \texttt{cm-standard} which produces somewhat +% acceptable results using Computer Modern exclusively. +% +% So what about old style figures? If you use the \pkg{eco} +% package you might define an instance similar to this (`cmor' is +% the name of the roman font activated by \pkg{eco}): +% \DeclareInstance{xfrac}{cmor}{text}{ +% slash-symbol-font = ptm, +% numerator-font = cmr, +% denominator-font = cmr, +% } +% \begin{verbatim} +% \DeclareInstance{xfrac}{cmor}{text}{ +% slash-symbol-font = ptm, +% numerator-font = cmr, +% denominator-font = cmr, +% } +% \end{verbatim} +% We also use regular Computer Modern Roman for typesetting ND, so +% we end up with \switch{cmor}{\sfrac{1}{2}} and +% \switch{cmor}{\sfrac{8}{9}} instead of +% \switch{cmor}{\nicefrac{1}{2}} and \switch{cmor}{\nicefrac{8}{9}}. +% Much better. +% +% There are also situations where other tricks are useful. If you +% don't have the inferior and superior figures available in a font, +% or the font doesn't have a wider design for small font sizes, you +% can cheat by manually scaling the ND-pair. I got nice results for +% Adobe's Stempel Garamond (with small caps and old style figures) +% with the following setup: +% \begin{verbatim} +% \DeclareInstance{xfrac}{pegj}{text}{ +% numerator-font = pegx, +% denominator-font = pegx, +% scale-factor = .9, +% h-scale = 1.1, +% } +% \end{verbatim} +% We use the font family `pegx' (Stempel Garamond with real small +% caps) for typesetting the ND-pair. Additionally the key +% \key{scale-factor} specifies that the font size used for the +% ND-pair should be $0.9$ of the height of the solidus, and the key +% \key{h-scale} specifies that the ND-pair should be scaled an extra +% 10\% horizontally. +% +% Should you be so fortunate the have a font with inferior and +% superior figures like in the Monotype Janson example from Philipp +% Lehman's excellent \emph{The Font Installation Guide}. In that +% example Philipp defines the font families `mjn0' for the inferior +% figures and `mjn1' for the superior. Thus to get the \cs{sfrac} +% command to use them on the fly for the font family `mjnj' (Janson, +% old style figures) we would say +% \begin{verbatim} +% \DeclareInstance{xfrac}{mjnj}{text}{ +% numerator-font = mjn1, +% denominator-font = mjn0, +% scaling = false, +% numerator-bot-sep = 0pt, +% denominator-bot-sep = 0pt, +% } +% \end{verbatim} +% I think this example is a very clean way to do it. An alternative +% approach could be to use the keys \key{numerator-format} and +% \key{denominator-format} to process the arguments and let them +% determine what to do. +% +% As a side note Harald Harders was so kind to test it, and it +% \emph{does} actually work---I hadn't tested it myself. +% +% \subsection{Math Mode} +% +% In math mode the choices are a lot fewer because first of all +% \TeX{} comes with a built-in limitation of 16 math families. +% Additionally we will not need a solidus for typesetting split +% fractions in math, as tradition is to use a virgule instead. We +% define the basic `mathdefault' instance to simply use the math +% family in use when the instance is run. So if we're in normal math +% like |$\sfrac{7}{9}$| we simply get family~$-1$. If we're inside a +% \cs{mathbf} we're in family~$4$ (in the standard setup at least), +% and so the fraction is typeset with the same math family. Simple, +% isn't? +% +% You can also declare instances for the math families, but I really +% don't see why you would. If you do then name them according to the +% scheme `mathfam\meta{N}', where \meta{N} is the family number, and +% only do it if you \emph{really} know how to set up math fonts. +% That is, if \cs{DeclareMathAlphabet} is unbeknownst to you, then +% just don't go there. +% +% +% Another example: If we want \cs{sfrac} to produce split fractions +% without doing anything at all, we can choose the collection +% `plainmath', which is defined as +% \begin{verbatim} +% \DeclareCollectionInstance{plainmath}{xfrac}{mathdefault}{math}{ +% denominator-bot-sep = 0pt, +% numerator-bot-sep = 0pt, +% numerator-top-sep = \c_max_dim, +% scaling = false, +% slash-right-mkern = 0mu, +% slash-left-mkern = 0mu, +% } +% \end{verbatim} +% This creates an alternative version of the instance `mathdefault' +% with settings as specified by the keys. In the default math setup +% \key{numerator-top-sep} is set to 0~pt, and here we set +% \key{numerator-bot-sep} to 0~pt as well, so in order to avoid +% over-specification (and an error message) we must set +% \key{numerator-top-sep} to \cs{c_max_dim}. We activate (obeying +% normal scoping rules) it with: +% \begin{verbatim} +% \UseCollection{xfrac}{plainmath} +% \end{verbatim} +% Then |$\sfrac{8}{13}$| produces\begingroup +% \UseCollection{xfrac}{plainmath} +% $\sfrac{8}{13}$ and just typing |$8/13$| gives the same result: +% $8/13$. +% \endgroup +% +% +% \section{The Template Interface} +% +% \begin{TemplateInterfaceDescription}{xfrac} +% +% \TemplateArgument{1} +% {The numerator} +% +% \TemplateArgument{2} +% {The separator} +% +% \TemplateArgument{3} +% {The denominator} +% +% \TemplateSemantics +% +% Typesets arguments 1 and 3 separated by argument 2, which in text +% mode by default is a \emph{solidus}. This is taken from +% \pkg{textcomp} where it is denoted \cs{textfractionsolidus}. +% This is the character used for the ready made split level +% fractions such as \textonehalf---except in the (European) Computer +% Modern fonts. In math mode a \emph{virgule} is used instead as +% this is more appropriate and it is always available in the math +% fonts. The solidus is a text symbol only. +% +% \end{TemplateInterfaceDescription} +% +% \begin{TemplateDescription}{xfrac}{text} +% +% \TemplateKey{numerator-font}{n} +% {Font family specification to use for the numerator.} +% {\cs{f@family}} +% +% \TemplateKey{numerator-format}{f1} +% {Action to be taken on the numerator.} +% {Process argument unchanged} +% +% \TemplateKey{slash-symbol}{n} +% {The separator symbol. If not specified the default value will be +% used instead.} +% {Solidus (\cs{textfractionsolidus})} +% +% \TemplateKey{slash-symbol-font}{n} +% {Font family specification to use for the separator symbol.} +% {\cs{f@family}} +% +% \TemplateKey{slash-symbol-format}{f1} +% {Action to be taken on the separator symbol.} +% {Process argument unchanged} +% +% \TemplateKey{denominator-font}{n} +% {Font family specification to use for the denominator.} +% {\cs{f@family}} +% +% \TemplateKey{denominator-format}{f1} +% {Action to be taken on the denominator.} +% {Process argument unchanged} +% +% \TemplateKey{h-scale}{n} +% {Factor by which the numerator and denominator should be +% horizontally scaled. It should only be used if the real superior +% and inferior fonts are not available. For instance Stempel +% Garamond looks excellent if scaled 10\% extra horizontally, i.e., +% by a factor of 1.1.} +% {1} +% +% \TemplateKey{v-scale}{n} +% {Same as \key{h-scale} only vertically. Probably not of much use +% but added for completetion.} +% {1} +% +% \TemplateKey{scale-factor}{n} +% {Fraction of the size of \key{slash-symbol}. Used for setting the +% font size of numerator and denominator. Usually a value of app.\ +% \sfrac{5}{6} produces fine results. It should only be used if the +% real superior and inferior fonts are not available. As an example +% Stempel Garamond looks better if the factor is 0.9.} +% {0.83333} +% +% \TemplateKey{scale-relative}{s} +% {If set to `true' the font size of the numerator and denominator +% is scaled with respect to the height of the \key{slash-symbol}. If +% set to `false' the font is scaled with respect to the total height +% of the \key{slash-symbol}.} +% {true} +% +% \TemplateKey{scaling}{s} +% {If set to `true' the fonts are allowed to scale. If set to +% `false' they are not. See the `Janson' example for an application.} +% {true} +% +% \TemplateKey{numerator-top-sep}{L} +% {Dimension specifying the space between the top of the +% \key{slash-symbol} and the top of the numerator. If not specified, +% the depth of the solidus will be used, because this value will +% make the fraction look even.} +% {Unspecified} +% +% \TemplateKey{numerator-bot-sep}{L} +% {Dimension specifying the lift of the numerator from the +% baseline.} +% {Unspecified} +% +% \TemplateKey{denominator-bot-sep}{L} +% {Dimension specifying the lift of the denominator from the +% baseline.} +% {Unspecified} +% +% \TemplateKey{slash-right-kern}{L} +% {Dimension specifying the kerning between the \key{slash-symbol} +% and the numerator. If specified in terms of font specific +% dimensions such as \texttt{em} it is better to use +% \cs{DelayEvaluation}.} +% {\texttt{0pt}} +% +% \TemplateKey{slash-left-kern}{L} +% {Dimension specifying the kerning between the \key{slash-symbol} +% and the denominator. If specified in terms of font specific +% dimensions such as \texttt{em} it is better to use +% \cs{DelayEvaluation}.} +% {\texttt{0pt}} +% +% \TemplateKey{math-mode}{s} +% {Are we in math mode or not?} +% {false} +% +% \TemplateKey{phantom}{n} +% {A character that suits the common cases. As we would mostly want +% to use numbers in text mode we choose a `tall' number, while in +% math it is somewhat different.} +% {8} +% +% \TemplateSemantics +% +% This template is also the foundation for the `math' template. The +% keys \key{slash-right-mkern} and \key{slash-left-mkern} can only +% be used in math mode and are not shown here. +% +% \end{TemplateDescription} +% +% +% \begin{TemplateDescription}{xfrac}{math} +% +% \TemplateKey{numerator-font}{n} +% {Font family specification to use for the numerator.} +% {\cs{number}\cs{fam}} +% +% \TemplateKey{slash-symbol}{n} +% {The separator symbol. If not specified the default value will be +% used instead.} +% {Virgule ($/$)} +% +% \TemplateKey{slash-symbol-font}{n} +% {Font family specification to use for the separator symbol.} +% {\cs{number}\cs{fam}} +% +% \TemplateKey{denominator-font}{n} +% {Font family specification to use for the denominator.} +% {\cs{number}\cs{fam}} +% +% \TemplateKey{scale-factor}{n} +% {Fraction of the size of \key{slash-symbol}. In math mode we +% cannot rely on the fonts to be able to scale, but giving a default +% scale of 0.7 fits into the regular size changing scheme---the +% default scheme has values $(D,T,S,SS)=(1,1,0.7,0.5)$ whereas we +% with a default \key{scale-factor} of 0.7 get $(1,1,0.7,0.49)$. +% That's close enough.} +% {0.7} +% +% \TemplateKey{scale-relative}{s} +% {If set to `true' the font size of the numerator and denominator +% is scaled with respect to the height of the \key{slash-symbol}. If +% set to `false' the font is scaled with respect to the total height +% of the \key{slash-symbol}.} +% {false} +% +% \TemplateKey{scaling}{s} +% {If set to `true' the fonts are allowed to scale. If set to +% `false' they are not. See the `plainmath' example for an application.} +% {true} +% +% \TemplateKey{numerator-top-sep}{L} +% {Dimension specifying the space between the top of the +% \key{slash-symbol} and the top of the numerator. If not specified, +% the depth of the virgule will be used, because this value will +% make the fraction look even.} +% {\texttt{0pt}} +% +% \TemplateKey{denominator-bot-sep}{L} +% {Dimension specifying the lift of the denominator from the +% baseline.} +% {\texttt{0pt}} +% +% \TemplateKey{slash-right-mkern}{n} +% {Same as \key{slash-right-kern} but for math mode only and should +% be specified in \texttt{mu} units. This is because \pkg{calc} +% can't use mu-expressions.} +% {\texttt{-2mu}} +% +% \TemplateKey{slash-left-mkern}{n} +% {Same as \key{slash-left-kern} but for math mode only and should +% be specified in \texttt{mu} units. This is because \pkg{calc} +% can't use mu-expressions.} +% {\texttt{-1mu}} +% +% \TemplateKey{math-mode}{s} +% {Are we in math mode or not?} +% {true} +% +% \TemplateKey{phantom}{n} +% {A character that suits the common cases. In math we have a high +% risk of using a parenthesis, so we choose that. Text mode is +% another story.} +% {(} +% +% \TemplateSemantics +% +% This template is a restricted version of the `text' template. Only +% the keys that are different from the `text' template are shown +% here. Also bear in mind that the attributes \key{slash-left-kern} +% and \key{slash-right-kern} have no meaning in this template. +% +% \end{TemplateDescription} +% +% +% +% \StopEventually{} +% +% \section{Implementation} +% +% \changes{v0.10b}{2004/04/07}{Now uses \cs{InternalSyntaxOn}} +% \changes{v0.2}{2008/08/04}{Now uses \cs{ProvidesExplPackage}} +% We set up the programming interface. We need the +% \pkg{template} and \pkg{xparse} packages from the +% experimental code, more precisely from the `xbase' bundle. The +% other packages are well-known. +% \begin{macrocode} +\RequirePackage{l3names}[2007/09/01] +\ProvidesExplPackage{xfrac}{2008/08/04}{0.2}{Text fractions} +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{textcomp,graphicx,amstext} +\RequirePackage{template}[2008/08/03] % force upgrade!! +\RequirePackage{xparse}[2008/08/03] % force upgrade!! +% \end{macrocode} +% With v0.10b the new internal syntax using |_| and |:| was +% introduced. Starting from v0.2 the expl3 code base is used and, +% hence, also its programming setup. White space is ignored as well, +% so any |@|-signs in the code are remnants of old \LaTeX{} coding +% conventions. +% \begin{macrocode} +% \end{macrocode} +% +% An option: +% \begin{macrocode} +\bool_new:N \g_cm_recommended_bool +\DeclareOption{cm-recommended} + { \bool_gset_true:N \g_cm_recommended_bool } +\DeclareOption{cm-standard} + { \bool_gset_false:N \g_cm_recommended_bool } +\ExecuteOptions{cm-recommended} +\ProcessOptions\relax +% \end{macrocode} +% +% \begin{macro}{\l_xfrac_temp_box} +% \begin{macro}{\l_xfrac_slash_box} +% We use two box registers. We could probably get away with using +% scratch boxes, but this feels safer. Anyway we're all using +% \eTeX{} now so why not? +% \begin{macrocode} +\box_new:N \l_xfrac_temp_box +\box_new:N \l_xfrac_slash_box +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{The Templates} +% Then we declare the template. % \begin{macrocode} +\DeclareTemplateType{xfrac}{3} +% \end{macrocode} +% The template type `text'. Make two separate templates: text and +% math!! It is okay they share keys but it just gets too complicated +% within the template declaration. +% \begin{macrocode} +\DeclareTemplate{xfrac}{text}{3}{ + numerator-font = n [\f@family] \xfrac_numeratorfont:, + numerator-format = f1 [#1] \xfrac_numeratorformat:n, + slash-symbol = n [\textfractionsolidus] + \xfrac_slashsymbol:, + slash-symbol-font = n [\f@family] \xfrac_slashsymbolfont:, + slash-symbol-format = f1 [#1] \xfrac_slashsymbolformat:n, + denominator-font = n [\f@family] \xfrac_denominatorfont:, + denominator-format = f1 [#1] \xfrac_denominatorformat:n, + h-scale = n [1] \xfrac_hscale:, + v-scale = n [1] \xfrac_vscale:, + scale-factor = n [.83333] \xfrac_scalefactor:, + scale-relative = s [true] + { \def:Npn \xfrac_relscale: {\box_ht:N\l_xfrac_slash_box}} + { \def:Npn \xfrac_relscale: { + \dim_eval:n { \box_ht:N\l_xfrac_temp_box + \box_dp:N\l_xfrac_temp_box }} }, + scaling = s [true] + {\def:Npn\xfrac_fontscale: { + \fontsize{\xfrac_scalefactor: \xfrac_relscale:}{\c_zero_dim}\selectfont}} + { \let:NN \xfrac_fontscale: \use_noop: }, +% \end{macrocode} +% Here comes some fake lengths. I've decided to call them with the +% suffix |_fdim|, so that I will remember to use them right. +% \begin{macrocode} + numerator-top-sep = L [\c_max_dim] \l_xfrac_numeratortopsep_fdim, + numerator-bot-sep = L [\c_max_dim] \l_xfrac_numeratorbotsep_fdim, + denominator-bot-sep = L [\c_max_dim] \l_xfrac_denominatorbotsep_fdim, + slash-right-kern = L [0pt] \l_xfrac_slashrightsep_fdim, + slash-left-kern = L [0pt] \l_xfrac_slashleftsep_fdim, +% \end{macrocode} +% As calc can't handle |\muskip|s, I've made them of type `n' and +% added the suffix |_fmu| to indicate `fake mu skip'. +% \begin{macrocode} + slash-right-mkern = n [-2mu] \l_xfrac_slashrightmsep_fmu, + slash-left-mkern = n [-1mu] \l_xfrac_slashleftmsep_fmu, + math-mode = s [false] { \let:NN\xfrac_math: \ensuremath } + { \let:NN \xfrac_math: \use_arg_i:n }, + phantom = n [8] \xfrac_phantom:, +}{ + \DoParameterAssignments + \mode_if_math:TF{ + \let:NN \xfrac_textormath: \text + \def:Npx \xfrac_slashfontchange: {\tex_fam:D \xfrac_slashsymbolfont: } + \def:Npx \xfrac_numeratorfontchange: {\tex_fam:D \xfrac_numeratorfont: } + \def:Npx \xfrac_denominatorfontchange: {\tex_fam:D \xfrac_denominatorfont: } + }{ + \let:NN \xfrac_textormath: \mbox + \def:Npn\xfrac_slashfontchange: { + \fontfamily{\xfrac_slashsymbolfont: }\selectfont} + \def:Npn\xfrac_numeratorfontchange: { + \fontfamily{\xfrac_numeratorfont: }\selectfont} + \def:Npn\xfrac_denominatorfontchange: { + \fontfamily{\xfrac_denominatorfont: }\selectfont} + } + \xfrac_textormath: { +% \end{macrocode} +% \changes{v0.11a}{2004/08/24}{Added \cs{m@th}} +% \begin{macrocode} + \m@th + \sbox\l_xfrac_temp_box {\xfrac_math: {\vphantom{(}}} + \sbox\l_xfrac_slash_box { + \xfrac_math: { + \xfrac_slashsymbolformat:n { + \xfrac_math: { + \xfrac_slashfontchange: + \IfValueTF{#2}{#2}{\xfrac_slashsymbol: } + } + } + } + } + \dim_compare:nNnTF \l_xfrac_numeratortopsep_fdim = \c_max_dim + { + \dim_compare:nNnTF \l_xfrac_numeratorbotsep_fdim = \c_max_dim + { +% \end{macrocode} +% Both unspecified. +% \begin{macrocode} + \def:Npn\xfrac_next: {\raisebox{\box_ht:N\l_xfrac_slash_box + -\box_dp:N\l_xfrac_slash_box-\height}} + }{ +% \end{macrocode} +% Use only bottom specification. +% \begin{macrocode} + \def:Npn\xfrac_next: {\raisebox{\l_xfrac_numeratorbotsep_fdim }} + } + } + { +% \end{macrocode} +% Use only top specification. +% \begin{macrocode} + \dim_compare:nNnTF \l_xfrac_numeratorbotsep_fdim = \c_max_dim + { + \def:Npn\xfrac_next: { + \raisebox{ + \box_ht:N\l_xfrac_slash_box - \l_xfrac_numeratortopsep_fdim + - \height + } + } + } + { +% \end{macrocode} +% Over-specification. +% \begin{macrocode} + \PackageError{xfrac} + {You~ have~ specified~ both~ numerator-top-sep~ and~ + numerator-bot-sep} + {I~ will~ pretend~ you~ didn't~ specify~ any~ of ~them} + \def:Npn\xfrac_next: {\raisebox{\box_ht:N\l_xfrac_slash_box + -\box_dp:N\l_xfrac_slash_box-\height}} + } + } +% \end{macrocode} +% Typeset the numerator +% \begin{macrocode} + \xfrac_next: { + \xfrac_fontscale: + \xfrac_numeratorformat:n { + \scalebox{\xfrac_hscale: }[\xfrac_vscale: ] + { \xfrac_math:{ \xfrac_numeratorfontchange: + {\vphantom{\xfrac_phantom: }#1} } } + } + } + \xfrac_math: { % THIS IS JUST WRONG! + \mode_if_math:TF { \mskip \l_xfrac_slashrightmsep_fmu } + {\hskip \l_xfrac_slashrightsep_fdim} + } +% \end{macrocode} +% Typeset the separator +% \begin{macrocode} + \usebox\l_xfrac_slash_box + \xfrac_math: { + \mode_if_math:TF { + \mskip \l_xfrac_slashleftmsep_fmu + }{ + \hskip \l_xfrac_slashleftsep_fdim + } } +% \end{macrocode} +% Typeset the denominator +% \begin{macrocode} + \dim_compare:nNnTF \l_xfrac_denominatorbotsep_fdim=\c_max_dim + { \raisebox{-\box_dp:N \l_xfrac_slash_box} } + { + \raisebox{\l_xfrac_denominatorbotsep_fdim} + } + { + \xfrac_fontscale: + \xfrac_denominatorformat:n { + \scalebox{\xfrac_hscale:}[\xfrac_vscale:] + { \xfrac_math: { \xfrac_denominatorfontchange: + {\vphantom{\xfrac_phantom: }#3} } } + } + } + } +} +% \end{macrocode} +% +% Since math and text mode are wildly different entities we define a +% separate template for each. You already saw the `text' template, +% and here is the `math' template. +% \begin{macrocode} +\DeclareRestrictedTemplate{xfrac}{math}{text}{ + numerator-font = \number\fam, + slash-symbol = /, + slash-symbol-font = \number\fam, + denominator-font = \number\fam, + scale-factor = 0.7, + scale-relative = false, + scaling = true, + numerator-top-sep = 0pt, + denominator-bot-sep = 0pt, + math-mode = true, + phantom = (, +} +% \end{macrocode} +% +% \subsection{The Default Instances} +% +% For the default instances we just use the relevant templates with +% the default settings. +% +% The default `text' instance. +% \begin{macrocode} +\DeclareInstance{xfrac}{default}{text}{ } +% \end{macrocode} +% The default `math' instance. +% \begin{macrocode} +\DeclareInstance{xfrac}{mathdefault}{math}{ } +% \end{macrocode} +% \begin{macrocode} +\DeclareCollectionInstance{plainmath}{xfrac}{mathdefault}{math}{ + denominator-bot-sep=0pt, + numerator-bot-sep=0pt, + numerator-top-sep=\c_max_dim, + scale-factor = 1, + scale-relative = false, + scaling = true, + slash-right-mkern=0mu, + slash-left-mkern=0mu, +} +% \end{macrocode} +% Default Computer Modern setup. Far from optimal, but better than +% nothing. +% \begin{macrocode} +\DeclareInstance{xfrac}{cmr}{text}{ + denominator-bot-sep=0pt, + numerator-top-sep=\DelayEvaluation{.2ex}, + slash-left-kern=\DelayEvaluation{-.1em}, + slash-right-kern=\DelayEvaluation{-.1em}, +} +\DeclareInstance{xfrac}{cmss}{text}{ + denominator-bot-sep=0pt, + numerator-top-sep=\DelayEvaluation{.2ex}, + slash-left-kern=\DelayEvaluation{-.1em}, + slash-right-kern=\DelayEvaluation{-.1em}, +} +\DeclareInstance{xfrac}{cmtt}{text}{ + denominator-bot-sep=0pt, + numerator-top-sep=\DelayEvaluation{.2ex}, + slash-left-kern=\DelayEvaluation{-.1em}, + slash-right-kern=\DelayEvaluation{-.1em}, +} +% \end{macrocode} +% We can do better for the Computer Modern fonts. For the roman +% family we choose Times. +% \begin{macrocode} +\DeclareCollectionInstance{cm-recommended}{xfrac}{cmr}{text}{ + slash-symbol-font = ptm, +} +% \end{macrocode} +% Times also blends well with `cmss'. +% \begin{macrocode} +\DeclareCollectionInstance{cm-recommended}{xfrac}{cmss}{text}{ + slash-symbol-font = ptm, +} +% \end{macrocode} +% For `cmtt' we choose the Palatino solidus as it is slightly +% thicker than Times. +% \begin{macrocode} +\DeclareCollectionInstance{cm-recommended}{xfrac}{cmtt}{text}{ + slash-symbol-font = ppl, +} +% \end{macrocode} +% If we used the \texttt{cm-recommended} setup we activate it. +% \begin{macrocode} +\bool_if:NT \g_cm_recommended_bool + {\UseCollection{xfrac}{cm-recommended}} +% \end{macrocode} +% +% \subsection{The User Command} +% +% Currently there is just a single user command. \cs{sfrac} takes +% two mandatory arguments: numerator and denominator. It can take an +% optional argument between the mandatory specifying the separator +% like this: +% \begin{verbatim} +% \sfrac{7}[/]{12} +% \end{verbatim} +% It also has an optional argument that comes before the first +% mandatory argument. If used it will use that instance instead of +% the auto-detected one, so a user who has defined the instance +% `cmr2' may use +% \begin{verbatim} +% \sfrac[cmr2]{7}{12} +% \end{verbatim} +% and get the settings from `cmr2' instead of the settings of the +% current font family. +% \begin{macrocode} +\DeclareDocumentCommand \sfrac {o mom}{ + \mode_if_math:TF +{ + \def:Npx \xfrac_next: {mathfam\number\fam} + \IfExistsInstanceTF{xfrac}{\xfrac_next: } + {\UseInstance{xfrac}{\xfrac_next: }} + {\UseInstance{xfrac}{mathdefault}} + {#2}{#3}{#4} +} +{ + \IfExistsInstanceTF{xfrac}{#1} + {\UseInstance{xfrac}{#1}{#2}{#3}{#4}} + {\IfExistsInstanceTF{xfrac}{\f@family} + {\UseInstance{xfrac}{\f@family}} + {\UseInstance{xfrac}{default}} + {#2}{#3}{#4} + } + } +} +% \end{macrocode} +% +% \Finale +\endinput |