Add mweights for systems where it is missing
[ach-master.git] / src / texmf / tex / latex / mweights / mweights.sty
1 \ProvidesPackage{mweights}
2   [2013/07/21 (Bob Tennent)  Support package for multiple-weight font packages. ]
3
4 \AtBeginDocument{%
5   % Define any undefined \mdseries@rm etc. 
6   % Defined \mdseries@rm etc. assumed to be fully expanded!
7   \ifdefined\mdseries@rm\else\edef\mdseries@rm{\mddefault}\fi
8   \ifdefined\bfseries@rm\else\edef\bfseries@rm{\bfdefault}\fi
9   \ifdefined\mdseries@sf\else\edef\mdseries@sf{\mddefault}\fi
10   \ifdefined\bfseries@sf\else\edef\bfseries@sf{\bfdefault}\fi
11   \ifdefined\mdseries@tt\else\edef\mdseries@tt{\mddefault}\fi
12   \ifdefined\bfseries@tt\else\edef\bfseries@tt{\bfdefault}\fi
13
14   % In case any unexpanded macros present in \rmdefault, etc
15   \edef\rmdef@ult{\rmdefault}
16   \edef\sfdef@ult{\sfdefault}
17   \edef\ttdef@ult{\ttdefault}
18   \edef\bfdef@ult{\bfdefault}
19   \edef\mddef@ult{\mddefault}
20 }
21
22 \DeclareRobustCommand\bfseries{%
23 \not@math@alphabet\bfseries\mathbf
24 \ifx\f@family\rmdef@ult\fontseries\bfseries@rm
25 \else\ifx\f@family\sfdef@ult\fontseries\bfseries@sf
26 \else\ifx\f@family\ttdef@ult\fontseries\bfseries@tt
27 \else\fontseries\bfdefault\fi\fi\fi\selectfont}%
28
29 \DeclareRobustCommand\mdseries{%
30 \not@math@alphabet\mdseries\relax
31 \ifx\f@family\rmdef@ult\fontseries\mdseries@rm
32 \else\ifx\f@family\sfdef@ult\fontseries\mdseries@sf
33 \else\ifx\f@family\ttdef@ult\fontseries\mdseries@tt
34 \else\fontseries\mddefault\fi\fi\fi\selectfont}
35
36 \DeclareRobustCommand\rmfamily{%
37 \not@math@alphabet\rmfamily\mathrm
38 % change the current series before changing the family
39 \ifx\f@family\sfdef@ult
40     \ifx\f@series\mdseries@sf\fontseries\mdseries@rm
41     \else\ifx\f@series\bfseries@sf\fontseries\bfseries@rm
42     \else\ifx\f@series\mddef@ult\fontseries\mdseries@rm
43     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@rm
44     \fi\fi\fi\fi
45 \else\ifx\f@family\ttdef@ult
46     \ifx\f@series\mdseries@tt\fontseries\mdseries@rm
47     \else\ifx\f@series\bfseries@tt\fontseries\bfseries@rm
48     \else\ifx\f@series\mddef@ult\fontseries\mdseries@rm
49     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@rm
50     \fi\fi\fi\fi
51 \fi\fi\fontfamily\rmdefault\selectfont}
52
53 \DeclareRobustCommand\sffamily{%
54 \not@math@alphabet\sffamily\mathsf
55 % change the current series before changing the family
56 \ifx\f@family\rmdef@ult
57     \ifx\f@series\mdseries@rm\fontseries\mdseries@sf
58     \else\ifx\f@series\bfseries@rm\fontseries\bfseries@sf
59     \else\ifx\f@series\mddef@ult\fontseries\mdseries@sf
60     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@sf
61     \fi\fi\fi\fi
62 \else\ifx\f@family\ttdef@ult
63     \ifx\f@series\mdseries@tt\fontseries\mdseries@sf
64     \else\ifx\f@series\bfseries@tt\fontseries\bfseries@sf
65     \else\ifx\f@series\mddef@ult\fontseries\mdseries@sf
66     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@sf
67     \fi\fi\fi\fi
68 \fi\fi\fontfamily\sfdefault\selectfont}
69
70 \DeclareRobustCommand\ttfamily{%
71 \not@math@alphabet\ttfamily\mathtt
72 % change the current series before changing the family
73 \ifx\f@family\rmdef@ult
74     \ifx\f@series\mdseries@rm\fontseries\mdseries@tt
75     \else\ifx\f@series\bfseries@rm\fontseries\bfseries@tt
76     \else\ifx\f@series\mddef@ult\fontseries\mdseries@tt
77     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@tt
78     \fi\fi\fi\fi
79 \else\ifx\f@family\sfdef@ult
80     \ifx\f@series\mdseries@sf\fontseries\mdseries@tt
81     \else\ifx\f@series\bfseries@sf\fontseries\bfseries@tt
82     \else\ifx\f@series\mddef@ult\fontseries\mdseries@tt
83     \else\ifx\f@series\bfdef@ult\fontseries\bfseries@tt
84     \fi\fi\fi\fi
85 \fi\fi\fontfamily\ttdefault\selectfont}
86
87 \endinput