Changes

Jump to navigation Jump to search
1,843 bytes removed ,  18:54, 3 June 2020
m
remove link to former font page
< [[Math]] | [[Bold Typewriter]] | [[Fonts]] >
see Hans has descibed how to work with bold math in [http://www.pragma-ade.com/general/magazines/mag-0005.pdf MyWay No.5 about "Mixed Normal and Bold Math"] by Pragma. However, this method only seems to work with lucida fonts. For other fonts (currently only for latin modern and euler), one can also define
== Wrapping in a \hbox ==
 
If the solution presented in that MyWay does not suit your needs, you can always use a \hbox wrapper, by defining something like this:
<texcode>
\definetypeface [boldmath] [mm] [boldmath] [latin-modern] [default]
\setupformulae[method=bold]
\unprotect
\def\boldsymbol@normal#1{\hbox{\formula[boldmath]{#1}}}
\def\boldsymbol@inline{\boldsymbol@normal}
\def\boldsymbol@script#1{\hbox{\formula[boldmath,script]{#1}}}
\def\boldsymbol@scriptscript#1{\hbox{\formula[boldmath,scriptscript]{#1}}}
\def\boldsymbol#1{%
\mathchoice
{\boldsymbol@normal{#1}}%
{\boldsymbol@normal{#1}}%
{\boldsymbol@script{#1}}%
{\boldsymbol@scriptscript{#1}}}
\protect
</texcode>
 
Then you can get bold vectors:
<texcode>
\define\grad{\boldsymbol{\nabla}}
%\define\vec{\boldsymbol} % Raise a warning because \vec
\def\vec{\boldsymbol} % is already defined in ConTeXt.
\define[1]\unitvec{{\hat{\vec{#1}}}}
</texcode>
 
and formulas like this typeset perfectly:
 
<texcode>
\formula{\grad \eta = e^{\vec k \cdot \vec x} \unitvec{n}}
</texcode>
== An Alternate Definition ==An alternate way to define and then use <cmdcode>boldsymbol</cmd> is  <context source="yes">\definetypeface [boldmath] [mm] [boldmath] [latin-modern] [modern] [encoding=texnansi] \unprotect\def\boldsymbol#1% {\preparebinrel{#1}% \currentbinrel {\mathchoice {\hbox{\switchtoformulabodyfont [boldmath]$\m@th#1$}} {\hbox{\switchtoformulabodyfont [boldmath]$\m@th#1$}} {\hbox{\switchtoformulabodyfont [boldmath,script]$\m@th#1$}} {\hbox{\switchtoformulabodyfont[boldmath,scriptscript]$\m@th#1$}}}}\protect % The previous example again\def\grad{\boldsymbol{\mathop{\nabla}}}% The correct way to define this is % \def\grad{\mathop{\boldsymbol{\nabla}}}% The former is used just to show that \boldsymbol gives the correct% spacing for mathop\def\vec{\boldsymbol}\def\unitvec#1{{\hat{\vec{#1}}}} $\grad \eta = e^{\vec k \cdot \vec x} \unitvec{n}$</context> The <cmd>preparebinrel</cmdcode> and <cmd>currentbinrel</cmd> ensure that the correct spacing is used around the symbolthat you want in bold. This is slightly more efficient than the first version. 
== Mixing Math Fonts ==

Navigation menu