From c32ca6ab2242447b7af4575fefd2be00054436fd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 Jan 2006 23:58:49 +0000 Subject: maybemath git-svn-id: svn://tug.org/texlive/trunk@1076 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/maybemath/maybemath.sty | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/maybemath/maybemath.sty (limited to 'Master/texmf-dist/tex/latex/maybemath') 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 + + +%% 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 -- cgit v1.2.3