summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/maybemath
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2006-11-09 13:18:02 +0000
committerNorbert Preining <preining@logic.at>2006-11-09 13:18:02 +0000
commit3696c8f2a98b5e48514a3608e0156c676b63470a (patch)
tree99006293861d5004c6de0938b605f6ef0e4b554a /Master/texmf-dist/tex/latex/maybemath
parentaa10b19a7c6ffac34c3b21c9ac9afb7dc827cec4 (diff)
The Krakow-Vienna train ride update
package updates: ccaption cdpbundl chem-journal clefval coordsys dingbat dramatist egplot filecontents lcd maybemath metaobj metaplot mwcls pdfscreen pst-bar rsc dpfloat footbib jurabib added to ctan-tpm-check (and re-indented the long list) no changes between CTAN and depot, only added to the WorkingTPM list acmtrans bibunits bitfield blindtext bophook cherokee citeref cmdtrack colorinfo compactbib courier-scaled courseoutline coursepaper crop custom-bib cvsty dancers dashbox dcpic decimal digiconfigs dinat directory eCards eemeir ellipsis engrec envbig epiolmec epsf eqparbox eskd ethiop-t1 euro eurosans exam examplep expressg extarrows extsizes fp fribrief functan gatech-thesis ginpenc greenpoint hands hitec hvfloat hyperxmp inlinebib invoice isorot isotope jpsj kalender kerkis keystroke labels layouts lcg leaflet leawood lgreek limap lipsum listliketab logpap ltablex ltxindex mailing makebox makecirc makeglos maple mceinleger menu metatex mftinc mhs multicap mwrite nath nature ntgclass numline ofs ogham oldstyle papercdcase paresse parrun permute phaistos pittetd plates preprint prettyref program pseudocode pspicture pst-fr3d pst-math qcm rccol rcsinfo resume robustindex sae sauerj updates with changed files, but no added/removed files: ccaption cdpbundl chem-journal clefval coordsys dingbat dramatist egplot filecontents lcd maybemath metaobj metaplot mwcls pdfscreen pst-bar rsc updates with changes and added/removed files: dpfloat footbib jurabib git-svn-id: svn://tug.org/texlive/trunk@2411 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/maybemath')
-rw-r--r--Master/texmf-dist/tex/latex/maybemath/maybemath.sty85
1 files changed, 63 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/maybemath/maybemath.sty b/Master/texmf-dist/tex/latex/maybemath/maybemath.sty
index 0b88a0c127f..0cbe49e8550 100644
--- a/Master/texmf-dist/tex/latex/maybemath/maybemath.sty
+++ b/Master/texmf-dist/tex/latex/maybemath/maybemath.sty
@@ -1,9 +1,11 @@
-\ProvidesPackage{maybemath}[2004/11/29]
+\ProvidesPackage{maybemath}[2005/2/22]
+\RequirePackage{amsmath}
\RequirePackage{bm}
+%\RequirePackage{xspace}
-%% 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
+%% A few commands for making math fonts bold, upright, italic
+%% or sans-serif 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.
%%
@@ -17,35 +19,74 @@
%% Author: Andy Buckley <andy@insectnation.org>
+%% Mode names for bold, ext-bold, italic and sans-serif contexts
+\def\@boldname{b}%
+\def\@boldexname{bx}%
+\def\@italname{it}%
+\def\@sfname{cmss}%
+
+
%% 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}%
+\DeclareRobustCommand{\maybebm}[1]{\ensuremath{%
+ \ifx\f@series\@boldname%
+ {{\bm{#1}}}%
+ \else\ifx\f@series\@boldexname%
+ {{\bm{#1}}}%
\else%
- #1%
+ {{#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%
+\DeclareRobustCommand{\mayberm}[1]{\ensuremath{%
+ \ifx\f@shape\@italname%
{#1}%
\else%
{\mathrm{#1}}%
\fi%
-}
+}}
+
+%% Use \mathit if in italic context
+\DeclareRobustCommand{\maybeit}[1]{\ensuremath{%
+ \ifx\f@shape\@italname%
+ {\mathit{#1}}%
+ \else%
+ {#1}%
+ \fi%
+}}
+
+%% Use \mathrm if not in italic context
+%% and \mathit if in italic context
+\DeclareRobustCommand{\maybeitrm}[1]{\ensuremath{%
+ \ifx\f@shape\@italname%
+ {\mathit{#1}}%
+ \else%
+ {\mathrm{#1}}%
+ \fi%
+}}
%% Maybe-italic subscript shifting
-\DeclareRobustCommand{\maybeitsubscript}[1]{%
- \ifx\f@shape\italname%
- {\!\!#1}%
+\DeclareRobustCommand{\maybeitsubscript}[1]{\ensuremath{%
+ \ifx\f@shape\@italname%
+ {\!\mspace{1mu}#1}%
+ \else%
+ {#1}%
+ \fi%
+}}
+
+%% Maybe-sans font change
+\DeclareRobustCommand{\maybesf}[1]{\ensuremath{%
+ \ifx\f@family\@sfname%
+ {\mathsf{#1}}%
\else%
{#1}%
\fi%
-} \ No newline at end of file
+}}
+
+%% Convenience command for following bold and sans-serif contexts
+\DeclareRobustCommand{\maybebmsf}[1]{%
+ {\maybebm{\maybesf{#1}}}%
+}
+
+%% For reference purposes :-)
+%\DeclareRobustCommand{\maybemath}{\texttt{maybemath}\xspace}