Different fonts inside and outside math-mode












4















When processing the simple file:



documentclass{report}

begin{document}
1234567890

$1234567890$
end{document}


with pdflatex one get a PDF with one font only (CMR10), but when processing with either xelatex or lualatex the produced PDF use Latin Modern Roman 10 outside math-mode and CMR10 inside.



What are the reasons behind this?










share|improve this question


















  • 4





    Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

    – Henri Menke
    5 hours ago













  • What is the tricky part of getting the TU encoding in math-mode?

    – Paulo Ney
    5 hours ago






  • 1





    The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

    – Henri Menke
    5 hours ago











  • @HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

    – Davislor
    5 hours ago











  • To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

    – Ruixi Zhang
    4 hours ago


















4















When processing the simple file:



documentclass{report}

begin{document}
1234567890

$1234567890$
end{document}


with pdflatex one get a PDF with one font only (CMR10), but when processing with either xelatex or lualatex the produced PDF use Latin Modern Roman 10 outside math-mode and CMR10 inside.



What are the reasons behind this?










share|improve this question


















  • 4





    Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

    – Henri Menke
    5 hours ago













  • What is the tricky part of getting the TU encoding in math-mode?

    – Paulo Ney
    5 hours ago






  • 1





    The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

    – Henri Menke
    5 hours ago











  • @HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

    – Davislor
    5 hours ago











  • To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

    – Ruixi Zhang
    4 hours ago
















4












4








4








When processing the simple file:



documentclass{report}

begin{document}
1234567890

$1234567890$
end{document}


with pdflatex one get a PDF with one font only (CMR10), but when processing with either xelatex or lualatex the produced PDF use Latin Modern Roman 10 outside math-mode and CMR10 inside.



What are the reasons behind this?










share|improve this question














When processing the simple file:



documentclass{report}

begin{document}
1234567890

$1234567890$
end{document}


with pdflatex one get a PDF with one font only (CMR10), but when processing with either xelatex or lualatex the produced PDF use Latin Modern Roman 10 outside math-mode and CMR10 inside.



What are the reasons behind this?







xetex pdftex luatex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 5 hours ago









Paulo NeyPaulo Ney

1,142917




1,142917








  • 4





    Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

    – Henri Menke
    5 hours ago













  • What is the tricky part of getting the TU encoding in math-mode?

    – Paulo Ney
    5 hours ago






  • 1





    The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

    – Henri Menke
    5 hours ago











  • @HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

    – Davislor
    5 hours ago











  • To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

    – Ruixi Zhang
    4 hours ago
















  • 4





    Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

    – Henri Menke
    5 hours ago













  • What is the tricky part of getting the TU encoding in math-mode?

    – Paulo Ney
    5 hours ago






  • 1





    The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

    – Henri Menke
    5 hours ago











  • @HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

    – Davislor
    5 hours ago











  • To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

    – Ruixi Zhang
    4 hours ago










4




4





Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

– Henri Menke
5 hours ago







Because LaTeX now supports UTF-8 by default, the font should also be able to to reflect this. Therefore, when using Xe/LuaTeX, the LaTeX format automatically switches to TU font encoding. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead. In math mode this is a little more tricky that is why standard OML/OMS encoding is retained. I don't know whether there exist any plans to make UTF-8 available in math as well.

– Henri Menke
5 hours ago















What is the tricky part of getting the TU encoding in math-mode?

– Paulo Ney
5 hours ago





What is the tricky part of getting the TU encoding in math-mode?

– Paulo Ney
5 hours ago




1




1





The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

– Henri Menke
5 hours ago





The traditional setup was to have different families, i.e. mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which switches mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time.

– Henri Menke
5 hours ago













@HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

– Davislor
5 hours ago





@HenriMenke Whoops, thanks for pointing out my misreading of the example. Want to post your answer?

– Davislor
5 hours ago













To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

– Ruixi Zhang
4 hours ago







To complement to @HenriMenke’s comment, mathbf switches to bold upright text font while mathcal switches to OMS math font. Math font encoding was never really actively developed (see LaTeX font encoding guide p. 3, the last paragraphs before Section 1.3).

– Ruixi Zhang
4 hours ago












1 Answer
1






active

oldest

votes


















3














Since TeX Live 2018 LaTeX now UTF-8 by default, because the “Unicode revolution” has been completed1. This makes it superfluous to add usepackage[utf8]{inputenc} when using pdfLaTeX.



The UTF-8 support in pdfLaTeX is fake however and you cannot expect to get a meaningful output when you paste arbitrary UTF-8 characters into the input, because the underlying pdfTeX engine is inherently limited to 8-bit encoding.



This is quite different with Xe/LuaTeX. These engines support UTF-8 by default2. Traditional TeX fonts are very limited in the glyphs they offer3. This is definitely not enough to describe UTF-8, so the font also has to cover the full UTF-8 range4. To this end the TU encoding was introduced.



By default LaTeX loads the Computer Modern (CM) family of fonts. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead.



Now the question remains, why is Latin Modern not used in math mode? That is because in math mode things are a little more tricky. The traditional setup was to have different families and commands like mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which swaps mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time. That is why currently standard OML/OMS encoding is retained.





1 Everyone stores their files in UTF-8 nowadays and most software understands UTF-8. Just think of Emojies (they are everywhere). They are part of UTF-8, so everything that can display Emojies has to support UTF-8.
2 in fact LuaTeX will reject your file if it is not UTF-8
3 T1 encoding can only encode 256 glyphs
4 whether the font has the required glyph is another question






share|improve this answer
























  • The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

    – Davislor
    1 hour ago













  • I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

    – Davislor
    59 mins ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476254%2fdifferent-fonts-inside-and-outside-math-mode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Since TeX Live 2018 LaTeX now UTF-8 by default, because the “Unicode revolution” has been completed1. This makes it superfluous to add usepackage[utf8]{inputenc} when using pdfLaTeX.



The UTF-8 support in pdfLaTeX is fake however and you cannot expect to get a meaningful output when you paste arbitrary UTF-8 characters into the input, because the underlying pdfTeX engine is inherently limited to 8-bit encoding.



This is quite different with Xe/LuaTeX. These engines support UTF-8 by default2. Traditional TeX fonts are very limited in the glyphs they offer3. This is definitely not enough to describe UTF-8, so the font also has to cover the full UTF-8 range4. To this end the TU encoding was introduced.



By default LaTeX loads the Computer Modern (CM) family of fonts. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead.



Now the question remains, why is Latin Modern not used in math mode? That is because in math mode things are a little more tricky. The traditional setup was to have different families and commands like mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which swaps mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time. That is why currently standard OML/OMS encoding is retained.





1 Everyone stores their files in UTF-8 nowadays and most software understands UTF-8. Just think of Emojies (they are everywhere). They are part of UTF-8, so everything that can display Emojies has to support UTF-8.
2 in fact LuaTeX will reject your file if it is not UTF-8
3 T1 encoding can only encode 256 glyphs
4 whether the font has the required glyph is another question






share|improve this answer
























  • The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

    – Davislor
    1 hour ago













  • I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

    – Davislor
    59 mins ago
















3














Since TeX Live 2018 LaTeX now UTF-8 by default, because the “Unicode revolution” has been completed1. This makes it superfluous to add usepackage[utf8]{inputenc} when using pdfLaTeX.



The UTF-8 support in pdfLaTeX is fake however and you cannot expect to get a meaningful output when you paste arbitrary UTF-8 characters into the input, because the underlying pdfTeX engine is inherently limited to 8-bit encoding.



This is quite different with Xe/LuaTeX. These engines support UTF-8 by default2. Traditional TeX fonts are very limited in the glyphs they offer3. This is definitely not enough to describe UTF-8, so the font also has to cover the full UTF-8 range4. To this end the TU encoding was introduced.



By default LaTeX loads the Computer Modern (CM) family of fonts. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead.



Now the question remains, why is Latin Modern not used in math mode? That is because in math mode things are a little more tricky. The traditional setup was to have different families and commands like mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which swaps mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time. That is why currently standard OML/OMS encoding is retained.





1 Everyone stores their files in UTF-8 nowadays and most software understands UTF-8. Just think of Emojies (they are everywhere). They are part of UTF-8, so everything that can display Emojies has to support UTF-8.
2 in fact LuaTeX will reject your file if it is not UTF-8
3 T1 encoding can only encode 256 glyphs
4 whether the font has the required glyph is another question






share|improve this answer
























  • The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

    – Davislor
    1 hour ago













  • I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

    – Davislor
    59 mins ago














3












3








3







Since TeX Live 2018 LaTeX now UTF-8 by default, because the “Unicode revolution” has been completed1. This makes it superfluous to add usepackage[utf8]{inputenc} when using pdfLaTeX.



The UTF-8 support in pdfLaTeX is fake however and you cannot expect to get a meaningful output when you paste arbitrary UTF-8 characters into the input, because the underlying pdfTeX engine is inherently limited to 8-bit encoding.



This is quite different with Xe/LuaTeX. These engines support UTF-8 by default2. Traditional TeX fonts are very limited in the glyphs they offer3. This is definitely not enough to describe UTF-8, so the font also has to cover the full UTF-8 range4. To this end the TU encoding was introduced.



By default LaTeX loads the Computer Modern (CM) family of fonts. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead.



Now the question remains, why is Latin Modern not used in math mode? That is because in math mode things are a little more tricky. The traditional setup was to have different families and commands like mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which swaps mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time. That is why currently standard OML/OMS encoding is retained.





1 Everyone stores their files in UTF-8 nowadays and most software understands UTF-8. Just think of Emojies (they are everywhere). They are part of UTF-8, so everything that can display Emojies has to support UTF-8.
2 in fact LuaTeX will reject your file if it is not UTF-8
3 T1 encoding can only encode 256 glyphs
4 whether the font has the required glyph is another question






share|improve this answer













Since TeX Live 2018 LaTeX now UTF-8 by default, because the “Unicode revolution” has been completed1. This makes it superfluous to add usepackage[utf8]{inputenc} when using pdfLaTeX.



The UTF-8 support in pdfLaTeX is fake however and you cannot expect to get a meaningful output when you paste arbitrary UTF-8 characters into the input, because the underlying pdfTeX engine is inherently limited to 8-bit encoding.



This is quite different with Xe/LuaTeX. These engines support UTF-8 by default2. Traditional TeX fonts are very limited in the glyphs they offer3. This is definitely not enough to describe UTF-8, so the font also has to cover the full UTF-8 range4. To this end the TU encoding was introduced.



By default LaTeX loads the Computer Modern (CM) family of fonts. The CMR10 font is not available in TU encoding (and never will be), therefore its closest relative Latin Modern Roman 10 is loaded instead.



Now the question remains, why is Latin Modern not used in math mode? That is because in math mode things are a little more tricky. The traditional setup was to have different families and commands like mathbf, mathcal, etc. switched to a different family. This is no longer possible in Unicode, because all the symbols come from a single font. Therefore the family switching approach doesn't work anymore and has to be replaced by a much more complex system which swaps mathcodes back and forth. This is implemented in the unicode-math package. You'll also notice why this is problematic because with the unicode-math package TeX is suddenly much slower due to having to reassign thousands of mathcodes all the time. That is why currently standard OML/OMS encoding is retained.





1 Everyone stores their files in UTF-8 nowadays and most software understands UTF-8. Just think of Emojies (they are everywhere). They are part of UTF-8, so everything that can display Emojies has to support UTF-8.
2 in fact LuaTeX will reject your file if it is not UTF-8
3 T1 encoding can only encode 256 glyphs
4 whether the font has the required glyph is another question







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 hours ago









Henri MenkeHenri Menke

75.2k8164276




75.2k8164276













  • The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

    – Davislor
    1 hour ago













  • I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

    – Davislor
    59 mins ago



















  • The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

    – Davislor
    1 hour ago













  • I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

    – Davislor
    59 mins ago

















The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

– Davislor
1 hour ago







The change was upstream, in the April 2018 release of LaTex, if you want to get specific about when and where. It’s therefore true of all distributions.

– Davislor
1 hour ago















I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

– Davislor
59 mins ago





I still personally include usepackage[utf8]{inputenc} in case someone tries to compile on an older distro.

– Davislor
59 mins ago


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476254%2fdifferent-fonts-inside-and-outside-math-mode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bundesstraße 106

Verónica Boquete

Ida-Boy-Ed-Garten