Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In some parts of my document, I have text inside of math mode, to position text, e.g.:

\math{
    \overset{
        \text{This text is above.}
    }
    {
        \text{This text is below.}
    }
}

I found that any text placed inside \text{} inside \math{} will appear using the Serif body font, even within environments defined as Sans Serif, e.g.:

\starttypescript[serif][stsong]
    \definefontsynonym[stsong][name:stsong][features=chinese]
\stoptypescript

\starttypescript[sans][stheiti]
    \definefontsynonym[stheiti][name:stheiti][features=chinese]
\stoptypescript

\starttypescript[serif][stsong]
    \definefontsynonym[Serif][stsong][features=chinese]
\stoptypescript

\starttypescript[sans][stheiti]
    \definefontsynonym[Sans][stheiti][features=chinese]
\stoptypescript

\definetypeface[stsong][rm][serif][stsong]
\definetypeface[stheiti][ss][sans][stheiti]

\setupbodyfont[stsong, 12pt]
\starttext
    {\stheiti This is some text.\math{\text{This is some more text.}}This is yet some more text.}
\stoptext
  • Placing font definitions inside \text{}, such as \text{\stheiti Text.} is not a good solution, because much of this text is in macros which can appear in different places, such as in San Serif chapter titles, or in the main Serif text of the document.
  • Setting a single font for math mode will also not be suitable for the same reason.

How can I set the font inside text mode inside math mode to the font of the text surrounding it?

share|improve this question
    
The behavior you want is the default with \text in amsmath for LaTeX. Probably ConTeXt is trying to be too smart. :) –  egreg Oct 20 '12 at 23:44
    
I agree with @egreg. This is a bug in ConTeXt's implementation of \text. But why are you using math mode for aligning text? What exactly do you want to do? There are better solutions than resorting to math mode for alignment. –  Aditya Oct 21 '12 at 2:05
    
Your example works correctly for me producing fonts inside the \text command matching those of the surrounding text. I have ConTeXt ver: 2012.05.30 11:26 MKIV fmt: 2012.8.21 int: english/english. –  Andrew Swann Oct 23 '12 at 9:56
add comment

1 Answer 1

up vote 4 down vote accepted

It was a regression bug in ConTeXt. As Andrew Swann said, it worked correctly with MkIV fmt 2012.8.21 and now it also works correctly with MkIV 2012.10.22. Below is a minimal example:

\starttext
\startTEXpage[offset=3mm]
\switchtobodyfont[sans]
\math{
    \overset{
        \text{This text is above.}
    }
    {
        \text{This text is below.}
    }
}
\stopTEXpage
\stoptext

which gives

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.