Hello, What exactly is the ConTeXt alternative to LaTeX's \mathbf (switch to bold or bold italic math fonts)? (Btw: is it better to use bold or bold italic for typesetting vectors? We use "overrightharpoonup", so I don't know what an international standard says.) I understand the main commands for switching the font in text (rm, tt, ss for family and tf, sl, it, bf, bs, bi, sc + an optional x/xx/a/b/c/d), but I didn't understand yet what to use for math. ~~~ As an intermezzo: is there any way to ger small caps slanted? \sc will do the small caps, but \sl switches to normal slanted font (no small caps) again. I suppose that the current model (set of current font definitions) doesn't account for the possibility of using small caps slanted or small caps bold (slanted). Is there any elegant way to do that, for example by defining new commands such as \scbf, \scit, \scbi [+ xx/x/a/b/c/d]? (I can still use other tricks to get those fonts, but some general scheme for using them could be useful for others as well.) ~~~ I tried to use the examples described in mfonts.pdf, but I can't get those examples working. (I probably used too few definitions when more definitions are required at once to make the examples work.) I also tried the command from one of Adam's articles, \def\mfunction#1{{\em#1}}, to get italic euler math font, but without success. I managed to use "bold math" as a whole (on the example of iwona which has different weights of math fonts): \starttypescript [math] [iwonaheavy] [default] \definefontsynonym [IwonaMathLettersHeavy] [rmiwonah] \definefontsynonym [IwonaMathLettersHeavyItalic] [miiwonahi] \definefontsynonym [IwonaMathSymbolsHeavy] [syiwonahz] \definefontsynonym [IwonaMathExtensionHeavy] [exiwonah] \stoptypescript \starttypescript [math] [iwonaheavy] [name] \definefontsynonym [MathRoman] [IwonaMathLettersHeavy] \definefontsynonym [MathItalic] [IwonaMathLettersHeavyItalic] \definefontsynonym [MathSymbol] [IwonaMathSymbolsHeavy] \definefontsynonym [MathExtension] [IwonaMathExtensionHeavy] \stoptypescript \definetypeface [iwona] [mm] [math] [iwonaheavy] [default] But I can't get ant further than that, so that I could switch between "thin" and "bold". I tried \starttypescript [boldmath] [iwonaheavy] [name] \definefontsynonym [MathRomanBold] [IwonaMathLettersHeavy] ... \starttypescript %[boldmath] [iwonaheavy] [default] \definebodyfont [boldmath] [mm] [(bf)mr=MathRomanBold mo 1, ...] ... and different settings in starttypescript/definebody font ... but no success at all. I would like to create some definitions, so that I could easily say (write a command) "I want the light version for regular math and the regular font for bold math" or "I want the regular version for regular and the heavy version for bold math". Thanks a lot for help, Mojca
What exactly is the ConTeXt alternative to LaTeX's \mathbf (switch to bold or bold italic math fonts)?
I can't help you here, but did you read http://wiki.contextgarden.net/ Bold_Math ? Grüßlis vom Hraban!  http://www.fiee.net/texnique/ http://contextgarden.net http://www.cacert.org (I'm an assurer)
Henning Hraban Ramm wrote:
What exactly is the ConTeXt alternative to LaTeX's \mathbf (switch to bold or bold italic math fonts)?
I can't help you here, but did you read http://wiki.contextgarden.net/ Bold_Math ?
I tried a couple of tricks, but none of them resulted in bold italic iwona. If I use the default font (cm), \bfm does nothing, \bf and \bi work. I'm also able to get the complete formula typeset in bold iwona, but I don't know how to get something like ${\bf\nabla}\phi={\bi E}$, where \phi would be typeset in iwonalight and the rest in iwonaheavy for example. The best I can get are bold (italic) cm fonts at that place. Some examples in the manual simply switch the "fontface" within the formula, but I'm a bit lost in many instructions. Seems like I forgot some definitions, but I don't know which ones since some examples in the manuals work because there are some other definitions already present in the core. (I will play a bit more, perhaps I'll find a solution somehow.) Thanks, Mojca
Mojca Miklavec wrote:
Henning Hraban Ramm wrote:
What exactly is the ConTeXt alternative to LaTeX's \mathbf (switch to bold or bold italic math fonts)?
I can't help you here, but did you read http://wiki.contextgarden.net/ Bold_Math ?
I tried a couple of tricks, but none of them resulted in bold italic iwona. If I use the default font (cm), \bfm does nothing, \bf and \bi work.
I'm also able to get the complete formula typeset in bold iwona, but I don't know how to get something like ${\bf\nabla}\phi={\bi E}$, where \phi would be typeset in iwonalight and the rest in iwonaheavy for example.
taco is the math expert ... one problem with math is that there are several passes in tex and that the fonts that are set last may influence previous switches (just one set of families, global within a math environments) maybe a way out is something \hbox{\yourboldiwona$...$} another way would be to especially define bf and bi to map onto the iwona instances that you want (for a real mixed functionality we need to patch tex the program) [ok, i can imagine some kind of dynamic family pool, but for that i need some real time and motivation) Hans
Hans Hagen wrote:
taco is the math expert ...
At the moment, I don't understand this math vs. typescript stuff any better than the next person, I'm afraid. There are a number of (perhaps conflicting?) ways of getting 'bold math' in your text, and I have not the faintest clue which one is 'right'. In the special case of iwona, it should be as simple as \hbox{\switchtobodyfont[iwonamedium]$...$} or even \hbox{\switchtobodyfont[iwonaheavy]$...$} but that needs a extensions to the typescripts. See attachment for example and that extra typescript code. Cheers, Taco
Taco, thanks for the answer. I managed to change the whole math family into bold, but I can't get the following example working: \switchtobodyfont[iwonalight,ss] $$normal {\bf bold}{\bfm bold}{\bfmath bold}$$ \bf and \bfmath result in cm fonts, \bfm has no influence, no matter what I tried to do. I greped for bfmath and boldmath and tried to replace them, but no success at all. See the attached file for my attempts. Thanks, Mojca
Mojca Miklavec wrote:
..... I greped for bfmath and boldmath and tried to replace them, but no success at all. See the attached file for my attempts.
Yeah, that's what got me confused as well. I'll try to sort all this bold/not bold/fake bold/wrong bold math out (unless someone else volunteers :)) and report back in a few days. Taco
Mojca Miklavec wrote:
Taco, thanks for the answer. I managed to change the whole math family into bold, but I can't get the following example working:
\switchtobodyfont[iwonalight,ss] $$normal {\bf bold}{\bfm bold}{\bfmath bold}$$
\bf and \bfmath result in cm fonts, \bfm has no influence, no matter what I tried to do. I greped for bfmath and boldmath and tried to replace them, but no success at all. See the attached file for my attempts.
Okay, thanks to some offlist prodding, I took a look. Mojca, you weren't too far off. Simply following the recipe for lucida got me most of the way there, but the normal letters didn't get inflected (bolded). When I explicitly defined the alphabet, then the rest of the problems I saw got solved. Try this out with a lot more test cases, and report back. If it's okay, then it should be easy to formalise it into a robust, more complete set of typescripts... \startmathcollection[default] %eventual patch for mathtex? \definemathcharacter [a] [nothing] [mi] ["61] \definemathcharacter [b] [nothing] [mi] ["62] \definemathcharacter [c] [nothing] [mi] ["63] \definemathcharacter [d] [nothing] [mi] ["64] \definemathcharacter [e] [nothing] [mi] ["65] \definemathcharacter [f] [nothing] [mi] ["66] \definemathcharacter [g] [nothing] [mi] ["67] \definemathcharacter [h] [nothing] [mi] ["68] \definemathcharacter [i] [nothing] [mi] ["69] \definemathcharacter [j] [nothing] [mi] ["6A] \definemathcharacter [k] [nothing] [mi] ["6B] \definemathcharacter [l] [nothing] [mi] ["6C] \definemathcharacter [m] [nothing] [mi] ["6D] \definemathcharacter [n] [nothing] [mi] ["6E] \definemathcharacter [o] [nothing] [mi] ["6F] \definemathcharacter [p] [nothing] [mi] ["70] \definemathcharacter [q] [nothing] [mi] ["71] \definemathcharacter [r] [nothing] [mi] ["72] \definemathcharacter [s] [nothing] [mi] ["73] \definemathcharacter [t] [nothing] [mi] ["74] \definemathcharacter [u] [nothing] [mi] ["75] \definemathcharacter [v] [nothing] [mi] ["76] \definemathcharacter [w] [nothing] [mi] ["77] \definemathcharacter [x] [nothing] [mi] ["78] \definemathcharacter [y] [nothing] [mi] ["79] \definemathcharacter [z] [nothing] [mi] ["7A] \definemathcharacter [A] [nothing] [mi] ["41] \definemathcharacter [B] [nothing] [mi] ["42] \definemathcharacter [C] [nothing] [mi] ["43] \definemathcharacter [D] [nothing] [mi] ["44] \definemathcharacter [E] [nothing] [mi] ["45] \definemathcharacter [F] [nothing] [mi] ["46] \definemathcharacter [G] [nothing] [mi] ["47] \definemathcharacter [H] [nothing] [mi] ["48] \definemathcharacter [I] [nothing] [mi] ["49] \definemathcharacter [J] [nothing] [mi] ["4A] \definemathcharacter [K] [nothing] [mi] ["4B] \definemathcharacter [L] [nothing] [mi] ["4C] \definemathcharacter [M] [nothing] [mi] ["4D] \definemathcharacter [N] [nothing] [mi] ["4E] \definemathcharacter [O] [nothing] [mi] ["4F] \definemathcharacter [P] [nothing] [mi] ["50] \definemathcharacter [Q] [nothing] [mi] ["51] \definemathcharacter [R] [nothing] [mi] ["52] \definemathcharacter [S] [nothing] [mi] ["53] \definemathcharacter [T] [nothing] [mi] ["54] \definemathcharacter [U] [nothing] [mi] ["55] \definemathcharacter [V] [nothing] [mi] ["56] \definemathcharacter [W] [nothing] [mi] ["57] \definemathcharacter [X] [nothing] [mi] ["58] \definemathcharacter [Y] [nothing] [mi] ["59] \definemathcharacter [Z] [nothing] [mi] ["5A] \stopmathcollection \starttypescript [bfmath,boldmath] [iwona] [ec,texnansi] % we want this in iwona namespace \definefontsynonym [IwonaMathLettersHeavy] [rmiwonah] \definefontsynonym [IwonaMathLettersHeavyItalic] [miiwonahi] \definefontsynonym [IwonaMathSymbolsHeavy] [syiwonahz] \definefontsynonym [IwonaMathExtensionHeavy] [exiwonah] \stoptypescript \starttypescript [boldmath] [iwona] [name] % we don't use this yet \definefontsynonym [MathRoman] [IwonaMathLettersHeavy] \definefontsynonym [MathItalic] [IwonaMathLettersHeavyItalic] \definefontsynonym [MathSymbol] [IwonaMathSymbolsHeavy] \definefontsynonym [MathExtension] [IwonaMathExtensionHeavy] \stoptypescript \starttypescript [bfmath] [iwona] [name] % key typescript, with MathRomanBold et al \definefontsynonym [MathRomanBold] [IwonaMathLettersHeavy] \definefontsynonym [MathItalicBold] [IwonaMathLettersHeavyItalic] \definefontsynonym [MathSymbolBold] [IwonaMathSymbolsHeavy] \definefontsynonym [MathExtensionBold] [IwonaMathExtensionHeavy] \stoptypescript \setupformulas [method=bold] % magical incantation \usetypescript [iwona] [texnansi] % defined in typeexa \definetypeface [iwona] [mm] [bfmath] [iwona] [default] % add to the loaded typeface \setupbodyfont[iwona] % and go \starttext \startformula n({\bfm a} + {\bfm b}) = {\bfm \Gamma} \stopformula \startformula 1 \theta \Gamma = {\bfm 1 \beta \Gamma \alpha ' xP} x \stopformula \startformula 1 \theta \Gamma = {1 \beta \Gamma \alpha ' x} x \stopformula \stoptext [apologies for the length, you digest readers...]  ============================== Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 =============================
Adam Lindsay wrote:
\startmathcollection[default] %eventual patch for mathtex? \definemathcharacter [a] [nothing] [mi] ["61] \definemathcharacter [b] [nothing] [mi] ["62] \definemathcharacter [c] [nothing] [mi] ["63] \definemathcharacter [d] [nothing] [mi] ["64] \definemathcharacter [e] [nothing] [mi] ["65] ...
Interesting. With these definitions in place, getting mixed bold in cmr math is a lot better, too... \definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold] \starttext \startformula n({\bfm a} + {\bfm b}) = {\bfm \Gamma} \stopformula \stoptext Now, do digits ever get bolded in mixed bold and regular math?  ============================== Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 =============================
Adam Lindsay wrote:
Now, do digits ever get bolded in mixed bold and regular math?
AFAIK, only in courseware (and perhaps other explanatory texts, like errata). There, the required emphasis can be anything, really, but nobody would object to a \hbox{} wrapper either. Cheers, Taco
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper. David
Adam Lindsay wrote:
\startmathcollection[default] %eventual patch for mathtex? \definemathcharacter [a] [nothing] [mi] ["61] \definemathcharacter [b] [nothing] [mi] ["62] \definemathcharacter [c] [nothing] [mi] ["63] \definemathcharacter [d] [nothing] [mi] ["64] \definemathcharacter [e] [nothing] [mi] ["65] ...
Interesting. With these definitions in place, getting mixed bold in cmr math is a lot better, too...
\definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold]
\starttext \startformula n({\bfm a} + {\bfm b}) = {\bfm \Gamma} \stopformula \stoptext
Now, do digits ever get bolded in mixed bold and regular math?
David Munger wrote:
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper.
Okay. What do you mean by "can't get roman characters"? Can you give an minimal example? adam
Adam Lindsay wrote:
\startmathcollection[default] %eventual patch for mathtex? \definemathcharacter [a] [nothing] [mi] ["61] \definemathcharacter [b] [nothing] [mi] ["62] \definemathcharacter [c] [nothing] [mi] ["63] \definemathcharacter [d] [nothing] [mi] ["64] \definemathcharacter [e] [nothing] [mi] ["65] ...
Interesting. With these definitions in place, getting mixed bold in cmr math is a lot better, too...
\definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold]
\starttext \startformula n({\bfm a} + {\bfm b}) = {\bfm \Gamma} \stopformula \stoptext
Now, do digits ever get bolded in mixed bold and regular math?
_______________________________________________ ntgcontext mailing list ntgcontext@ntg.nl http://www.ntg.nl/mailman/listinfo/ntgcontext
 ============================== Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 =============================
Adam Lindsay wrote :
David Munger wrote:
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper.
Okay. What do you mean by "can't get roman characters"? Can you give an minimal example?
adam
Sorry, I should have given one. \startmathcollection[default] \definemathcharacter [a] [nothing] [mi] ["61] \stopmathcollection \definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold] \starttext \formula{a, {\rm a}, {\bfm a}, {\bfm\rm a}} \stoptext I can't get bold roman math. And by using [mr] instead of [mi]: \definemathcharacter [a] [nothing] [mr] ["61] one gets the inverse problem: no more bold math italic. David
David Munger wrote:
Adam Lindsay wrote :
David Munger wrote:
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper. Okay. What do you mean by "can't get roman characters"? Can you give an minimal example?
adam
Sorry, I should have given one.
\startmathcollection[default] \definemathcharacter [a] [nothing] [mi] ["61] \stopmathcollection
\definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold]
\starttext \formula{a, {\rm a}, {\bfm a}, {\bfm\rm a}} \stoptext
I can't get bold roman math. And by using [mr] instead of [mi]: \definemathcharacter [a] [nothing] [mr] ["61] one gets the inverse problem: no more bold math italic.
oh, I see. I'll admit: all the maths I've dealt with don't require such fine manual control over the fonts. Would it be for individual characters? Would an approach like this work? \formula{a, {\rm a}, {\bfm a}, \text{\bf a}} adam  ============================== Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 =============================
Adam Lindsay wrote :
David Munger wrote:
Adam Lindsay wrote :
David Munger wrote:
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper. Okay. What do you mean by "can't get roman characters"? Can you give an minimal example?
adam
Sorry, I should have given one.
\startmathcollection[default] \definemathcharacter [a] [nothing] [mi] ["61] \stopmathcollection
\definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold]
\starttext \formula{a, {\rm a}, {\bfm a}, {\bfm\rm a}} \stoptext
I can't get bold roman math. And by using [mr] instead of [mi]: \definemathcharacter [a] [nothing] [mr] ["61] one gets the inverse problem: no more bold math italic.
oh, I see. I'll admit: all the maths I've dealt with don't require such fine manual control over the fonts.
Well, sometimes it's useful when dealing with different kinds of objects such as vectors and tensors.
Would it be for individual characters? Would an approach like this work? \formula{a, {\rm a}, {\bfm a}, \text{\bf a}}
Yes, of course. This happens to be an \hbox. My point is simply that we have not come to a general solution yet, we are just finding different workarounds to suit our personal needs, which is not bad indeed. Cheers, David
Adam Lindsay wrote:
David Munger wrote:
Adam Lindsay wrote :
David Munger wrote:
Very interesting, but with these definitions, I can't get roman characters in formulae. For the moment, the best solution for me is still the hbox wrapper.
Okay. What do you mean by "can't get roman characters"? Can you give an minimal example?
adam
Sorry, I should have given one.
\startmathcollection[default] \definemathcharacter [a] [nothing] [mi] ["61] \stopmathcollection
\definetypeface [] [mm] [bfmath] [computermodern] [computermodern] \setupformulas [method=bold]
\starttext \formula{a, {\rm a}, {\bfm a}, {\bfm\rm a}} \stoptext
I can't get bold roman math. And by using [mr] instead of [mi]: \definemathcharacter [a] [nothing] [mr] ["61] one gets the inverse problem: no more bold math italic.
oh, I see. I'll admit: all the maths I've dealt with don't require such fine manual control over the fonts.
Would it be for individual characters? Would an approach like this work? \formula{a, {\rm a}, {\bfm a}, \text{\bf a}}
just keep collecting all thoughts and ideas and solutions .... (concerning the definemathcharacters, we need input from taco on that because he knows what goes on deep inside tex and has done complex math typesetting for ages) Hans  Hans Hagen  PRAGMA ADE Ridderstraat 27  8061 GH Hasselt  The Netherlands tel: 038 477 53 69  fax: 038 477 53 74  www.pragmaade.com  www.pragmapod.nl 
Hans Hagen wrote:
(concerning the definemathcharacters, we need input from taco on that because he knows what goes on deep inside tex and has done complex math typesetting for ages)
The \definemathcharacter macro is a actually quite simple, it is mostly a syntactic wrapper around \mathcode and \delcode assignments. See the attached chunk of module documentation text. Whether mixed bold/unbold math is feasible depends mostly on two things: * if bold symbolic fonts are available (math italic, symbol and extension) * how you define the variable symbols (latin characters) and font switches. Normally, an 'a' is of mathtype 'variable' (7), so that if you do ${\bf a}$, you get a bold (fam 6) one instead of the one from the math italic (fam 1). When you redefine its mathcode so it becomes an `ord' (0) in a `bold math italic' family (say 'A' or so. You cannot use \bi since that is a match for \it, and it will not have the same spacing rules!); afterward it no longer obey font switches. If you want to get back to the upright version in such a setup, you have to redefine te \rm command to change the math family code yet again, to 'ord' in upright math (fam 0), this time. All this shuffling about with mathcodes is needed because during a single formula, TeX stores tokens in the form (family id, chararacter). Only at the very end of the formula are the families themselves mapped to fonts (and the tokens converted to using those fonts), so changing the \textfont0 etc. assignments while in the formula does not help. I hope this is clear enough. Cheers, Taco
Hans Hagen wrote:
Mojca Miklavec wrote:
I'm also able to get the complete formula typeset in bold iwona, but I don't know how to get something like ${\bf\nabla}\phi={\bi E}$, where \phi would be typeset in iwonalight and the rest in iwonaheavy for example.
maybe a way out is something \hbox{\yourboldiwona$...$}
This works of course, but I don't want to write something like (minimal example ;) $$\hbox{\switchtobodyfont[iwonaheavy]$B$}=\hbox{\switchtobodyfont[iwonaheavy]$\nabla$}\times\hbox{\switchtobodyfont[iwonaheavy]$A$}$$ even if I define my own shortcut to it. (\displaystyle, \textstyle, ... spacing, readability unless I can redefine \bf and so on ...)
another way would be to especially define bf and bi to map onto the iwona instances that you want
That's what I'm looking for, but I can't find that magical piece of code in huge typescripts definitions.
(for a real mixed functionality we need to patch tex the program)
[ok, i can imagine some kind of dynamic family pool, but for that i need some real time and motivation)
No, I really don't need that complex solution. My needs are already covered by the "MyWay" with bold math and in cm bold math works as well. It's just that I can't read the manual / cannot repeat the process and get rid of cm fonts. Thanks a lot, Mojca
Hi Mojca, I must say I understand about nothing about fonts in ConTeXt. But I've somehow managed do define a "bold vector" command, working in my environment. I hope it helps. \definetypeface [boldmath] [mm] [boldmath] [latinmodern] [default] % boldsymbol workaround \setupformulae[method=bold] \define[1]\boldsymbol{\hbox{\formula[boldmath]{#1}}} \define[1]\boldsymbolscript{\hbox{\formula[boldmath,script]{#1}}} \define[1]\boldsymbolscriptscript{\hbox{\formula[boldmath,scriptscript]{#1}}} % bold vector \define[1]\bvec{{% \mathchoice {\let\bs=\boldsymbol}% {\let\bs=\boldsymbol}% {\let\bs=\boldsymbolscript}% {\let\bs=\boldsymbolscripscript}% \bs{#1}}} Mojca Miklavec :
Hello,
What exactly is the ConTeXt alternative to LaTeX's \mathbf (switch to bold or bold italic math fonts)?
participants (6)

Adam Lindsay

David Munger

Hans Hagen

Henning Hraban Ramm

Mojca Miklavec

Taco Hoekwater