ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Maggyero <maggyero@gmail.com>
To: ntg-context@ntg.nl
Subject: Changing font for math function
Date: Sat, 16 May 2015 01:34:50 +0200	[thread overview]
Message-ID: <CAJ2CwZ3kbp8S16uCay2vKCHcNZOGj0FXjuB5nMqspubJDJAgVQ@mail.gmail.com> (raw)


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

             reply	other threads:[~2015-05-15 23:34 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 23:34 Maggyero [this message]
2015-05-16  0:24 ` Aditya Mahajan
2015-05-16  8:23   ` Hans Hagen
  -- strict thread matches above, loose matches on Subject: below --
2015-05-16 14:23 Maggyero
2015-05-16 15:35 ` Hans Hagen
2015-05-13 15:51 Maggyero
2015-05-13 16:13 ` Hans Hagen
2015-05-12 15:18 Maggyero
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ2CwZ3kbp8S16uCay2vKCHcNZOGj0FXjuB5nMqspubJDJAgVQ@mail.gmail.com \
    --to=maggyero@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).