math: \text does not scale properly
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"
On Thu, 4 Oct 2012 09:10:17 +0200
Andreas Mang
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
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
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
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
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
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 -----------------------------------------------------------------
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
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 -----------------------------------------------------------------
participants (4)
-
Aditya Mahajan
-
Alan BRASLAU
-
Andreas Mang
-
Hans Hagen