\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% }