[NTG-context] Changing font for math function
Aditya Mahajan: By default, in all three formats the font for \log is mathupright rather than textrm. There needs to be a rationale for ConTeXt default to be different from other formats. Do you have any reference to a math book or journal that uses text fonts for \log-like operators? Thanks for the examples. I had forgotten that math fonts can differ from text fonts. Now I understand why you use \mathupright (which, according to the source code is identical in math mode to \mathrm and \rm). And I know that math fonts have different kerning and ligatures than text fonts. But how is that in LaTeX, kerning and ligatures in math mode inside \mathrm are the same as those of the TEXT font (while in ConTeXt \mathrm still uses the kerning and ligatures of the math font, which seems logical)? Compare the following: LaTeX: \documentclass{article} \begin{document} affinity\par $\mathrm{affinity}$\par % kerning and ligatures of TEXT mode with math font \end{document} ConTeXt: \starttext affinity\par $\mathrm affinity$\par % kerning and ligatures of MATH mode with math font \stoptext Maggyero ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/16/2015 4:23 PM, Maggyero wrote: Aditya Mahajan: By default, in all three formats the font for \log is mathupright rather than textrm. There needs to be a rationale for ConTeXt default to be different from other formats. Do you have any reference to a math book or journal that uses text fonts for \log-like operators? Thanks for the examples. I had forgotten that math fonts can differ from text fonts. Now I understand why you use \mathupright (which, according to the source code is identical in math mode to \mathrm and \rm). And I know that math fonts have different kerning and ligatures than text fonts. But how is that in LaTeX, kerning and ligatures in math mode inside \mathrm are the same as those of the TEXT font (while in ConTeXt \mathrm still uses the kerning and ligatures of the math font, which seems logical)? Compare the following: LaTeX: \documentclass{article} \begin{document} affinity\par $\mathrm{affinity}$\par % kerning and ligatures of TEXT mode with math font \end{document} ConTeXt: \starttext affinity\par $\mathrm affinity$\par % kerning and ligatures of MATH mode with math font \stoptext I have no clue how latex implements it (and don't care much either) but in context we use a unicode approach and \mathrm switches to another math alphabet ... in fact, affinity is just a sequence of a f f i n i t y (symbols, variables, whatever) and not a real word. You can use \text{affinity} but of course all depends on what the font setup is (and if your bodyfont has the same shapes for math and text). Bottom line: if you switch to \mathrm etc you don't switch fonts of styles, you switch to another alphabet. One can of course map these internally onto some text font but context doesn't work that way. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/16/2015 2:24 AM, Aditya Mahajan wrote: On Sat, 16 May 2015, Maggyero wrote: Aditya Mahajan: The default should be \mathupright (as is the case in amstex and latex, and probably also plaintex). Hans Hagen: next beta: when one of the stylealternatives text mode else mathmode (default nothing == math upright) Hans Hagen: Because like in \mtext, the \text command is ESSENTIAL (for the function names to have the mathcodes, kerning and ligatures of the text mode instead of the ones of the math mode). that is not needed because if you use a style known as text style a text font is used Alright, but why not ALWAYS use your text style (or my \text), why talking about \mathupright then? \mathupright should never be used to display a name in text style in my opinion. I don't get it, is there something that I missed with that \mathupright? (And I'm not managing to download the new beta of yesterday so I don't have access to the new code yet). Plaintex, amstex, and latex, all default to using \mathupright (or equivalent). Compare the output of the following: 1. Plain tex: \font\tenrm=ptmr7t at 10pt \tenrm log $\log$ log \bye 2. Latex: \documentclass{article} \usepackage{times} % Only changes the text font \begin{document} log $\log$ log \end{document} 3. Context: \definetypeface[mainfont][rm][serif][times][default] \definetypeface[mainfont][mm][math] [modern][default] \setupbodyfont[mainfont] \starttext log $\log$ log \stoptext By default, in all three formats the font for \log is mathupright rather than textrm. There needs to be a rationale for ConTeXt default to be different from other formats. Do you have any reference to a math book or journal that uses text fonts for \log-like operators? also, this is more robust with respect to mixed font usage: it would look weird if inside pagella math suddenly a function name in optima would be used when that font is used for the main body text If you want you can set \setupmathematics[functionstyle=normal] and achieve the behaviour that you want. indeed Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sat, 16 May 2015, Maggyero wrote: Aditya Mahajan: The default should be \mathupright (as is the case in amstex and latex, and probably also plaintex). Hans Hagen: next beta: when one of the stylealternatives text mode else mathmode (default nothing == math upright) Hans Hagen: Because like in \mtext, the \text command is ESSENTIAL (for the function names to have the mathcodes, kerning and ligatures of the text mode instead of the ones of the math mode). that is not needed because if you use a style known as text style a text font is used Alright, but why not ALWAYS use your text style (or my \text), why talking about \mathupright then? \mathupright should never be used to display a name in text style in my opinion. I don't get it, is there something that I missed with that \mathupright? (And I'm not managing to download the new beta of yesterday so I don't have access to the new code yet). Plaintex, amstex, and latex, all default to using \mathupright (or equivalent). Compare the output of the following: 1. Plain tex: \font\tenrm=ptmr7t at 10pt \tenrm log $\log$ log \bye 2. Latex: \documentclass{article} \usepackage{times} % Only changes the text font \begin{document} log $\log$ log \end{document} 3. Context: \definetypeface[mainfont][rm][serif][times][default] \definetypeface[mainfont][mm][math] [modern][default] \setupbodyfont[mainfont] \starttext log $\log$ log \stoptext By default, in all three formats the font for \log is mathupright rather than textrm. There needs to be a rationale for ConTeXt default to be different from other formats. Do you have any reference to a math book or journal that uses text fonts for \log-like operators? If you want you can set \setupmathematics[functionstyle=normal] and achieve the behaviour that you want. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Changing font for math function
Aditya Mahajan: The default should be \mathupright (as is the case in amstex and latex, and probably also plaintex). Hans Hagen: next beta: when one of the stylealternatives text mode else mathmode (default nothing == math upright) Hans Hagen: Because like in \mtext, the \text command is ESSENTIAL (for the function names to have the mathcodes, kerning and ligatures of the text mode instead of the ones of the math mode). that is not needed because if you use a style known as text style a text font is used Alright, but why not ALWAYS use your text style (or my \text), why talking about \mathupright then? \mathupright should never be used to display a name in text style in my opinion. I don't get it, is there something that I missed with that \mathupright? (And I'm not managing to download the new beta of yesterday so I don't have access to the new code yet). Appart from that story of \text or not \text, what do you think about the suggestion that I gave in the conclusion of my previous post? Do you plan to still use version 1 or to implement version 2 after the freeze for TeXLive 2015? My conclusion was: CONCLUSION. — It all comes down to the choice of the best user interface for math functions and math texts (usually used as subscripts of variables). Their styles and colors is handled with \setupmathematics. There are two choices of user interface: 1. $\normalmathop{\mfunction{Arsinh}}\nolimits x\ \text{and}\ n_{\mtext{air}}$. 2. $\mfunction{Arsinh} x\ \text{and}\ n_{\mtext{air}}$. First, the default functionstyle and textstyle in \setupmathematics should be \rm\tf (the text mode equivalent of \mathupright, as we are always in text mode thanks to the \text hardcoded in \mfunction and \mtext). Then, in the 1st solution \normalmathop is used instead of \mathop because the latter is modified by ConTeXt to convert \rm to \mf, which makes \setupmathematics[functionstyle=\rm] without effect. The 2nd solution is obviously way cleaner, that is why I think it should be preferred. The implementation is given in my '2nd DEFINITION of \mfunction' for replacing the existing definition in math-ini.mkiv: ——— \unexpanded\def\mfunction{\dosingleempty\domfunction} \def\domfunction[#1]#2% {\iffirstargument \doifelse{#1}{op}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}}{\doifelse{#1}{limop}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}\nolimits}} \else \normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}\nolimits \fi} ——— We also saw that \mfunctionlabeltext is inconsistent with ConTeXt \labeltext because the former has a style attached to it, so \mfunctionlabeltext should be removed from math-ini.mkiv and \mfunction{\mathlabeltext } should be used instead when needed. To go even further in userfriendlyness, we the new macro \definemathcommand should be added in math-ini.mkiv: ——— \unexpanded\def\definemathfunction{\dodoubleempty\dodefinemathfunction} \def\dodefinemathfunction[#1][#2]#3% {\ifsecondargument \definemathcommand[#1]{\mfunction[#2]{#3}} \else \definemathcommand[#1]{\mfunction{#3}} \fi} ——— Finally, with this new \mfunction definition and the removal of the misleading \mfunctionlabeltext, the functions defined in math-def.mkiv should be rewrite as: ——— \definemathcommand[cos]{\mfunction{\mathlabeltext{cos}}} % Or \definemathcommand[cos]{\mfunction[nolop]{\mathlabeltext{cos}}}, it is the same. \definemathcommand[det]{\mfunction[limop]{\mathlabeltext{det}}} \definemathcommand[diff]{\normalmathop{\text{\mathfunctionstyle d}}\mathopen{}} %etc. ——— or ——— \definemathfunction[cos]{\mathlabeltext{cos}} % Or \definemathfunction[cos][nolop]{\mathlabeltext{cos}}, it is the same. \definemathfunction[det][limop]{\mathlabeltext{det}} \definemathcommand[diff]{\normalmathop{\text{\mathfunctionstyle d}}\mathopen{}} % It is a special function so it should still be treated with the more general \definemathcommand. %etc. ——— ConTeXt users are now provided, if Hans agrees to implement the code given in this conclusion, with three extremely useful macros: — \mtext (that should be used for all math texts such as subscripts of variables): $n_{\mtext{air}}$; — \mfunction (the equivalent of LaTeX \operatorname macro of the amsopn package): $\mfunction{Arsinh} x$ $\mfunction[op]{Arsinh} x$ or equivalently $\mfunction[limop]{Arsinh} x$; — \definemathfunction (the equivalent of LaTeX \DeclareMathOperator macro of the amsopn package): \definemathfunction[arsinh]{Arsinh} $\arsinh x$ \definemathfunction[arsinh][op]{Arsinh} $\arsinh x$ or equivalently \definemathfunction[arsinh][limop]{Arsinh} $\arsinh x$. Maggyero
Re: [NTG-context] Changing font for math function
On 5/13/2015 5:51 PM, Maggyero wrote: Because like in \mtext, the \text command is ESSENTIAL (for the function names to have the mathcodes, kerning and ligatures of the text mode instead of the ones of the math mode). that is not needed because if you use a style known as text style a text font is used Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Changing font for math function
Hans Hagen: mfunction will stay as it is also needed for tagged pdf and exporting (basically it's an apply math function thing) so if something else is needed another name/mechanism have to be made (with appropriate tagging) the label itself is a special case as it's optional (and is just there for cultural differences as not all countries use the english names) so, \rho_{\mathlabel{air}} is something different then, some kind of multi-character variable? Actually no, it has nothing to do with ConTeXt label texts (that is why I removed the word 'text' in it to avoid the confusion), \mathlabel was just a name that I gave to encompass two different things that are usually typeset the same way (upright): the names of functions (\mfunction) and the names often used in the subscripts of variables. But after some thought and your new suggestion (\mtext) for the latter case, I find that my 'mathlabel' is misleading and that it is better for the user to keep them separate (with \mfunction AND \mtext), and it gives him more control. Hans Hagen: \unexpanded\def\mtext#1{\text{\usemathematicsstyleandcolor\c!textstyle\c!textcolor#1}} which can be used as: $x^{\mtext{effe}}$ and obeys \setupmathematics[textstyle=bold, textcolor=darkgreen] Perfect! Not only \mtext is short but also very meaningful and symmetrical with \mfunction, therefore easy to memorize. I totally agree with that new definition. QUESTION 1. — Did you include the \text command as well in the definition of your new \mfunction (like below)? 1st DEFINITION of \mfunction. ——— \unexpanded\def\mfunction#1{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#1}} ——— Because like in \mtext, the \text command is ESSENTIAL (for the function names to have the mathcodes, kerning and ligatures of the text mode instead of the ones of the math mode). Hans Hagen: next beta: when one of the stylealternatives text mode else mathmode (default nothing == mathupright) Aditya Mahajan: The default should be \mathupright (as is the case in amstex and latex, and probably also plaintex). No, I strongly disagree. Yes it should be upright by default, but it should always be in TEXT mode, even by default, that is why I used the \text command in the definition of \mfunction. \mathupright in math mode doesn't solve the problems of mathcodes, kerning and ligatures (if you want call your function 'AVL' or 'low-frequency' for instance, the result is terrible with \mathupright: the space between A and V is too large and the hyphen between w and f becomes a minus sign binary operator—try $\mathupright{AVL}$ and $\mathupright{low-frequency}$). \text{\rm\tf} does. Consequently \rm\tf should be the default functionstyle and textstyle in \setupmathematics. (And Aditya, don't forget that \mathupright is just a macro for \rm\tf in math mode.) So now, let us see what the user have to write to get a math function and a math text (usually used as the subscript of a variable): ——— \setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold, textcolor=green] \starttext $\mathnolop{\mfunction{Arsinh}} x\ \text{and}\ n_{\mtext{air}}$. \stoptext ——— The syntax is okay but a bit complicated since the symmetry is not perfect (\mtext vs \mathnolop{\mfunction}). Symmetry is important in a user interface so I think the user expects simply \mtext and \mfunction (not \mathnolop{\mfunction}). Therefore we need to wrap this \mathnolop in \mfunction. And the possibility to choose \mathop (synonym: \mathlimop) instead of \mathnolop—which should be the default—should be given to the user with an optional argument. To keep it consistent with the ConTeXt syntax, the optional argument should be [op] (synonym: [limop]). So let us redefine our \mfunction. 2nd DEFINITION of \mfunction. ——— \unexpanded\def\mfunction{\dosingleempty\domfunction} \def\domfunction[#1]#2% {\iffirstargument \doifelse{#1}{op}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}}{\doifelse{#1}{limop}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}}{\normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}\nolimits}} \else \normalmathop{\text{\usemathematicsstyleandcolor\c!functionstyle\c!functioncolor#2}}\nolimits \fi} ——— Notice in that new definition that we use \normalmathop instead of \mathop because the \mathop in ConTeXt uses a modified version of the normal \mathop (the latter is renamed \normalmathop by ConTeXt) that converts the serif font style command \rm to the math font style command \mf, which as a result makes \rm without effect in \setupmathematics[functionstyle=\rm] as I came to realize after some testing. Indeed, ConTeXt has currently the following lines in math-ini.mkiv: \let\normalmathop\mathop \unexpanded\def\mathop {\normalmathop
Re: [NTG-context] Changing font for math function
On Tue, 12 May 2015, Maggyero wrote: Hans Hagen wrote: for functions one can now use: \setupmathematics [functionstyle=\rm] Fantastic! Thank you Hans, it is way better than the old mechanism \setmathfunctionstyle. Now I have a few suggestions to improve the consistency of this new mechanism. First, I think this functionstyle key a) should be better called 'mathlabelstyle'; No. The style applies to anything called using \mfunction{...}, so functionstyle and functioncoloar are appropriate keys. b) be default to \tf to make the FONT ALTERNATIVE always upright; I disagree. The default should be \mathupright (as is the case in amstex and latex, and probably also plaintex). We now have the option to change it to \tf if desired. c) be linked to this following new definition in math-ini.mkiv: + \unexpanded\def\mathlabel#1{\text{\mathlabelstyle #1}} so that \mathlabel can be used for labeling math objects like functions but ALSO for labeling variables with subscripts (e.g., \rho_{\mathlabel{air}}). The hardcoded \text in the definition of \mathlabel is used here for these 5 reasons: Hans already replied to that. That \mathlabel should replace \mfunction which should be removed, and \mfunctionlabeltext should be removed as well and one should directly use the already defined \mathlabeltext instead, for these 3 reasons: I strongly disagree to this. These are two completely different issues (wanting a macro to tag multiletter variable names vs a macro to tag log-like operators). 1. Every command containing the word 'labeltext' should not have a style attached to it. 2. The word 'function' is misleading because \mfunction and \mfunctionlabeltext do not create a \mathop atom and it makes the user believe its usage is restricted for labeling functions while the command should also be used for labeling variable with subscripts (e.g., \rho_{\mathlabel{air}} is far better than \rho_\mfunction{air}). 3. Using only \mathlabeltext with \setuplabeltext is also more consistent with the current \labeltext that works with \setuplabeltext. Thus the function definitions in math-def.mkiv should be changed: - \definemathcommand [arccos] [nolop] {\mfunctionlabeltext{arccos}} + \definemathcommand [arccos] [nolop] {\mathlabel{\mathlabeltext{arccos}}} etc. I don't see the rationale for this. And I think you should add in this file the definition of the differential operator which is so widely used in mathematics, so that users have at their disposal once for all a proper implementation of this operator and don't have to make their own hack: + \definemathcommand[diff]{\mathop{\mathlabel{d}}\mathopen{}} Note that there is no consensus on how the `d` in calculus should be typeset. There are also \differentiald and \differentialD that map to unicode slots. \definemathcommand[arsinh][nolop]{\mathlabel{arsinh}} \starttext $\arsinh z = \ln\bigl(z + \sqrt{z^2 + 1}\bigr)$\par $\rho_{\mathlabel{air}} = \frac{p}{R_{\mathlabel{specific}}T}$\par \stoptext \mfunction already does that. I'll reply to the rest of the message later. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Tue, May 12, 2015 at 8:05 PM, Aditya Mahajan adit...@umich.edu wrote: Note that there is no consensus on how the `d` in calculus should be typeset. There are also \differentiald and \differentialD that map to unicode slots. Maybe not consensus, but see tug.org/TUGboat/tb18-1/tb54becc.pdf about ISO 31/XI. /Mikael ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
And in my opinion, names for operators and subscripts should all be upright, that is adaptative to the surrounding TEXT STYLE (\rm, \ss and \tt) BUT not adaptative to the surrounding TEXT ALTERNATIVE or MATH ALTERNATIVE (\it, \bi, \sl, \bs) and stay in the normal alternative \tf (upright). This behavior can be achieved using \setupmathematics[functionstyle=normal] Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/12/2015 4:19 PM, Maggyero wrote: Hans Hagen wrote: for functions one can now use: \setupmathematics [functionstyle=\rm] Fantastic! Thank you Hans, it is way better than the old mechanism \setmathfunctionstyle. Now I have a few suggestions to improve the consistency of this new mechanism. First, I think this functionstyle key a) should be better called 'mathlabelstyle'; b) be default to \tf to make the FONT ALTERNATIVE always upright; c) be linked to this following new definition in math-ini.mkiv: + \unexpanded\def\mathlabel#1{\text{\mathlabelstyle #1}} so that \mathlabel can be used for labeling math objects like functions but ALSO for labeling variables with subscripts (e.g., \rho_{\mathlabel{air}}). The hardcoded \text in the definition of \mathlabel is used here for these 5 reasons: 1. It CAN make the FONT STYLE adaptative to the surrounding style (if the \mathlabelstyle inside—defined by the user in \setupmathematics[mathlabelstyle=]—does not specify another FONT STYLE like \rm, \ss or \tt). 2. It uses proper mathcodes (hyphens are not converted to minus binary operators—useful if one wants to call its function or subscript 'low-frequency' for instance—, apostrophes are not converted to primes—useful if one wants to call its function 'Riemann's function' for instance). 3. It uses proper kerning (if one wants to call its function or subscript 'WALL' for instance). 4. It uses proper ligatures (if one wants to call its function or subscript 'efficiency' for instance). 5. It avoids the user having to add \kern\zeropoint to prevent vertical alignment to the middle of the fraction bar when used inside \mathop for one-character function names (if one wants to call its function 'd' for instance). That \mathlabel should replace \mfunction which should be removed, and \mfunctionlabeltext should be removed as well and one should directly use the already defined \mathlabeltext instead, for these 3 reasons: 1. Every command containing the word 'labeltext' should not have a style attached to it. 2. The word 'function' is misleading because \mfunction and \mfunctionlabeltext do not create a \mathop atom and it makes the user believe its usage is restricted for labeling functions while the command should also be used for labeling variable with subscripts (e.g., \rho_{\mathlabel{air}} is far better than \rho_\mfunction{air}). 3. Using only \mathlabeltext with \setuplabeltext is also more consistent with the current \labeltext that works with \setuplabeltext. mfunction will stay as it is also needed for tagged pdf and exporting (basically it's an apply math function thing) so if something else is needed another name/mechanism have to be made (with appropriate tagging) the label itself is a special case as it's optional (and is just there for cultural differences as not all countries use the english names) so, \rho_{\mathlabel{air}} is something different then, some kind of multi-character variable? Thus the function definitions in math-def.mkiv should be changed: - \definemathcommand [arccos] [nolop] {\mfunctionlabeltext{arccos}} + \definemathcommand [arccos] [nolop] {\mathlabel{\mathlabeltext{arccos}}} etc. And I think you should add in this file the definition of the differential operator which is so widely used in mathematics, so that users have at their disposal once for all a proper implementation of this operator and don't have to make their own hack: + \definemathcommand[diff]{\mathop{\mathlabel{d}}\mathopen{}} i can add a 'diff' With this new \mathlabel command, the user now have a convenient and consistent way to label its math objets (functions and variables with subscripts): \definemathcommand[arsinh][nolop]{\mathlabel{arsinh}} \starttext $\arsinh z = \ln\bigl(z + \sqrt{z^2 + 1}\bigr)$\par $\rho_{\mathlabel{air}} = \frac{p}{R_{\mathlabel{specific}}T}$\par \stoptext Hans Hagen wrote: \unprotect \def\v!sansnormal {sansnormal} %def\v!sansbold {sansbold} \def\v!serifnormal{serifnormal} \def\v!serifbold {serifbold} \definealternativestyle [\v!sansnormal] [\ss\tf] %definealternativestyle [\v!sansbold][\ss\bf] \definealternativestyle [\v!serifnormal] [\rm\tf] \definealternativestyle [\v!serifbold] [\rm\bf] \protect In this case, for completeness, I would also add the definitions for the remaining style \tt: \def\v!mononormal {mononormal} \def\v!monobold {monobold} \definealternativestyle [\v!mononormal] [\tt\tf] \definealternativestyle [\v!monobold][\tt\bf] ok Aditya Mahajan wrote: \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). You should try \mathop{\text{\rm\tf sin}} or \mathoptext{\rm\tf
[NTG-context] Changing font for math function
Hans Hagen wrote: for functions one can now use: \setupmathematics [functionstyle=\rm] Fantastic! Thank you Hans, it is way better than the old mechanism \setmathfunctionstyle. Now I have a few suggestions to improve the consistency of this new mechanism. First, I think this functionstyle key a) should be better called 'mathlabelstyle'; b) be default to \tf to make the FONT ALTERNATIVE always upright; c) be linked to this following new definition in math-ini.mkiv: + \unexpanded\def\mathlabel#1{\text{\mathlabelstyle #1}} so that \mathlabel can be used for labeling math objects like functions but ALSO for labeling variables with subscripts (e.g., \rho_{\mathlabel{air}}). The hardcoded \text in the definition of \mathlabel is used here for these 5 reasons: 1. It CAN make the FONT STYLE adaptative to the surrounding style (if the \mathlabelstyle inside—defined by the user in \setupmathematics[mathlabelstyle=]—does not specify another FONT STYLE like \rm, \ss or \tt). 2. It uses proper mathcodes (hyphens are not converted to minus binary operators—useful if one wants to call its function or subscript 'low-frequency' for instance—, apostrophes are not converted to primes—useful if one wants to call its function 'Riemann's function' for instance). 3. It uses proper kerning (if one wants to call its function or subscript 'WALL' for instance). 4. It uses proper ligatures (if one wants to call its function or subscript 'efficiency' for instance). 5. It avoids the user having to add \kern\zeropoint to prevent vertical alignment to the middle of the fraction bar when used inside \mathop for one-character function names (if one wants to call its function 'd' for instance). That \mathlabel should replace \mfunction which should be removed, and \mfunctionlabeltext should be removed as well and one should directly use the already defined \mathlabeltext instead, for these 3 reasons: 1. Every command containing the word 'labeltext' should not have a style attached to it. 2. The word 'function' is misleading because \mfunction and \mfunctionlabeltext do not create a \mathop atom and it makes the user believe its usage is restricted for labeling functions while the command should also be used for labeling variable with subscripts (e.g., \rho_{\mathlabel{air}} is far better than \rho_\mfunction{air}). 3. Using only \mathlabeltext with \setuplabeltext is also more consistent with the current \labeltext that works with \setuplabeltext. Thus the function definitions in math-def.mkiv should be changed: - \definemathcommand [arccos] [nolop] {\mfunctionlabeltext{arccos}} + \definemathcommand [arccos] [nolop] {\mathlabel{\mathlabeltext{arccos}}} etc. And I think you should add in this file the definition of the differential operator which is so widely used in mathematics, so that users have at their disposal once for all a proper implementation of this operator and don't have to make their own hack: + \definemathcommand[diff]{\mathop{\mathlabel{d}}\mathopen{}} With this new \mathlabel command, the user now have a convenient and consistent way to label its math objets (functions and variables with subscripts): \definemathcommand[arsinh][nolop]{\mathlabel{arsinh}} \starttext $\arsinh z = \ln\bigl(z + \sqrt{z^2 + 1}\bigr)$\par $\rho_{\mathlabel{air}} = \frac{p}{R_{\mathlabel{specific}}T}$\par \stoptext Hans Hagen wrote: \unprotect \def\v!sansnormal {sansnormal} %def\v!sansbold {sansbold} \def\v!serifnormal{serifnormal} \def\v!serifbold {serifbold} \definealternativestyle [\v!sansnormal] [\ss\tf] %definealternativestyle [\v!sansbold][\ss\bf] \definealternativestyle [\v!serifnormal] [\rm\tf] \definealternativestyle [\v!serifbold] [\rm\bf] \protect In this case, for completeness, I would also add the definitions for the remaining style \tt: \def\v!mononormal {mononormal} \def\v!monobold {monobold} \definealternativestyle [\v!mononormal] [\tt\tf] \definealternativestyle [\v!monobold][\tt\bf] Aditya Mahajan wrote: \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). You should try \mathop{\text{\rm\tf sin}} or \mathoptext{\rm\tf sin} (Hans defined this \mathoptext in math-ini.mkiv as equal to \mathop#1{\text{1#}}), or equivalently but better: \mathop{\mathlabel{sin}} with \setupmathematics[mathlabelstyle=\rm\tf] with the new command \mathlabel that I have defined above. And in my opinion, names for operators and subscripts should all be upright, that is adaptative to the surrounding TEXT STYLE (\rm, \ss and \tt) BUT not adaptative to the surrounding TEXT ALTERNATIVE or MATH ALTERNATIVE (\it, \bi, \sl, \bs) and stay in the normal alternative \tf (upright). So for your
[NTG-context] Changing font for math function
Sorry, I did 3 typos in my previous post. — First typo: 3. Using only \mathlabeltext with \setuplabeltext is also more consistent with the current \labeltext that works with \setuplabeltext. 3. Using only \mathlabeltext with \setupmathlabeltext is also more consistent with the current \labeltext that works with \setuplabeltext. — Second typo: \define\function{\dosingleempty\dofunction} \def\dofunction[#1]#2{% \iffirstargument \doifelse{#1}{limop}{\mathop{\mathlabel{#2}}}{\mathop{\mathlabel{#2}}\nolimits} \else \mathop{\mathlabel{#2}}\nolimits \fi} \define\function{\dosingleempty\dofunction} \def\dofunction[#1]#2{% \iffirstargument \doifelse{#1}{op}{\mathop{\mathlabel{#2}}}{\doifelse{#1}{limop}{\mathop{\mathlabel{#2}}}{\mathop{\mathlabel{#2}}\nolimits}} \else \mathop{\mathlabel{#2}}\nolimits \fi} Plus these 2 definitions were not supposed to be in this post (I forgot to remove them during my tests). Nevertheless Hans could had them as well in math-ini.mkiv if he thinks the user should have access to this \function command, which is the ConTeXt version of the well known \operatorname and \operatorname* command in LaTeX. It provides: \starttext \startformula \function{lim}_{x\to a} f(x)\quad \function[op]{lim}_{x\to a} f(x)\quad \function[limop]{lim}_{x\to a} f(x) \stopformula \stoptext — Third typo: \definemathcommand[arsinh][op]{\mathlabel{arsinh}} \definemathcommand[arsinh][nolop]{\mathlabel{arsinh}} Maggyero ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Hi Aditya, Thanks for your remark: indeed with the correct use of \underline, I get what was intended, but somehow before yesterday ConTeXt was more tolerant and for years it accepted my wrong definition of \liminf… However, with the new features of \setupmathematics, the underlined word lim has two colors: for instance with the option \setupmathematics [functioncolor=red] the word lim is in red, but the underline is in black. If I understand correctly, the option \setupmathematics [functionstyle=\normalrm, functioncolor=red] uses the normal roman font in math mode, that is math italic if for instance one is using LM roman as text font. Am I right? A final question: assuming one needs somewhere a command named weak limit, that is \weaklim, I tried the following definition: \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} but I don’t get the word weaklim printed: what am I doing wrong? Here is the example: % begin weaklim.tex \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} \starttext If $\phi_{n}(x) := \sin(n|x|)$, then $\weaklim_{n\to\infty}\phi_{n} = 0$. \stoptext % end weaklim.tex Best regards: OK On 11 May 2015, at 04:47, Aditya Mahajan adit...@umich.edu wrote: On Sun, 10 May 2015, Otared Kavian wrote: Everything works fine, except that when one tries to modify, for instance the definition of \liminf (in order to have it as an underlined lim), ConTeXt reports an error. %\definemathcommand [liminf] [limop] {\underline\mfunctionlabeltext{lim}} \underline{} takes an argument. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Thanks Hans! Out of curiosity I tried textcolor and textstyle as in \setupmathematics [functionstyle=, functioncolor=darkred, textstyle=bold, textcolor=blue] and discovered that these two work also… By the end of the week I’ll wikify these. Thanks and best regards: OK On 11 May 2015, at 10:05, Hans Hagen pra...@wxs.nl wrote: On 5/11/2015 9:07 AM, Otared Kavian wrote: Hi Aditya, Thanks for your remark: indeed with the correct use of \underline, I get what was intended, but somehow before yesterday ConTeXt was more tolerant and for years it accepted my wrong definition of \liminf… However, with the new features of \setupmathematics, the underlined word lim has two colors: for instance with the option \setupmathematics [functioncolor=red] the word lim is in red, but the underline is in black. you can set lots of colors so formulas can be real colorful If I understand correctly, the option \setupmathematics [functionstyle=\normalrm, functioncolor=red] uses the normal roman font in math mode, that is math italic if for instance one is using LM roman as text font. Am I right? functionstyle=somedefinedtextstylealternative will box the stuff and uses the given fon, otherwise it will use whatever is set and when nothing is set it will use mathupright (cf aditya's wish and previous behaviour) A final question: assuming one needs somewhere a command named weak limit, that is \weaklim, I tried the following definition: \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} but I don’t get the word weaklim printed: what am I doing wrong? Here is the example: % begin weaklim.tex \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} \starttext If $\phi_{n}(x) := \sin(n|x|)$, then $\weaklim_{n\to\infty}\phi_{n} = 0$. \stoptext % end weaklim.tex it helps to define the label \setupmathlabeltext[en][weaklim=wlim] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/11/2015 9:07 AM, Otared Kavian wrote: Hi Aditya, Thanks for your remark: indeed with the correct use of \underline, I get what was intended, but somehow before yesterday ConTeXt was more tolerant and for years it accepted my wrong definition of \liminf… However, with the new features of \setupmathematics, the underlined word lim has two colors: for instance with the option \setupmathematics [functioncolor=red] the word lim is in red, but the underline is in black. you can set lots of colors so formulas can be real colorful If I understand correctly, the option \setupmathematics [functionstyle=\normalrm, functioncolor=red] uses the normal roman font in math mode, that is math italic if for instance one is using LM roman as text font. Am I right? functionstyle=somedefinedtextstylealternative will box the stuff and uses the given fon, otherwise it will use whatever is set and when nothing is set it will use mathupright (cf aditya's wish and previous behaviour) A final question: assuming one needs somewhere a command named weak limit, that is \weaklim, I tried the following definition: \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} but I don’t get the word weaklim printed: what am I doing wrong? Here is the example: % begin weaklim.tex \definemathcommand [weaklim] [limop] {\mfunctionlabeltext{weaklim}} \starttext If $\phi_{n}(x) := \sin(n|x|)$, then $\weaklim_{n\to\infty}\phi_{n} = 0$. \stoptext % end weaklim.tex it helps to define the label \setupmathlabeltext[en][weaklim=wlim] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/11/2015 7:08 PM, Aditya Mahajan wrote: \definealternativestyle [\v!sansnormal] [\ss\tf] %definealternativestyle [\v!sansbold][\ss\bf] \definealternativestyle [\v!serifnormal] [\rm\tf] \definealternativestyle [\v!serifbold] [\rm\bf] These appear to work. Note that sansbold is already defined font-pre.mkiv that's why i commented it in the example above - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/11/2015 6:16 PM, Aditya Mahajan wrote: On Sun, 10 May 2015, Hans Hagen wrote: next beta: when one of the stylealternatives text mode else mathmode (default nothing == mathupright) \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=roman,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} \stoptext functionstyle=roman is affected by font switches \bf and \it. It should not be affected. \setupmathematics[functionstyle=roman] {\it $\sin x$} This is especially important because typically theorems, etc are typeset in italic. It tried setting functionstyle=\normalrm but that turns everything into italic. Complete example: \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=serif,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \stoptext we can add \unprotect \def\v!sansnormal {sansnormal} %def\v!sansbold {sansbold} \def\v!serifnormal{serifnormal} \def\v!serifbold {serifbold} \definealternativestyle [\v!sansnormal] [\ss\tf] %definealternativestyle [\v!sansbold][\ss\bf] \definealternativestyle [\v!serifnormal] [\rm\tf] \definealternativestyle [\v!serifbold] [\rm\bf] \protect \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Mon, 11 May 2015, Hans Hagen wrote: On 5/11/2015 6:16 PM, Aditya Mahajan wrote: On Sun, 10 May 2015, Hans Hagen wrote: next beta: when one of the stylealternatives text mode else mathmode (default nothing == mathupright) \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=roman,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} \stoptext functionstyle=roman is affected by font switches \bf and \it. It should not be affected. \setupmathematics[functionstyle=roman] {\it $\sin x$} This is especially important because typically theorems, etc are typeset in italic. It tried setting functionstyle=\normalrm but that turns everything into italic. Complete example: \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=serif,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \stoptext we can add \unprotect \def\v!sansnormal {sansnormal} %def\v!sansbold {sansbold} \def\v!serifnormal{serifnormal} \def\v!serifbold {serifbold} \definealternativestyle [\v!sansnormal] [\ss\tf] %definealternativestyle [\v!sansbold][\ss\bf] \definealternativestyle [\v!serifnormal] [\rm\tf] \definealternativestyle [\v!serifbold] [\rm\bf] \protect These appear to work. Note that sansbold is already defined font-pre.mkiv Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sun, 10 May 2015, Hans Hagen wrote: next beta: when one of the stylealternatives text mode else mathmode (default nothing == mathupright) \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=roman,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} \stoptext functionstyle=roman is affected by font switches \bf and \it. It should not be affected. \setupmathematics[functionstyle=roman] {\it $\sin x$} This is especially important because typically theorems, etc are typeset in italic. It tried setting functionstyle=\normalrm but that turns everything into italic. Complete example: \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \setupmathematics[functionstyle=serif,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} {\it $\sin x$} \stoptext Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sun, 10 May 2015, Otared Kavian wrote: Everything works fine, except that when one tries to modify, for instance the definition of \liminf (in order to have it as an underlined lim), ConTeXt reports an error. %\definemathcommand [liminf] [limop] {\underline\mfunctionlabeltext{lim}} \underline{} takes an argument. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sun, 10 May 2015, Hans Hagen wrote: On 5/9/2015 4:16 PM, Aditya Mahajan wrote: On Sat, 9 May 2015, Aditya Mahajan wrote: On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). does \setupmathematics [functionstyle=\normalrm, functioncolor=red] work ok? (\rm is redefined in math mode so we need the outer one) we could have some keywords for this if needed No. Consider \setupmathematics [functionstyle=\normalrm, functioncolor=] \setuphead[section][style=bold] \starttext \section{$\sin^2 x$} {\ss $\sin^2 x$} {\bf $\sin x$} {\it $\sin x$} \startformula f = \sin i\omega x \stopformula \stoptext Ideally, 1. The default should be \mathupright (old behavior) 2. The user should have the option to change the font to \normalrm, \normalss (or \normalrmbf and \normalssbf for titles). In both cases, the style should not be affected by surrounding styles. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/10/2015 2:19 PM, Aditya Mahajan wrote: On Sun, 10 May 2015, Hans Hagen wrote: On 5/9/2015 4:16 PM, Aditya Mahajan wrote: On Sat, 9 May 2015, Aditya Mahajan wrote: On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). does \setupmathematics [functionstyle=\normalrm, functioncolor=red] work ok? (\rm is redefined in math mode so we need the outer one) we could have some keywords for this if needed No. Consider \setupmathematics [functionstyle=\normalrm, functioncolor=] \setuphead[section][style=bold] \starttext \section{$\sin^2 x$} {\ss $\sin^2 x$} {\bf $\sin x$} {\it $\sin x$} \startformula f = \sin i\omega x \stopformula \stoptext Ideally, 1. The default should be \mathupright (old behavior) 2. The user should have the option to change the font to \normalrm, \normalss (or \normalrmbf and \normalssbf for titles). In both cases, the style should not be affected by surrounding styles. next beta: when one of the stylealternatives text mode else mathmode (default nothing == mathupright) \starttext \setupmathematics[functionstyle=,functioncolor=darkred] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=sansbold,functioncolor=darkblue] {\ss $\sin x$} {\bf $\sin x$} \setupmathematics[functionstyle=roman,functioncolor=darkgreen] {\ss $\sin x$} {\bf $\sin x$} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Hi Hans, Thanks for the new feature in \setupmathematics. I did some testing of the feature on a several documents, , and followed the discussions you had with Aditya and Wolfgang. Everything works fine, except that when one tries to modify, for instance the definition of \liminf (in order to have it as an underlined lim), ConTeXt reports an error. Please see below the minimal example and the error message. In the minimal example if you uncomment the lines modifying the definition of \liminf on gets an error message. begin test-functionstyle.tex \setupmathematics [functionstyle=\ss, functioncolor=red] %\unprotect %\definemathcommand [liminf] [limop] {\underline\mfunctionlabeltext{lim}} %\protect \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula Fatou's lemma implies \startformula \int_{\Omega}\liminf_{n\to\infty} (1+\cos(n|x|))dx \leq \liminf_{n\to\infty}\int_{\Omega}(1+\cos(n|x|))dx. \stopformula \stoptext end test-functionstyle.tex The error message is: \begingroup \mfunctionlabeltext #1-\begingroup \math_tags_mfunctionlab {#1}\c_apply_fun... \483limop #1-\mathop {#1 } l.45 \int_{\Omega}\liminf _{n\to\infty} (1+\cos(n|x|))dx \leq \liminf_{n\to\inf... Best regards: OK On 10 May 2015, at 01:30, Hans Hagen pra...@wxs.nl wrote: On 5/9/2015 4:16 PM, Aditya Mahajan wrote: On Sat, 9 May 2015, Aditya Mahajan wrote: On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). does \setupmathematics [functionstyle=\normalrm, functioncolor=red] work ok? (\rm is redefined in math mode so we need the outer one) we could have some keywords for this if needed I realize that this takes us back to the old 'bold-math-in-section-heads' debate. With the current implementation: \setuphead[section][style=bold] \section{$\sin x$} sin is bold, and if you implement the change that I am suggesting, then \sin will not be bold in section titles. If someone prefers \sin to be bolded in section headers, he would have to add \setupmathematics[functionstyle=\bf] in the section style as well. the next stage of the math font project will provide some real bold fonts (so bold alphabets get heavy variants) Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/9/2015 4:16 PM, Aditya Mahajan wrote: On Sat, 9 May 2015, Aditya Mahajan wrote: On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). does \setupmathematics [functionstyle=\normalrm, functioncolor=red] work ok? (\rm is redefined in math mode so we need the outer one) we could have some keywords for this if needed I realize that this takes us back to the old 'bold-math-in-section-heads' debate. With the current implementation: \setuphead[section][style=bold] \section{$\sin x$} sin is bold, and if you implement the change that I am suggesting, then \sin will not be bold in section titles. If someone prefers \sin to be bolded in section headers, he would have to add \setupmathematics[functionstyle=\bf] in the section style as well. the next stage of the math font project will provide some real bold fonts (so bold alphabets get heavy variants) Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/9/2015 2:03 AM, Aditya Mahajan wrote: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. this is evil (as it's unpredictable, so no support for side effects): % \prependtoks \rm \to \everymathematics i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Am 09.05.2015 um 13:46 schrieb Hans Hagen pra...@wxs.nl: On 5/9/2015 2:03 AM, Aditya Mahajan wrote: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. this is evil (as it's unpredictable, so no support for side effects): % \prependtoks \rm \to \everymathematics Is there no better way to use upright letters in math except the line above? Wolfgang___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/9/2015 2:03 AM, Aditya Mahajan wrote: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). oh, is that ever needed? italic sin? In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. Are you sure? In many cases the math font is different from the bodyfont. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Am 09.05.2015 um 02:03 schrieb Aditya Mahajan adit...@umich.edu: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the body font. MkII used the math font too for \sin etc. but you where able to change it with the “text” key from \definetypeface. % engine=pdftex \definetypeface [mathfunction] [rm] [serif] [modern] [default] \definetypeface [mathfunction] [ss] [sans] [modern] [default] \definetypeface [mathfunction] [mm] [math] [palatino] [default] [text=ss] \setupbodyfont[mathfunction] \starttext $sin \sin$ \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
Am 09.05.2015 um 15:00 schrieb Hans Hagen pra...@wxs.nl: On 5/9/2015 1:56 PM, Wolfgang Schuster wrote: Am 09.05.2015 um 13:46 schrieb Hans Hagen pra...@wxs.nl mailto:pra...@wxs.nl mailto:pra...@wxs.nl mailto:pra...@wxs.nl: On 5/9/2015 2:03 AM, Aditya Mahajan wrote: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. this is evil (as it's unpredictable, so no support for side effects): % \prependtoks \rm \to \everymathematics Is there no better way to use upright letters in math except the line above? for functions one can now use: \setupmathematics [functionstyle=\rm] and for other changes the normal alphabet changing commands. For text one has the text commands. Keep in mind that in the regular math stream we don't think of fonts but of alphabets The bold and italic symbols/letters aren’t a problem because the have their own unicode points but for the normal upright characters there should be proper key (like the lcgreek and ucgreek keys) which prevent ConTeXt to make them into italic characters. The \everymathematics hack works but isn’t very nice. \setupmathematics[lcgreek=normal] \setupbodyfont[cambria] %\appendtoks \rm \to \everymathematics \starttext \m{α훂훼휶} \m{D퐃퐷푫} \m{{\rm D}퐃퐷푫} \stoptext Wolfgang___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On 5/9/2015 1:56 PM, Wolfgang Schuster wrote: Am 09.05.2015 um 13:46 schrieb Hans Hagen pra...@wxs.nl mailto:pra...@wxs.nl: On 5/9/2015 2:03 AM, Aditya Mahajan wrote: Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. this is evil (as it's unpredictable, so no support for side effects): % \prependtoks \rm \to \everymathematics Is there no better way to use upright letters in math except the line above? for functions one can now use: \setupmathematics [functionstyle=\rm] and for other changes the normal alphabet changing commands. For text one has the text commands. Keep in mind that in the regular math stream we don't think of fonts but of alphabets Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Changing font for math function
On Sat, 9 May 2015, Aditya Mahajan wrote: On Sat, 9 May 2015, Hans Hagen wrote: i've added (uploading beta now) \setupmathematics [functionstyle=\ss, functioncolor=red] \starttext \startformula f = \sin i\omega x^{\sin(x^{\sin(y)})} \stopformula \stoptext best test this because Mojca will at some point push into tex live (at which moment we have a current) Thanks. This works correctly on a small test. I will test this more thoroughly. \sin etc should not behave like \text{...}. \text should adapt to the surrounding style while \mathoptext should not. In particular, in the following {\ss $\sin x$} {\bf $\sin x$} \sin should be in normal text upright font and not adapted to the surrounded text. Is it possible to set a value of functionstyle so that the surrounding text font styles are ignored (but the font size is not). I realize that this takes us back to the old 'bold-math-in-section-heads' debate. With the current implementation: \setuphead[section][style=bold] \section{$\sin x$} sin is bold, and if you implement the change that I am suggesting, then \sin will not be bold in section titles. If someone prefers \sin to be bolded in section headers, he would have to add \setupmathematics[functionstyle=\bf] in the section style as well. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Changing font for math function
Hi, There is a question on TeX.SX asking how to change the font of \sin, \cos, etc. http://tex.stackexchange.com/q/243893/323 I looked at the code, and there does not appear to be an easy solution. The \mathfunctionlabeltext command has \mathupright hard coded. One option is to keep this configurable using \setupmathematics, perhaps mfunction=(normal|italic|sans). In any case, I think that the current implementation is a bug. The default font for mathfunctionlabeltext should be typeset in the bodyfont. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___