summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/tex/latex/maybemath/maybemath.sty51
1 files changed, 51 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/maybemath/maybemath.sty b/Master/texmf-dist/tex/latex/maybemath/maybemath.sty
new file mode 100644
index 00000000000..0b88a0c127f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/maybemath/maybemath.sty
@@ -0,0 +1,51 @@
+\ProvidesPackage{maybemath}[2004/11/29]
+\RequirePackage{bm}
+
+%% A few commands for making math fonts bold or italic
+%% according to the context of surrounding text. It is
+%% particularly useful for avoiding problems with math
+%% boldness in section titles causing unwanted boldness
+%% in e.g. the table of contents.
+%%
+%% Thanks to Viet-Trung Luu on comp.text.tex for providing
+%% the first steps to solving this problem.
+%%
+%% This material is subject to the LaTeX Project Public License.
+%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+%% for the details of that license.
+%%
+%% Author: Andy Buckley <andy@insectnation.org>
+
+
+%% Use the bold symbol if reqd for math fonts
+\DeclareRobustCommand{\maybebm}[1]{%
+ \def\boldname{b}%
+ \def\boldexname{bx}%
+ \ifx\f@series\boldname%
+ \boldsymbol{#1}%
+ \else\ifx\f@series\boldexname%
+ \boldsymbol{#1}%
+ \else%
+ #1%
+ \fi\fi%
+}
+
+%% Use \mathrm if not in italic context
+%% (``backward logic'' for a reason)
+\def\italname{it}%
+\DeclareRobustCommand{\maybeit}[1]{%
+ \ifx\f@shape\italname%
+ {#1}%
+ \else%
+ {\mathrm{#1}}%
+ \fi%
+}
+
+%% Maybe-italic subscript shifting
+\DeclareRobustCommand{\maybeitsubscript}[1]{%
+ \ifx\f@shape\italname%
+ {\!\!#1}%
+ \else%
+ {#1}%
+ \fi%
+} \ No newline at end of file