ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Changing font for math function
@ 2015-05-12 15:18 Maggyero
  0 siblings, 0 replies; 34+ messages in thread
From: Maggyero @ 2015-05-12 15:18 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1547 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 2884 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-16 14:23 Maggyero
@ 2015-05-16 15:35 ` Hans Hagen
  0 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-16 15:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Changing font for math function
@ 2015-05-16 14:23 Maggyero
  2015-05-16 15:35 ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Maggyero @ 2015-05-16 14:23 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1117 bytes --]

> 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

[-- Attachment #1.2: Type: text/html, Size: 1568 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-16  0:24 ` Aditya Mahajan
@ 2015-05-16  8:23   ` Hans Hagen
  0 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-16  8:23 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-15 23:34 Maggyero
@ 2015-05-16  0:24 ` Aditya Mahajan
  2015-05-16  8:23   ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-16  0:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Changing font for math function
@ 2015-05-15 23:34 Maggyero
  2015-05-16  0:24 ` Aditya Mahajan
  0 siblings, 1 reply; 34+ messages in thread
From: Maggyero @ 2015-05-15 23:34 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 5480 bytes --]

> 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

[-- Attachment #1.2: Type: text/html, Size: 6370 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-13 15:51 Maggyero
@ 2015-05-13 16:13 ` Hans Hagen
  0 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-13 16:13 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Changing font for math function
@ 2015-05-13 15:51 Maggyero
  2015-05-13 16:13 ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Maggyero @ 2015-05-13 15:51 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 24505 bytes --]

> 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
   \bgroup
   \let\rm\mf
   \let\nexttoken=}

QUESTION 2. — By the way, why this conversion of \rm to \mf inside \mathop
atoms (\let\rm\mf)?

So with the new definition for \mfunction, the user can now simply and
elegantly write this:
———————————————————————
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\mfunction{Arsinh} x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

With that new \mfunction, ConTeXt users now have an equivalent macro to the
LaTeX \operatorname macro of the amsopn package, which I think was very
missing.

Now, let us look at how the user can DEFINE his math function.

A. With the 1st definition of \mfunction (the one that doesn't include
\mathnolop or \mathop), the user can write this (notice again that we use
\normalmathop \nolimits instead of \mathnolop—or equivalently [nolop]—to
avoid the conversion of \rm to \mf that would make
\setupmathematics[functionstyle=\rm] without effect):
———————————————————————
\definemathcommand[arsinh]{\normalmathop{\mfunction{Arsinh}}\nolimits}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

or, alternatively this (if the user wants also to define a label text for
his function):
———————————————————————
\setupmathlabeltext[arsinh=Arsinh]
\definemathcommand[arsinh]{\normalmathop{\mfunctionlabeltext{arsinh}}\nolimits}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

assuming that \mfunctionlabeltext is defined the following way (which I
think is already the case in the last beta).

1st DEFINITION of \mfunctionlabeltext.
———————————————————————
\unexpanded\def\mfunctionlabeltext#1{\mfunction{\mathlabeltext{#1}}}
———————————————————————

Thus with the 1st definition of \mfunction (and \mfunctionlabeltext), the
definition of a math function for the user is a bit complicated (he has to
write \normalmathop \nolimits in addition to \mfunction or
\mfunctionlabeltext, unless Hans decides to remove \let\rm\mf from his
redefinition of \mathop in which case the user just has to add the optional
argument [nolop] instead of the verbose and hard to remember \normalmathop
\nolimits).

B. With the 2nd definition of \mfunction (the one that includes \mathnolop
or \mathop), the user can write this:
———————————————————————
\definemathcommand[arsinh]{\mfunction{Arsinh}}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

or, alternatively this (if the user wants also to define a label text for
his function):
———————————————————————
\setupmathlabeltext[arsinh=Arsinh]
\definemathcommand[arsinh]{\mfunctionlabeltext{arsinh}}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

assuming that \mfunctionlabeltext is defined the following way (the
additional optional argument is for that of \mfunction).

2nd DEFINITION of \mfunctionlabeltext.
———————————————————————
\unexpanded\def\mfunctionlabeltext{\dosingleempty\domfunctionlabeltext}
\def\domfunctionlabeltext[#1]#2%
  {\iffirstargument
     \mfunction[#1]{\mathlabeltext{#2}}
   \else
     \mfunction{\mathlabeltext{#2}}
   \fi}
———————————————————————

Thus with the 2nd definition of \mfunction (and \mfunctionlabeltext), the
definition of a math function for the user is easier (no need to write
\normalmathop \nolimits since it is taken into account in \mfunction, and
Hans doesn't have to remove \let\rm\mf from his redefinition of \mathop).
It confirms that the 2nd definition of \mfunction (and \mfunctionlabeltext)
is the way to go.

However the command \mfunctionlabeltext is unnecessary and inconsistent
with the other ConTeXt command \labeltext since it has a style attached to
it, so may confuse the user. The direct command \mathlabeltext (the math
equivalent of \labeltext) should be preferred. Therefore I think Hans
should remove \mfunctionlabeltext from math-ini.mkiv and the user should
use \mfunction{\mathlabeltext } when needed:
———————————————————————
\setupmathlabeltext[arsinh=Arsinh]
\definemathcommand[arsinh]{\mfunction{\mathlabeltext{arsinh}}}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

But we can go a little further in user friendliness by wrapping the
\mfunction in a new macro, that we should name \definemathfunction to be
consistent with the other macros (\definemathcommand, \definemathsymbol,
\definemathcharacter, etc.). The possibility to choose between \mathop
(synonym: \mathlimop) and \mathnolop—which should be the default—is once
more given to the user with the optional argument [op] (synonym: [limop])
to be consistent with the ConTeXt syntax. The macro is defined as follows.

DEFINITION of \definemathfunction.
———————————————————————
\unexpanded\def\definemathfunction{\dodoubleempty\dodefinemathfunction}
\def\dodefinemathfunction[#1][#2]#3%
  {\ifsecondargument
     \definemathcommand[#1]{\mfunction[#2]{#3}}
   \else
     \definemathcommand[#1]{\mfunction{#3}}
   \fi}
———————————————————————

Notice that we use again \normalmathop for the same reasons as before. That
new \definemathfunction macro now allows the user to write this:
———————————————————————
\definemathfunction[arsinh]{arsinh}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

or, alternatively this (if the user wants also to define a label text for
his function):
———————————————————————
\setupmathlabeltext[arsinh=Arsinh]
\definemathfunction[arsinh]{\mathlabeltext{arsinh}}
\setupmathematics[functionstyle=bold, functioncolor=red, textstyle=bold,
textcolor=green]
\starttext
  $\arsinh x\ \text{and}\ n_{\mtext{air}}$.
\stoptext
———————————————————————

With that new \definemathfunction, ConTeXt users now have an equivalent
macro to the LaTeX \DeclareMathOperator macro of the amsopn package, which
I think was very missing as well.

The math functions defined in math-def.mkiv should of course use
\mfunction{\mathlabeltext } instead of the old \mfunctionlabeltext, or the
new macro \definemathfunction:
———————————————————————
\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.
———————————————————————

Notice the removal of [nolop] and [limop] which are already present in
\mfunction and \mfunction[limop] respectively (since we now use the 2nd
definition of \mfunction for all the reasons we gave above).

Now before concluding, here is a little example illustrating the new
mechanism of Hans (functionstyle, functioncolor, textstyle and textcolor
keys in \setupmathematics) of which I improved the consistency and
simplicity of the related macros (\mtext and \mfunction, and the new
\definemathfunction) in practical use. In this example as I still don't
have access to the last beta I didn't use the new keys of \setupmathematics
(functionstyle, textstyle) but local definitions. For Aditya, this time the
given example works correctly contrary to my last post where I realized
afterwards that \rm was not working in \setupmathematics because of the use
of \mathop which converts it to \mf (hence my use of \normalmathop in this
post as explained earlier).

EXAMPLE.
———————————————————————
\define\mathtextstyle{\rm\tf}
\define[1]\mtext{\text{\mathtextstyle #1}}

\define\mfunction{\dosingleempty\domfunction}
\def\domfunction[#1]#2{%
    \iffirstargument
        \doifelse{#1}{op}{\normalmathop{\text{\mathfunctionstyle
#2}}}{\doifelse{#1}{limop}{\normalmathop{\text{\mathfunctionstyle
#2}}}{\normalmathop{\text{\mathfunctionstyle #2}}\nolimits}}
    \else
        \normalmathop{\text{\mathfunctionstyle #2}}\nolimits
    \fi}

\define\mathfunctionstyle{\rm\tf}
\define\definemathfunction{\dodoubleempty\dodefinemathfunction}
\def\dodefinemathfunction[#1][#2]#3{%
    \ifsecondargument
        \definemathcommand[#1]{\mfunction[#2]{#3}}
    \else
        \definemathcommand[#1]{\mfunction{#3}}
    \fi}

\setupmathlabeltext[arsinh=Arsinh]
\definemathfunction[arsinh]{\mathlabeltext{arsinh}}

\starttext
\startbuffer
    $\arsinh x\ \text{and}\ n_{\mtext{air}}$
\stopbuffer

\defineparagraphs[myparagraphs][n=5, rule=on]
\setupparagraphs[myparagraphs][1][width=\dimexpr 0.3\textwidth\relax]
\setupparagraphs[myparagraphs][2][width=\dimexpr 0.3\textwidth\relax]
\setupparagraphs[myparagraphs][3][width=\dimexpr 0.3\textwidth\relax]

\section{{\tt \backslash setupmathematics[functionstyle=\backslash
rm\backslash tf,textstyle=\backslash rm\backslash tf]} (default setup)}
\define\mathfunctionstyle{\rm\tf}
\define\mathtextstyle{\rm\tf}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs

\section{{\tt \backslash setupmathematics[functionstyle=\backslash
tf,textstyle=\backslash tf]}}
\define\mathfunctionstyle{\tf}
\define\mathtextstyle{\tf}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs

\section{{\tt \backslash setupmathematics[functionstyle=\backslash
bf,textstyle=\backslash bf]}}
\define\mathfunctionstyle{\bf}
\define\mathtextstyle{\bf}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs
\stoptext
———————————————————————

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

[-- Attachment #1.2: Type: text/html, Size: 28669 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-12 14:19 Maggyero
  2015-05-12 16:03 ` Hans Hagen
  2015-05-12 18:05 ` Aditya Mahajan
@ 2015-05-12 20:23 ` Aditya Mahajan
  2 siblings, 0 replies; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-12 20:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-12 18:05 ` Aditya Mahajan
@ 2015-05-12 18:29   ` Mikael P. Sundqvist
  0 siblings, 0 replies; 34+ messages in thread
From: Mikael P. Sundqvist @ 2015-05-12 18:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, May 12, 2015 at 8:05 PM, Aditya Mahajan <adityam@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-12 14:19 Maggyero
  2015-05-12 16:03 ` Hans Hagen
@ 2015-05-12 18:05 ` Aditya Mahajan
  2015-05-12 18:29   ` Mikael P. Sundqvist
  2015-05-12 20:23 ` Aditya Mahajan
  2 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-12 18:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-12 14:19 Maggyero
@ 2015-05-12 16:03 ` Hans Hagen
  2015-05-12 18:05 ` Aditya Mahajan
  2015-05-12 20:23 ` Aditya Mahajan
  2 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-12 16:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 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 case it becomes simply \mathop{\text{\tf sin}} or
> equivalently  but better: \mathop{\mathlabel{sin}} with
> \setupmathematics[mathlabelstyle=\tf].
>
> About \mathupright: it is just a wrapper for \rm\tf. Better use
> \text{\rm\tf} or equivalently \mathop{\mathlabel{}} with
> \setupmathematics[mathlabelstyle=\rm\tf].
>
> Here is a little example showing the behaviour of the new command
> \mathlabel defined above:
>
>
> \define\mathlabelstyle{\tf} % I don't have access to the last beta yet
> so let's assume that the key 'mathlabelstyle' (called by Hans
> 'functionstyle' so far) of \setupmathematics is implemented this way,
> with the default value \tf (Aditya prefers \rm\tf as the default value
> so it is just a matter of taste).
> \define[1]\mathlabel{\text{\mathlabelstyle #1}}
>
> \define\function{\dosingleempty\dofunction}
> \def\dofunction[#1]#2{%
>      \iffirstargument
>
> \doifelse{#1}{limop}{\mathlimop{\mathlabel{#2}}}{\mathop{\mathlabel{#2}}}
>      \else
>          \mathop{\mathlabel{#2}}
>      \fi}

changing anything to the definition of mfunction around tl code freeze 
is asking for problems .. i'll added

\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]

> \definemathcommand[arsinh][op]{\mathlabel{arsinh}}
>
> \startbuffer
>      $\arsinh x\ \text{and}\ n_{\mathlabel{red}}$
> \stopbuffer
>
> \starttext
> \defineparagraphs[myparagraphs][n=5, rule=on]
> \setupparagraphs[myparagraphs][1][width=\dimexpr 0.3\textwidth\relax]
> \setupparagraphs[myparagraphs][2][width=\dimexpr 0.3\textwidth\relax]
> \setupparagraphs[myparagraphs][3][width=\dimexpr 0.3\textwidth\relax]
>
> \section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash tf]}
> (default)}
>
> \startmyparagraphs
> \switchtobodyfont[rm]
> {\tt \backslash switchtobodyfont[rm]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[ss]
> {\tt \backslash switchtobodyfont[ss]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[tt]
> {\tt \backslash switchtobodyfont[tt]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \stopmyparagraphs
>
> \section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash
> rm\backslash tf]} (Aditya's setup)}
> \define\mathlabelstyle{\rm\tf}
>
> \startmyparagraphs
> \switchtobodyfont[rm]
> {\tt \backslash switchtobodyfont[rm]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[ss]
> {\tt \backslash switchtobodyfont[ss]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[tt]
> {\tt \backslash switchtobodyfont[tt]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \stopmyparagraphs
>
> \section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash bf]}}
> \define\mathlabelstyle{\bf}
>
> \startmyparagraphs
> \switchtobodyfont[rm]
> {\tt \backslash switchtobodyfont[rm]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[ss]
> {\tt \backslash switchtobodyfont[ss]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \nextmyparagraphs
>
> \switchtobodyfont[tt]
> {\tt \backslash switchtobodyfont[tt]}\crlf
> {\tt \backslash tf}: {\tf \getbuffer}\par
> {\tt \backslash bf}: {\bf \getbuffer}\par
> {\tt \backslash it}: {\it \getbuffer}\par
> {\tt \backslash bi}: {\bi \getbuffer}\par
> {\tt \backslash sl}: {\sl \getbuffer}\par
> {\tt \backslash bs}: {\bs \getbuffer}\par
> \stopmyparagraphs
> \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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Changing font for math function
@ 2015-05-12 14:19 Maggyero
  2015-05-12 16:03 ` Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Maggyero @ 2015-05-12 14:19 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 10087 bytes --]

>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 case it becomes simply \mathop{\text{\tf sin}} or
equivalently  but better: \mathop{\mathlabel{sin}} with
\setupmathematics[mathlabelstyle=\tf].

About \mathupright: it is just a wrapper for \rm\tf. Better use
\text{\rm\tf} or equivalently \mathop{\mathlabel{}} with
\setupmathematics[mathlabelstyle=\rm\tf].

Here is a little example showing the behaviour of the new command
\mathlabel defined above:


\define\mathlabelstyle{\tf} % I don't have access to the last beta yet so
let's assume that the key 'mathlabelstyle' (called by Hans 'functionstyle'
so far) of \setupmathematics is implemented this way, with the default
value \tf (Aditya prefers \rm\tf as the default value so it is just a
matter of taste).
\define[1]\mathlabel{\text{\mathlabelstyle #1}}

\define\function{\dosingleempty\dofunction}
\def\dofunction[#1]#2{%
    \iffirstargument

\doifelse{#1}{limop}{\mathlimop{\mathlabel{#2}}}{\mathop{\mathlabel{#2}}}
    \else
        \mathop{\mathlabel{#2}}
    \fi}

\definemathcommand[arsinh][op]{\mathlabel{arsinh}}

\startbuffer
    $\arsinh x\ \text{and}\ n_{\mathlabel{red}}$
\stopbuffer

\starttext
\defineparagraphs[myparagraphs][n=5, rule=on]
\setupparagraphs[myparagraphs][1][width=\dimexpr 0.3\textwidth\relax]
\setupparagraphs[myparagraphs][2][width=\dimexpr 0.3\textwidth\relax]
\setupparagraphs[myparagraphs][3][width=\dimexpr 0.3\textwidth\relax]

\section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash tf]}
(default)}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs

\section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash
rm\backslash tf]} (Aditya's setup)}
\define\mathlabelstyle{\rm\tf}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs

\section{{\tt \backslash setupmathematics[mathlabelstyle=\backslash bf]}}
\define\mathlabelstyle{\bf}

\startmyparagraphs
\switchtobodyfont[rm]
{\tt \backslash switchtobodyfont[rm]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[ss]
{\tt \backslash switchtobodyfont[ss]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\nextmyparagraphs

\switchtobodyfont[tt]
{\tt \backslash switchtobodyfont[tt]}\crlf
{\tt \backslash tf}: {\tf \getbuffer}\par
{\tt \backslash bf}: {\bf \getbuffer}\par
{\tt \backslash it}: {\it \getbuffer}\par
{\tt \backslash bi}: {\bi \getbuffer}\par
{\tt \backslash sl}: {\sl \getbuffer}\par
{\tt \backslash bs}: {\bs \getbuffer}\par
\stopmyparagraphs
\stoptext


Maggyero

[-- Attachment #1.2: Type: text/html, Size: 12326 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11 17:08                 ` Aditya Mahajan
@ 2015-05-11 19:28                   ` Hans Hagen
  0 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-11 19:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11 16:44               ` Hans Hagen
@ 2015-05-11 17:08                 ` Aditya Mahajan
  2015-05-11 19:28                   ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-11 17:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11 16:16             ` Aditya Mahajan
@ 2015-05-11 16:44               ` Hans Hagen
  2015-05-11 17:08                 ` Aditya Mahajan
  0 siblings, 1 reply; 34+ messages in thread
From: Hans Hagen @ 2015-05-11 16:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-10 17:22           ` Hans Hagen
@ 2015-05-11 16:16             ` Aditya Mahajan
  2015-05-11 16:44               ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-11 16:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11  8:05               ` Hans Hagen
@ 2015-05-11  8:33                 ` Otared Kavian
  0 siblings, 0 replies; 34+ messages in thread
From: Otared Kavian @ 2015-05-11  8:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <pragma@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11  7:07             ` Otared Kavian
@ 2015-05-11  8:05               ` Hans Hagen
  2015-05-11  8:33                 ` Otared Kavian
  0 siblings, 1 reply; 34+ messages in thread
From: Hans Hagen @ 2015-05-11  8:05 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-11  2:47           ` Aditya Mahajan
@ 2015-05-11  7:07             ` Otared Kavian
  2015-05-11  8:05               ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Otared Kavian @ 2015-05-11  7:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <adityam@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-10 16:16         ` Otared Kavian
@ 2015-05-11  2:47           ` Aditya Mahajan
  2015-05-11  7:07             ` Otared Kavian
  0 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-11  2:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-10 12:19         ` Aditya Mahajan
@ 2015-05-10 17:22           ` Hans Hagen
  2015-05-11 16:16             ` Aditya Mahajan
  0 siblings, 1 reply; 34+ messages in thread
From: Hans Hagen @ 2015-05-10 17:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 23:30       ` Hans Hagen
  2015-05-10 12:19         ` Aditya Mahajan
@ 2015-05-10 16:16         ` Otared Kavian
  2015-05-11  2:47           ` Aditya Mahajan
  1 sibling, 1 reply; 34+ messages in thread
From: Otared Kavian @ 2015-05-10 16:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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...
\483>limop #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 <pragma@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 23:30       ` Hans Hagen
@ 2015-05-10 12:19         ` Aditya Mahajan
  2015-05-10 17:22           ` Hans Hagen
  2015-05-10 16:16         ` Otared Kavian
  1 sibling, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-10 12:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 14:16     ` Aditya Mahajan
@ 2015-05-09 23:30       ` Hans Hagen
  2015-05-10 12:19         ` Aditya Mahajan
  2015-05-10 16:16         ` Otared Kavian
  0 siblings, 2 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-09 23:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 13:00     ` Hans Hagen
@ 2015-05-09 16:28       ` Wolfgang Schuster
  0 siblings, 0 replies; 34+ messages in thread
From: Wolfgang Schuster @ 2015-05-09 16:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1944 bytes --]


> Am 09.05.2015 um 15:00 schrieb Hans Hagen <pragma@wxs.nl>:
> 
> On 5/9/2015 1:56 PM, Wolfgang Schuster wrote:
>> 
>>> Am 09.05.2015 um 13:46 schrieb Hans Hagen <pragma@wxs.nl <mailto:pragma@wxs.nl>
>>> <mailto:pragma@wxs.nl <mailto:pragma@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

[-- Attachment #1.2: Type: text/html, Size: 8129 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 13:50   ` Aditya Mahajan
@ 2015-05-09 14:16     ` Aditya Mahajan
  2015-05-09 23:30       ` Hans Hagen
  0 siblings, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-09 14:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 11:46 ` Hans Hagen
  2015-05-09 11:56   ` Wolfgang Schuster
@ 2015-05-09 13:50   ` Aditya Mahajan
  2015-05-09 14:16     ` Aditya Mahajan
  1 sibling, 1 reply; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-09 13:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 11:56   ` Wolfgang Schuster
@ 2015-05-09 13:00     ` Hans Hagen
  2015-05-09 16:28       ` Wolfgang Schuster
  0 siblings, 1 reply; 34+ messages in thread
From: Hans Hagen @ 2015-05-09 13:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 5/9/2015 1:56 PM, Wolfgang Schuster wrote:
>
>> Am 09.05.2015 um 13:46 schrieb Hans Hagen <pragma@wxs.nl
>> <mailto:pragma@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09 11:46 ` Hans Hagen
@ 2015-05-09 11:56   ` Wolfgang Schuster
  2015-05-09 13:00     ` Hans Hagen
  2015-05-09 13:50   ` Aditya Mahajan
  1 sibling, 1 reply; 34+ messages in thread
From: Wolfgang Schuster @ 2015-05-09 11:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]


> Am 09.05.2015 um 13:46 schrieb Hans Hagen <pragma@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

[-- Attachment #1.2: Type: text/html, Size: 4701 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09  0:03 Aditya Mahajan
  2015-05-09 10:14 ` Hans Hagen
  2015-05-09 11:02 ` Wolfgang Schuster
@ 2015-05-09 11:46 ` Hans Hagen
  2015-05-09 11:56   ` Wolfgang Schuster
  2015-05-09 13:50   ` Aditya Mahajan
  2 siblings, 2 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-09 11:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09  0:03 Aditya Mahajan
  2015-05-09 10:14 ` Hans Hagen
@ 2015-05-09 11:02 ` Wolfgang Schuster
  2015-05-09 11:46 ` Hans Hagen
  2 siblings, 0 replies; 34+ messages in thread
From: Wolfgang Schuster @ 2015-05-09 11:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 09.05.2015 um 02:03 schrieb Aditya Mahajan <adityam@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: Changing font for math function
  2015-05-09  0:03 Aditya Mahajan
@ 2015-05-09 10:14 ` Hans Hagen
  2015-05-09 11:02 ` Wolfgang Schuster
  2015-05-09 11:46 ` Hans Hagen
  2 siblings, 0 replies; 34+ messages in thread
From: Hans Hagen @ 2015-05-09 10:14 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Changing font for math function
@ 2015-05-09  0:03 Aditya Mahajan
  2015-05-09 10:14 ` Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Aditya Mahajan @ 2015-05-09  0:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2015-05-16 15:35 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 15:18 Changing font for math function Maggyero
  -- strict thread matches above, loose matches on Subject: below --
2015-05-16 14:23 Maggyero
2015-05-16 15:35 ` Hans Hagen
2015-05-15 23:34 Maggyero
2015-05-16  0:24 ` Aditya Mahajan
2015-05-16  8:23   ` Hans Hagen
2015-05-13 15:51 Maggyero
2015-05-13 16:13 ` Hans Hagen
2015-05-12 14:19 Maggyero
2015-05-12 16:03 ` Hans Hagen
2015-05-12 18:05 ` Aditya Mahajan
2015-05-12 18:29   ` Mikael P. Sundqvist
2015-05-12 20:23 ` Aditya Mahajan
2015-05-09  0:03 Aditya Mahajan
2015-05-09 10:14 ` Hans Hagen
2015-05-09 11:02 ` Wolfgang Schuster
2015-05-09 11:46 ` Hans Hagen
2015-05-09 11:56   ` Wolfgang Schuster
2015-05-09 13:00     ` Hans Hagen
2015-05-09 16:28       ` Wolfgang Schuster
2015-05-09 13:50   ` Aditya Mahajan
2015-05-09 14:16     ` Aditya Mahajan
2015-05-09 23:30       ` Hans Hagen
2015-05-10 12:19         ` Aditya Mahajan
2015-05-10 17:22           ` Hans Hagen
2015-05-11 16:16             ` Aditya Mahajan
2015-05-11 16:44               ` Hans Hagen
2015-05-11 17:08                 ` Aditya Mahajan
2015-05-11 19:28                   ` Hans Hagen
2015-05-10 16:16         ` Otared Kavian
2015-05-11  2:47           ` Aditya Mahajan
2015-05-11  7:07             ` Otared Kavian
2015-05-11  8:05               ` Hans Hagen
2015-05-11  8:33                 ` Otared Kavian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).