7

I often typeset formulas using TeX and friends. I noticed they are different between ConTeXt and plain TeX recently.

\starttext
\startformula
\int\nolimits_a^bf(x)dx=F(b)-F(a)
\stopformula
\stoptext 

the result produced by ConTeXt

Formulas in ConTeXt

$$\int_a^bf(x)dx=F(b)-F(a)$$
\bye

the result produced by LuaTex

Formulas in Plain TeX

Since ConTeXt uses LuaTeX as its engine, why do I get the different outputs? In my view, formulas produced by plain TeX are more beautiful.

Fonts loaded in LuaTeX

d:\typeset>luatex formulas.tex luatex formulas.tex This is LuaTeX, Version beta-0.77.0-2013041621 (rev 4633) \write18 enabled. (./formulas.tex (d:/context/tex/texmf-context/tex/generic/context/luatex/luatex-basics.tex) (d:/context/tex/texmf-context/tex/generic/context/luatex/luatex-fonts.tex (using cache: d:/context/tex/texmf-cache/luatex-cache/generic) ) (d:/context/tex/texmf-context/tex/generic/context/luatex/luatex-languages.tex) (d:/context/tex/texmf-context/tex/generic/context/luatex/luatex-mplib.tex) [1{d:/context/tex/texmf/fonts/map/pdftex/plain/pdftex.map}] ){d:/context/tex/texmf/fonts/enc/dvips/lm/lm-mathsy.enc}{d:/context/tex/texmf/fonts/enc/dvips/lm/lm-rep-cmrm.enc}{d:/cont ext/tex/texmf/fonts/enc/dvips/lm/lm-mathit.enc}{d:/context/tex/texmf/fonts/enc/dvips/lm/lm-mathex.enc} Output written on formulas.pdf (1 page, 33366 bytes). Transcript written on formulas.log.

Use modern-designsize-virtual typescript

\usetypescript[modern-designsize-virtual]
\setupbodyfont[modern-designsize-virtual,rm,10pt]
\starttext
\startformula
\int\nolimits_a^bf(x)dx=F(b)-F(a)
\stopformula
\stoptext

output(when using the modern-designsize-virtual typescript):

modern-designsize-virtual

output(when using plain luatex in context standalone)

Formulas in Plain TeX

still have some difference :-(

d:\typeset>pdffonts.exe context.pdf
pdffonts.exe context.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
JFRMQG+LMRoman10-Regular             CID Type 0C       yes yes yes     18  0
APMHZE+LMMathExtension10-Regular     Type 1            yes yes no      19  0
AWBTPY+LMMathItalic7-Regular         Type 1            yes yes no      20  0
ITITNI+LMMathItalic10-Regular        Type 1            yes yes no      21  0
JZHWIZ+LMRoman10-Regular             CID Type 0C       yes yes yes     22  0
MGKPYK+LMMathSymbols10-Regular       Type 1            yes yes no      23  0

d:\typeset>pdffonts.exe plain.pdf
pdffonts.exe plain.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
APMHZE+LMMathExtension10-Regular     Type 1            yes yes no       4  0
AWBTPY+LMMathItalic7-Regular         Type 1            yes yes no       5  0
ITITNI+LMMathItalic10-Regular        Type 1            yes yes no       6  0
DMNVHT+LMRoman10-Regular             Type 1            yes yes no       7  0
MGKPYK+LMMathSymbols10-Regular       Type 1            yes yes no       8  0
  • Two things: First, I prefer the spacing of the upper limit with Plain Tex, but the Context spacing is more consistent: I find it strange for the lower limit to have so much distance from the integral sign when the upper limit has so little. Less than 10/10 in both cases. Second, both examples seem now to be using exactly the same maths fonts: only the text fonts differ, so the trouble doesn't seem to be purely one of font contents. – Charles Stewart May 16 '13 at 8:27
  • With the 2010 build of Context from Texlive, I get results that look like your Plain Tex example for your example without \setupbodyfont, and the same list (except for object numbers) from pdffonts that you got with the \setupbodyfont. So there's a relevant difference between Context versions. – Charles Stewart May 16 '13 at 8:58
4

The PDF files generated with ConTeXt and plain TeX (using LuaTeX from ConTeXt standalone) use different fonts or at least different variants of Latin Modern. Here's the output of pdffonts:

pdffonts context.pdf

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
OLAZTU+LMRoman12-Regular             CID Type 0C       yes yes yes     18  0
RXHAAY+LatinModernMath-Regular       CID Type 0C       yes yes yes     19  0
JTHTZJ+LatinModernMath-Regular       CID Type 0C       yes yes yes     20  0

pdffonts plain.pdf

name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
APMHZE+LMMathExtension10-Regular     Type 1            yes yes no       4  0
AWBTPY+LMMathItalic7-Regular         Type 1            yes yes no       5  0
ITITNI+LMMathItalic10-Regular        Type 1            yes yes no       6  0
DMNVHT+LMRoman10-Regular             Type 1            yes yes no       7  0
MGKPYK+LMMathSymbols10-Regular       Type 1            yes yes no       8  0

This explains the slightly different visual appearance. In order to use the same font in ConTeXt use \setupbodyfont[modern-designsize-virtual]:

\setupbodyfont [modern-designsize-virtual]
\starttext
  \startformula
    \int\nolimits_a^bf(x)dx=F(b)-F(a)
  \stopformula
\stoptext
  • Thanks, Marco. I don't have a good knowledge of fonts in TeX and is there a simple way to make the context output the same result with the plain luatex? – Lucas Li May 10 '13 at 14:27
  • @TimothyLi See my edit. – Marco May 10 '13 at 14:53
  • Yeah! I am so glad that I get the same formula output when using the method you give. Many thanks :-) – Lucas Li May 10 '13 at 14:57
  • by the way, why can I not find this font by using mtxrun --script fonts --list --all --pattern=modern* and how do you find this font? – Lucas Li May 10 '13 at 15:01
  • The font name is LMMathItalic7-Regular according to the pdffonts outout (see my answer), that means you need the pattern lmmathitalic. The argument for \setupbodyfont can be found in the typescript file type-imp-latinmodern.mkiv. – Marco May 10 '13 at 15:07
5

If you modify your examples to look like

\starttext
\tracingoutput1
\showboxbreadth\maxdimen
\showboxdepth\maxdimen
\errorstopmode
\startformula
\int\nolimits_a^bf(x)dx=F(b)-F(a)
\stopformula
\stoptext 

and

\tracingoutput1
\showboxbreadth\maxdimen
\showboxdepth\maxdimen
\errorstopmode
$$\int_a^bf(x)dx=F(b)-F(a)$$
\bye

You'll see they are using different fonts and different characters. Plain (pdf)tex is of course using computer modern math italic and related fonts and for example x is x:

...\tenrm (
...\teni x
...\tenrm )

Context is using latin modern and the math italic from the Unicode Math Alphabet block

...................\3>modern-designsize-12pt-mm-mb--1 (
...................\3>modern-designsize-12pt-mm-mb--1 𝑥
...................\3>modern-designsize-12pt-mm-mb--1 )

Your plain tex seems to have picked up a latin modern configuration, on the terminal I get

$ luatex ct112
This is LuaTeX, Version beta-0.70.2-2012062812 (TeX Live 2012)
 restricted \write18 enabled.
(./ct112.tex

Completed box being shipped out [1]{/usr/local/texlive/2012/texmf-var/fonts/map
/pdftex/updmap/pdftex.map} )
(see the transcript file for additional information)</usr/local/texlive/2012/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/local/texlive/2012/tex
mf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/local/texlive/2012/texm
f-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/local/texlive/2012/texmf-
dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/local/texlive/2012/texmf-di
st/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on ct112.pdf (1 page, 38936 bytes).
Transcript written on ct112.log.

Note that it is just using the AMS type 1 versions of computer modern.

whereas the log on the context example includes

mkiv lua stats  > loaded fonts              - 33 files: stmary10.afm lmmono12-
regular.otf lmmono8-regular.otf lmmono9-regular.otf lmroman12-bold.otf lmroman12-
regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf 
lmsans12-regular.otf lmsans8-regular.otf lmsans9-regular.otf eufb10.tfm eufb7.tfm 
eufm10.tfm eufm7.tfm msam10.tfm msam7.tfm msbm10.tfm msbm7.tfm lmex10.tfm lmmi12.tfm 
lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib7.tfm lmsy10.tfm lmsy7.tfm lmsy9.tfm rm-lmr12.tfm 
rm-lmr7.tfm rm-lmr9.tfm
  • pdffonts reports LMMathItalic{7,10}-Regular for the plain version. Are you sure it's using computer modern? It seems like some variant of latin modern is being used. – Marco May 10 '13 at 13:12
  • David, I think what Marco said is right. Fonts used by LuaTeX are Latin Modern Font Family. The font loading process is added to my post. – Lucas Li May 10 '13 at 13:20
  • @TimothyLi It could be customised locacally but in my unmodified texlive 2012 plain luatex uses the same fonts as plain pdftex and the resulting pdf of your example just has subsets of cm fonts: pdffonts reports 5 fonts including TBDOJF+CMMI10 Type 1 Builtin yes yes no 6 0 – David Carlisle May 10 '13 at 13:37
  • @TimothyLi I put terminal font output into my answer – David Carlisle May 10 '13 at 13:43
  • @DavidCarlisle Thanks, David. I use the luatex in context standalone instead of that in texlive 2012. In my computer, either luatex or context uses the same math font, but why are the outputs different? I think they should have shared the some algorithms. – Lucas Li May 10 '13 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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