ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* math: \text does not scale properly
@ 2012-10-04  7:10 Andreas Mang
  2012-10-04  7:27 ` Alan BRASLAU
  2012-10-21  2:20 ` Aditya Mahajan
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Mang @ 2012-10-04  7:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi there,

As Aditya mentioned in a former posting (*) that "\text{ ... }" should scale properly when used as super- or subscript, I have prepared a minimal example to demonstrate that it doesn't. In my document I have switched from "\text{ }" to "\normal", which works.

Kind regards,
Andreas

ConTeXt  ver: 2012.09.25 21:44 MKIV  fmt: 2012.10.1

%% MINIMAL EXAMPLE
\setupbodyfont[xits]

\starttext

$f_{\text{text}_{\text{text}_{\text{text}}}}$

$f_{{\normal text}_{{\normal text}_{\normal text}}}$

\stoptext
%% MINIMAL EXAMPLE

(*) see "[NTG-context] punctuation vs font switch"


___________________________________________________________________________________
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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-04  7:10 math: \text does not scale properly Andreas Mang
@ 2012-10-04  7:27 ` Alan BRASLAU
  2012-10-04  7:49   ` Andreas Mang
  2012-10-21  2:20 ` Aditya Mahajan
  1 sibling, 1 reply; 8+ messages in thread
From: Alan BRASLAU @ 2012-10-04  7:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 4 Oct 2012 09:10:17 +0200
Andreas Mang <mang@imt.uni-luebeck.de> wrote:

> Hi there,
> 
> As Aditya mentioned in a former posting (*) that "\text{ ... }"
> should scale properly when used as super- or subscript, I have
> prepared a minimal example to demonstrate that it doesn't. In my
> document I have switched from "\text{ }" to "\normal", which works.
> 
> Kind regards,
> Andreas
> 
> ConTeXt  ver: 2012.09.25 21:44 MKIV  fmt: 2012.10.1
> 
> %% MINIMAL EXAMPLE
> \setupbodyfont[xits]
> 
> \starttext
> 
> $f_{\text{text}_{\text{text}_{\text{text}}}}$
> 
> $f_{{\normal text}_{{\normal text}_{\normal text}}}$
> 
> \stoptext
> %% MINIMAL EXAMPLE
> 
> (*) see "[NTG-context] punctuation vs font switch"

Hello,

I generally use \mathrm{} (maybe this is a leftover from LaTeX
practice), and this works fine.

Alan


\setupbodyfont [xits]
\starttext
$f_{\mathrm{text}_{\mathrm{text}_{\mathrm{text}}}}$

$f_{{\normal text}_{{\normal text}_{\normal text}}}$
\stoptext
___________________________________________________________________________________
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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-04  7:27 ` Alan BRASLAU
@ 2012-10-04  7:49   ` Andreas Mang
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Mang @ 2012-10-04  7:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Alan,

thanks for your help. That's indeed an option, but not much of a difference to using "\normal" I suppose.

In addition, "\text" has the nice feature of preserving the space character, which makes it very useful for lazy people (of course I can add "\," and friends but...).

Cheers,
Andreas

ConTeXt  ver: 2012.09.25 21:44 MKIV  fmt: 2012.10.1

%%%%%%%%%%%% MINIMAL EXAMPLE %%%%%%%%%%%% 
\setupbodyfont[xits]

\starttext

$f_{\mathrm{text and text}_{\mathrm{text and text}_{\mathrm{text and text}}}}$

$f_{\text{text and text}_{\text{text and text}_{\text{text and text}}}}$

$f_{{\normal text}_{{\normal text}_{\normal text}}}$

\stoptext
%%%%%%%%%%%% MINIMAL EXAMPLE %%%%%%%%%%%% 




Am Oct 4, 2012 um 9:27 AM schrieb Alan BRASLAU:

> On Thu, 4 Oct 2012 09:10:17 +0200
> Andreas Mang <mang@imt.uni-luebeck.de> wrote:
> 
>> Hi there,
>> 
>> As Aditya mentioned in a former posting (*) that "\text{ ... }"
>> should scale properly when used as super- or subscript, I have
>> prepared a minimal example to demonstrate that it doesn't. In my
>> document I have switched from "\text{ }" to "\normal", which works.
>> 
>> Kind regards,
>> Andreas
>> 
>> ConTeXt  ver: 2012.09.25 21:44 MKIV  fmt: 2012.10.1
>> 
>> %% MINIMAL EXAMPLE
>> \setupbodyfont[xits]
>> 
>> \starttext
>> 
>> $f_{\text{text}_{\text{text}_{\text{text}}}}$
>> 
>> $f_{{\normal text}_{{\normal text}_{\normal text}}}$
>> 
>> \stoptext
>> %% MINIMAL EXAMPLE
>> 
>> (*) see "[NTG-context] punctuation vs font switch"
> 
> Hello,
> 
> I generally use \mathrm{} (maybe this is a leftover from LaTeX
> practice), and this works fine.
> 
> Alan
> 
> 
> \setupbodyfont [xits]
> \starttext
> $f_{\mathrm{text}_{\mathrm{text}_{\mathrm{text}}}}$
> 
> $f_{{\normal text}_{{\normal text}_{\normal text}}}$
> \stoptext

___________________________________________________________________________________
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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-04  7:10 math: \text does not scale properly Andreas Mang
  2012-10-04  7:27 ` Alan BRASLAU
@ 2012-10-21  2:20 ` Aditya Mahajan
  2012-10-21  2:35   ` Aditya Mahajan
  1 sibling, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2012-10-21  2:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 4 Oct 2012, Andreas Mang wrote:

> Hi there,
>
> As Aditya mentioned in a former posting (*) that "\text{ ... }" should 
> scale properly when used as super- or subscript, I have prepared a 
> minimal example to demonstrate that it doesn't. In my document I have 
> switched from "\text{ }" to "\normal", which works.

There is another bug with \text.

{\switchtobodyfont[sans] $\text{sans}$}

does not switch to sans font. Both the incorrect scaling and wrong font 
switch can be corrected by restoring the old definition of \text in 
math-ini.mkiv. Based on the comments in that file, this will come at a 
high penalty on speed. (Slow but correct is better than fast but wrong!)

\unprotect
\def\math_text_choice_indeed#1#2#3% no \everymath !
   {\hbox{\everymath{#1}\switchtobodyfont  [#2]#3}} % 15 sec
  %{\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} %  3 sec (no math)

\protect

%% Example

\starttext
$f_{\text{text $a+b$}_{\text{text $a+b$}_{\text{text $a+b$}}}}$

{\switchtobodyfont[sans] $f_{\text{text $a+b$}_{\text{text 
$a+b$}_{\text{text $a+b$}}}}$}

$f_{{\normal text}_{{\normal text}_{\normal text}}}$


\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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-21  2:20 ` Aditya Mahajan
@ 2012-10-21  2:35   ` Aditya Mahajan
  2012-10-21 13:42     ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2012-10-21  2:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 20 Oct 2012, Aditya Mahajan wrote:

> On Thu, 4 Oct 2012, Andreas Mang wrote:
>
>> Hi there,
>> 
>> As Aditya mentioned in a former posting (*) that "\text{ ... }" should 
>> scale properly when used as super- or subscript, I have prepared a minimal 
>> example to demonstrate that it doesn't. In my document I have switched from 
>> "\text{ }" to "\normal", which works.
>
> There is another bug with \text.

Actually, the bug is with \setcurrentfontbody

\starttext
ABC \hbox{\setcurrentfontbody{\scriptscriptface} Testing} DEF
\stoptext

The above works correctly in mkii but not in mkiv. I really don't 
understand what \setcurrentfontbody is supposed to do. In Mkii it scales 
the bodyfont if \scriptface or \scriptscriptface is used as an argument; 
but does not work for any other value (e.g. \setcurrentfontbody{20pt}). In 
MkIV it does not do anything.

There is also a bug in the definition of \text in mkii. In strc-mat.mkii, 
we should have

\def\domathtext#1%
   {\mathchoice
      {\dodomathtext\displaystyle        \textface        {#1}}%
      {\dodomathtext\textstyle           \textface        {#1}}%
      {\dodomathtext\scriptstyle         \scriptface      {#1}}%
      {\dodomathtext\scriptscriptstyle   \scriptscriptface{#1}}}


Notice \scriptsctlye and \scriptscriptstyle instead of \textstyle in the 
last two cases. If \setcurrentfontbody is fixed in mkiv, then the 
definition in MkIV also needs to be changed in a similar manner.

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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-21  2:35   ` Aditya Mahajan
@ 2012-10-21 13:42     ` Hans Hagen
  2012-10-24  4:06       ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2012-10-21 13:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 21-10-2012 04:35, Aditya Mahajan wrote:
> On Sat, 20 Oct 2012, Aditya Mahajan wrote:
>
>> On Thu, 4 Oct 2012, Andreas Mang wrote:
>>
>>> Hi there,
>>>
>>> As Aditya mentioned in a former posting (*) that "\text{ ... }"
>>> should scale properly when used as super- or subscript, I have
>>> prepared a minimal example to demonstrate that it doesn't. In my
>>> document I have switched from "\text{ }" to "\normal", which works.
>>
>> There is another bug with \text.
>
> Actually, the bug is with \setcurrentfontbody
>
> \starttext
> ABC \hbox{\setcurrentfontbody{\scriptscriptface} Testing} DEF
> \stoptext
>
> The above works correctly in mkii but not in mkiv. I really don't
> understand what \setcurrentfontbody is supposed to do. In Mkii it scales
> the bodyfont if \scriptface or \scriptscriptface is used as an argument;
> but does not work for any other value (e.g. \setcurrentfontbody{20pt}).
> In MkIV it does not do anything.

How about:

\unprotect

\ifdefined\font_basics_switchtobodyfont\else
     \def\font_basics_switchtobodyfont#1{\switchtobodyfont[#1]}%
\fi

\def\mathstyleface#1% #1 is number (\normalmathstyle)
   {\ifcase#1\relax
      \textface         \or
      \textface         \or
      \textface         \or
      \textface         \or
      \scriptface       \or
      \scriptface       \or
      \scriptscriptface \or
      \scriptscriptface \else
      \textface
    \fi}

% For some reason mathfaces are not normalized .. why not?

% \let\m_math_text_choice_style\relax
%
% \def\math_text_choice#1%
%   {\edef\m_math_text_choice_style{\normalmathstyle}%
%    \hbox\bgroup
%    % \everymath{\triggermathstyle\m_math_text_choice_style}%
% 
\normalizebodyfontsize\m_math_text_choice_style{\mathstylefont\m_math_text_choice_style}%
%      \font_basics_switchtobodyfont\m_math_text_choice_style
%      #1%
%    \egroup}

\let\m_math_text_choice_face \relax

\def\math_text_choice#1%
 
{\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}%
    \hbox{\font_basics_switchtobodyfont\m_math_text_choice_face#1}}

\protect

\setupbodyfont[dejavu]

\starttext

\testfeatureonce{1000}{$f_{\text{text $a+b$}_{\text{text 
$a+b$}_{\text{text $a+b$}}}}$\par} % 2.7

\stoptext



> There is also a bug in the definition of \text in mkii. In
> strc-mat.mkii, we should have

ok, fixed,

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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-21 13:42     ` Hans Hagen
@ 2012-10-24  4:06       ` Aditya Mahajan
  2012-10-24  8:07         ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2012-10-24  4:06 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Sun, 21 Oct 2012, Hans Hagen wrote:

> On 21-10-2012 04:35, Aditya Mahajan wrote:
>> On Sat, 20 Oct 2012, Aditya Mahajan wrote:
>> 
>>> On Thu, 4 Oct 2012, Andreas Mang wrote:
>>> 
>>>> Hi there,
>>>> 
>>>> As Aditya mentioned in a former posting (*) that "\text{ ... }"
>>>> should scale properly when used as super- or subscript, I have
>>>> prepared a minimal example to demonstrate that it doesn't. In my
>>>> document I have switched from "\text{ }" to "\normal", which works.
>>> 
>>> There is another bug with \text.
>> 
> How about:
> [....]
>

I don't understand the fix, but it gives the correct output.

Thanks,
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] 8+ messages in thread

* Re: math: \text does not scale properly
  2012-10-24  4:06       ` Aditya Mahajan
@ 2012-10-24  8:07         ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2012-10-24  8:07 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

On 24-10-2012 06:06, Aditya Mahajan wrote:
> On Sun, 21 Oct 2012, Hans Hagen wrote:
>
>> On 21-10-2012 04:35, Aditya Mahajan wrote:
>>> On Sat, 20 Oct 2012, Aditya Mahajan wrote:
>>>
>>>> On Thu, 4 Oct 2012, Andreas Mang wrote:
>>>>
>>>>> Hi there,
>>>>>
>>>>> As Aditya mentioned in a former posting (*) that "\text{ ... }"
>>>>> should scale properly when used as super- or subscript, I have
>>>>> prepared a minimal example to demonstrate that it doesn't. In my
>>>>> document I have switched from "\text{ }" to "\normal", which works.
>>>>
>>>> There is another bug with \text.
>>>
>> How about:
>> [....]
>>
>
> I don't understand the fix, but it gives the correct output.

hm, given your involvement in math you should study it -)

it boils down to the fact that in luatex we can actually ask what the 
upcoming style can be (text, script, scriptscript)

normally a choice means 4 times processing and tex will use one only, 
while in this case i could write \text in a way that processes only once 
(so, way faster as we only have 1 bodyfont switch now)

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] 8+ messages in thread

end of thread, other threads:[~2012-10-24  8:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04  7:10 math: \text does not scale properly Andreas Mang
2012-10-04  7:27 ` Alan BRASLAU
2012-10-04  7:49   ` Andreas Mang
2012-10-21  2:20 ` Aditya Mahajan
2012-10-21  2:35   ` Aditya Mahajan
2012-10-21 13:42     ` Hans Hagen
2012-10-24  4:06       ` Aditya Mahajan
2012-10-24  8:07         ` 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).