* Multi-letter words/identifiers in math
@ 2019-09-29 7:30 Shuxian Wang
2019-09-30 13:22 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Shuxian Wang @ 2019-09-29 7:30 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 1727 bytes --]
Dear list,
I am trying to typeset some multi-letter words/identifiers in
mathematical formulas. Currently, doing things like `{\it variable}` or
`{\mathit variable}` under math mode will cause the engine to shift all
characters into the corresponding unicode mathematical alphanumeric
block position. However, most OpenType fonts that have good support for
unicode math are optimized for single-character usage. Therefore, the
outcome of such method is non-ideal, as no kerning or ligatures will be
enabled. Especially, this gives bad output when typesetting variable
names with combinations like “ffi”.
Looking through some past discussions on the list, I am aware of the
usage of `\mathword` and `\mathtext`. Using those command will keep all
the characters “as is” and typeset them under text mode (as far as I
can tell). But those commands switch to the main body fonts temporarily
to accomplish this. Sometime when using a different math font than the
main font (like Palatino with Latin Modern Math), I wish my variable
names can also be in the math font (or at least very similar, such as
Latin Modern vs. Latin Modern Math) to better merge with the formula.
The way I am currently doing is to introduce some “math text fonts”
that is different from the main text font but close to the math font.
And with custom font switchers like `\mwrm` and `\mwit` to help me
define things like
```
\def\wordrm#1{\mbox{\mwrm #1}}
\def\wordit#1{\mbox{\mwit #1}}
```
Am I missing some builtin functionalities or easier ways to do this? If
not, would it be a good idea to extend the functionality of `\mathword`
so it lifts out the restriction of only using the main text font?
Thanks!
Shuxian Wang
[-- Attachment #1.2: Type: text/html, Size: 2936 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Multi-letter words/identifiers in math
2019-09-29 7:30 Multi-letter words/identifiers in math Shuxian Wang
@ 2019-09-30 13:22 ` Hans Hagen
[not found] ` <CAA58SD99+xNeyEPQGU6ELHurO35+RVDUTjUanSfG5xMJnweHJA@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2019-09-30 13:22 UTC (permalink / raw)
To: mailing list for ConTeXt users, Shuxian Wang
On 9/29/2019 9:30 AM, Shuxian Wang wrote:
> Dear list,
>
> I am trying to typeset some multi-letter words/identifiers in
> mathematical formulas. Currently, doing things like |{\it variable}| or
> |{\mathit variable}| under math mode will cause the engine to shift all
> characters into the corresponding unicode mathematical alphanumeric
> block position. However, most OpenType fonts that have good support for
> unicode math are optimized for single-character usage. Therefore, the
> outcome of such method is non-ideal, as no kerning or ligatures will be
> enabled. Especially, this gives bad output when typesetting variable
> names with combinations like “ffi”.
>
> Looking through some past discussions on the list, I am aware of the
> usage of |\mathword| and |\mathtext|. Using those command will keep all
> the characters “as is” and typeset them under text mode (as far as I can
> tell). But those commands switch to the main body fonts temporarily to
> accomplish this. Sometime when using a different math font than the main
> font (like Palatino with Latin Modern Math), I wish my variable names
> can also be in the math font (or at least very similar, such as Latin
> Modern vs. Latin Modern Math) to better merge with the formula.
>
> The way I am currently doing is to introduce some “math text fonts” that
> is different from the main text font but close to the math font. And
> with custom font switchers like |\mwrm| and |\mwit| to help me define
> things like
> |
> \def\wordrm#1{\mbox{\mwrm #1}}
> \def\wordit#1{\mbox{\mwit #1}}
> |
> Am I missing some builtin functionalities or easier ways to do this? If
> not, would it be a good idea to extend the functionality of |\mathword|
> so it lifts out the restriction of only using the main text font?
maybe \mfunction{...} is what you are looking for
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Multi-letter words/identifiers in math
[not found] ` <CAA58SD99+xNeyEPQGU6ELHurO35+RVDUTjUanSfG5xMJnweHJA@mail.gmail.com>
@ 2019-10-01 17:28 ` Hans Hagen
0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2019-10-01 17:28 UTC (permalink / raw)
To: Shuxian Wang, mailing list for ConTeXt users
On 10/1/2019 6:52 PM, Shuxian Wang wrote:
> Thanks Hans!
>
> Your suggestion does partially solve the problem, but it seems that
> `\mfunction` internally called `\rm` to set upright Roman font in math
> mode. Does achieving the same effects (text-like kerning) for italics
> and bold style still requires custom fonts?
It depends on the font. A proper opentype math font should have at least
the basic latin characters for test and these then if needed will have
kerns and such.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-01 17:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29 7:30 Multi-letter words/identifiers in math Shuxian Wang
2019-09-30 13:22 ` Hans Hagen
[not found] ` <CAA58SD99+xNeyEPQGU6ELHurO35+RVDUTjUanSfG5xMJnweHJA@mail.gmail.com>
2019-10-01 17:28 ` Hans Hagen
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).