summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mh/mathtools.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/mh/mathtools.sty')
-rw-r--r--Master/texmf-dist/tex/latex/mh/mathtools.sty120
1 files changed, 105 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/mh/mathtools.sty b/Master/texmf-dist/tex/latex/mh/mathtools.sty
index 22afd81b053..79781cdb487 100644
--- a/Master/texmf-dist/tex/latex/mh/mathtools.sty
+++ b/Master/texmf-dist/tex/latex/mh/mathtools.sty
@@ -9,6 +9,8 @@
%% This is a generated file.
%%
%% Copyright (C) 2002-2011 by Morten Hoegholm
+%% Copyright (C) 2012 by Lars Madsen
+%%
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -28,10 +30,59 @@
%% mathtools.sty, mathtools.pdf, mathtools.ins, mathtools.drv.
%%
\ProvidesPackage{mathtools}%
- [2012/04/24 v1.12 mathematical typesetting tools]
+ [2013/02/12 v1.13 mathematical typesetting tools]
\RequirePackage{keyval,calc}
\RequirePackage{mhsetup}[2010/01/21]
\MHInternalSyntaxOn
+ % borrowed from fixltx2e
+\def\EQ_MakeRobust#1{%
+ \@ifundefined{\expandafter\@gobble\string#1}{%
+ \@latex@error{The control sequence `\string#1' is undefined!%
+ \MessageBreak There is nothing here to make robust}%
+ \@eha
+ }%
+ {%
+ \@ifundefined{\expandafter\@gobble\string#1\space}%
+ {%
+ \expandafter\let\csname
+ \expandafter\@gobble\string#1\space\endcsname=#1%
+ \edef\reserved@a{\string#1}%
+ \def\reserved@b{#1}%
+ \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
+ \edef#1{%
+ \ifx\reserved@a\reserved@b
+ \noexpand\x@protect\noexpand#1%
+ \fi
+ \noexpand\protect\expandafter\noexpand
+ \csname\expandafter\@gobble\string#1\space\endcsname}%
+ }%
+ {\@latex@info{The control sequence `\string#1' is already robust}}%
+ }%
+}
+\def\forced_EQ_MakeRobust#1{%
+ \@ifundefined{\expandafter\@gobble\string#1}{%
+ \@latex@error{The control sequence `\string#1' is undefined!%
+ \MessageBreak There is nothing here to make robust}%
+ \@eha
+ }%
+ {%
+ % \@ifundefined{\expandafter\@gobble\string#1\space}%
+ % {%
+ \expandafter\let\csname
+ \expandafter\@gobble\string#1\space\endcsname=#1%
+ \edef\reserved@a{\string#1}%
+ \def\reserved@b{#1}%
+ \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
+ \edef#1{%
+ \ifx\reserved@a\reserved@b
+ \noexpand\x@protect\noexpand#1%
+ \fi
+ \noexpand\protect\expandafter\noexpand
+ \csname\expandafter\@gobble\string#1\space\endcsname}%
+ % }%
+ % {\@latex@info{The control sequence `\string#1' is already robust}}%
+ }%
+}
\def\MT_options_name:{mathtools}
\newcommand*\mathtoolsset[1]{\setkeys{\MT_options_name:}{#1}}
\MH_new_boolean:n {fixamsmath}
@@ -51,6 +102,11 @@
\MHPrecedingSpacesOff
\MH_let:NwN \MH_maybe_nospace_ifnextchar:Nnn \MH_nospace_ifnextchar:Nnn
}
+\MH_new_boolean:n {robustify}
+\MH_set_boolean_T:n {robustify}
+\DeclareOption{nonrobust}{
+ \MH_set_boolean_F:n {robustify}
+}
\DeclareOption*{
\PassOptionsToPackage{\CurrentOption}{amsmath}
}
@@ -65,6 +121,12 @@
{You~ have~ to~ select~ either~ `true'~ or~ `false'}
{I'll~ assume~ you~ chose~ `false'~ for~ now.}
}
+\MH_if_boolean:nT {robustify}{
+ \EQ_MakeRobust\(
+ \EQ_MakeRobust\)
+ \EQ_MakeRobust\[
+ \EQ_MakeRobust\]
+}
\def\MT_define_tagform:nwnn #1[#2]#3#4{
\@namedef{MT_tagform_#1:n}##1
{\maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4}}
@@ -1075,12 +1137,20 @@
\providecommand\bigtimes{\MH_csym_bigtimes:}
}
\MH_let:NwN \MT_orig_intertext: \intertext@
-\newdimen\l_MT_above_intertext_dim
-\newdimen\l_MT_below_intertext_dim
+\newdimen\l_MT_above_intertext_sep
+\newdimen\l_MT_below_intertext_sep
+\define@key{\MT_options_name:}
+ {aboveintertextdim}{\setlength\l_MT_above_intertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {belowintertextdim}{\setlength\l_MT_below_intertext_sep{#1}}
\define@key{\MT_options_name:}
- {aboveintertextdim}{\setlength\l_MT_above_interetext_dim{#1}}
+ {above-intertext-dim}{\setlength\l_MT_above_intertext_sep{#1}}
\define@key{\MT_options_name:}
- {belowintertextdim}{\setlength\l_MT_below_intertext_dim{#1}}
+ {below-intertext-dim}{\setlength\l_MT_below_intertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {above-intertext-sep}{\setlength\l_MT_above_intertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {below-intertext-sep}{\setlength\l_MT_below_intertext_sep{#1}}
\def\MT_intertext: {%
\def\intertext##1{%
\ifvmode\else\\\@empty\fi
@@ -1088,7 +1158,7 @@
\penalty\postdisplaypenalty\vskip\belowdisplayskip
\vskip-\lineskiplimit % CCS
\vskip\normallineskiplimit % CCS
- \vskip\l_MT_above_intertext_dim
+ \vskip\l_MT_above_intertext_sep
\vbox{\normalbaselines
\ifdim\linewidth=\columnwidth
\else \parshape\@ne \@totalleftmargin \linewidth
@@ -1097,7 +1167,7 @@
\penalty\predisplaypenalty\vskip\abovedisplayskip%
\vskip-\lineskiplimit % CCS
\vskip\normallineskiplimit % CCS
- \vskip\l_MT_above_intertext_dim
+ \vskip\l_MT_above_intertext_sep
}%
}}
\def\MT_orig_intertext_true: { \MH_let:NwN \intertext@ \MT_orig_intertext: }
@@ -1121,12 +1191,20 @@
\penalty\predisplaypenalty\vskip\abovedisplayshortskip%
}%
}
-\newdimen\l_MT_above_shortintertext_dim
-\newdimen\l_MT_below_shortintertext_dim
+\newdimen\l_MT_above_shortintertext_sep
+\newdimen\l_MT_below_shortintertext_sep
+\define@key{\MT_options_name:}
+ {aboveshortintertextdim}{\setlength \l_MT_above_shortintertext_sep{#1}}
\define@key{\MT_options_name:}
- {aboveshortintertextdim}{\setlength \l_MT_above_shortintertext_dim{#1}}
+ {belowshortintertextdim}{\setlength \l_MT_below_shortintertext_sep{#1}}
\define@key{\MT_options_name:}
- {belowshortintertextdim}{\setlength \l_MT_below_shortintertext_dim{#1}}
+ {above-short-intertext-dim}{\setlength \l_MT_above_shortintertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {below-short-intertext-dim}{\setlength \l_MT_below_shortintertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {above-short-intertext-sep}{\setlength \l_MT_above_shortintertext_sep{#1}}
+\define@key{\MT_options_name:}
+ {below-short-intertext-sep}{\setlength \l_MT_below_shortintertext_sep{#1}}
\setkeys{\MT_options_name:}{
aboveshortintertextdim=3pt,
belowshortintertextdim=3pt
@@ -1137,7 +1215,7 @@
\penalty\postdisplaypenalty\vskip\abovedisplayshortskip
\vskip-\lineskiplimit
\vskip\normallineskiplimit
- \vskip\l_MT_above_shortintertext_dim
+ \vskip\l_MT_above_shortintertext_sep
\vbox{\normalbaselines
\if_dim:w \linewidth=\columnwidth
\else:
@@ -1147,7 +1225,7 @@
\penalty\predisplaypenalty\vskip\abovedisplayshortskip%
\vskip-\lineskiplimit
\vskip\normallineskiplimit
- \vskip\l_MT_below_shortintertext_dim
+ \vskip\l_MT_below_shortintertext_sep
}%
}
\def\MT_orig_shortintertext_true: { \MH_let:NwN \shortintertext \MT_orig_shortintertext:n }
@@ -1307,8 +1385,15 @@
\def\MT_mathic_true: {
\MH_if_boolean:nF {math_italic_corr}{
\MH_set_boolean_T:n {math_italic_corr}
+ \MH_if_boolean:nTF {robustify}{
+ \MH_let:NwN \MT_mathic_redeffer: \DeclareRobustCommand
+ }{
+ \MH_let:NwN \MT_mathic_redeffer: \renewcommand
+ }
\MH_let:NwN \MT_begin_inlinemath: \(
- \renewcommand*\({\relax\ifmmode\@badmath\else
+ %\renewcommand*\({
+ \MT_mathic_redeffer:*\({
+ \relax\ifmmode\@badmath\else
\ifhmode
\if_dim:w \fontdimen\@ne\font>\z@
\if_dim:w \lastskip>\z@
@@ -1327,7 +1412,12 @@
\def\MT_mathic_false: {
\MH_if_boolean:nT {math_italic_corr}{
\MH_set_boolean_F:n {math_italic_corr}
- \MH_let:NwN \( \MT_begin_inlinemath:
+ \MH_if_boolean:nTF {robustify}{
+ \edef\({\MT_begin_inlinemath:}%
+ \forced_EQ_MakeRobust\(%
+ }{
+ \MH_let:NwN \( \MT_begin_inlinemath:
+ }
}
}
\MH_new_boolean:n {math_italic_corr}