Creating a document with mixed languagesHyphenation for mixed language documentBabel + Hebrew + aeguill...

What would the Romans have called "sorcery"?

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?

GPS Rollover on Android Smartphones

How to add power-LED to my small amplifier?

Japan - Plan around max visa duration

XeLaTeX and pdfLaTeX ignore hyphenation

Why is "Reports" in sentence down without "The"

"which" command doesn't work / path of Safari?

Why is the design of haulage companies so “special”?

The use of multiple foreign keys on same column in SQL Server

Are there any consumables that function as addictive (psychedelic) drugs?

What is the command to reset a PC without deleting any files

N.B. ligature in Latex

Why are only specific transaction types accepted into the mempool?

Is there really no realistic way for a skeleton monster to move around without magic?

Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).

How can I hide my bitcoin transactions to protect anonymity from others?

Email Account under attack (really) - anything I can do?

If Manufacturer spice model and Datasheet give different values which should I use?

A function which translates a sentence to title-case

Are tax years 2016 & 2017 back taxes deductible for tax year 2018?

What defenses are there against being summoned by the Gate spell?

Validation accuracy vs Testing accuracy

Why don't electron-positron collisions release infinite energy?



Creating a document with mixed languages


Hyphenation for mixed language documentBabel + Hebrew + aeguill incompatiblilityWrite a class with language dependent stringsProblem with multiple languages in BibTeXProblem with title languages from thesis templateAdvice for multilingual document with many languagesusepackage[english,ngerman,hebrew]{babel}: No file HE8pplx.fd. on input line <number> (with custom .cls)Creating multi-language documentWrite with two different languagesDifferent Font for different Languages (mixed in glossaries)













6















I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:



documentclass[UTF8]{ctexart}

begin{document}

tableofcontents

begin{abstract}
这是简介及摘要。
end{abstract}

section{ 前言 }

section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.

這是繁體中文。

end{document}


But when I tried to add Hebrew by adding



usepackage[utf8x]{inputenc}
usepackage[hebrew,english]{babel}



It does not compile properly. The error message was




Font LHE/cmr/m/n/10=jerus10 at 10.0pt not loadable: Metric (TFM) file not found. select@language{hebrew}




Anyone knows how to fix the problem?










share|improve this question

























  • The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

    – Davislor
    20 hours ago











  • I'll post a working example later.

    – Davislor
    20 hours ago
















6















I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:



documentclass[UTF8]{ctexart}

begin{document}

tableofcontents

begin{abstract}
这是简介及摘要。
end{abstract}

section{ 前言 }

section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.

這是繁體中文。

end{document}


But when I tried to add Hebrew by adding



usepackage[utf8x]{inputenc}
usepackage[hebrew,english]{babel}



It does not compile properly. The error message was




Font LHE/cmr/m/n/10=jerus10 at 10.0pt not loadable: Metric (TFM) file not found. select@language{hebrew}




Anyone knows how to fix the problem?










share|improve this question

























  • The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

    – Davislor
    20 hours ago











  • I'll post a working example later.

    – Davislor
    20 hours ago














6












6








6








I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:



documentclass[UTF8]{ctexart}

begin{document}

tableofcontents

begin{abstract}
这是简介及摘要。
end{abstract}

section{ 前言 }

section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.

這是繁體中文。

end{document}


But when I tried to add Hebrew by adding



usepackage[utf8x]{inputenc}
usepackage[hebrew,english]{babel}



It does not compile properly. The error message was




Font LHE/cmr/m/n/10=jerus10 at 10.0pt not loadable: Metric (TFM) file not found. select@language{hebrew}




Anyone knows how to fix the problem?










share|improve this question
















I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:



documentclass[UTF8]{ctexart}

begin{document}

tableofcontents

begin{abstract}
这是简介及摘要。
end{abstract}

section{ 前言 }

section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.

這是繁體中文。

end{document}


But when I tried to add Hebrew by adding



usepackage[utf8x]{inputenc}
usepackage[hebrew,english]{babel}



It does not compile properly. The error message was




Font LHE/cmr/m/n/10=jerus10 at 10.0pt not loadable: Metric (TFM) file not found. select@language{hebrew}




Anyone knows how to fix the problem?







babel languages






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 13 hours ago







Zuriel

















asked 22 hours ago









ZurielZuriel

264129




264129













  • The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

    – Davislor
    20 hours ago











  • I'll post a working example later.

    – Davislor
    20 hours ago



















  • The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

    – Davislor
    20 hours ago











  • I'll post a working example later.

    – Davislor
    20 hours ago

















The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

– Davislor
20 hours ago





The problem is that, by default, babel is trying to load a legacy 8-bit font you don’t have installed. The fix is to switch to Unicode and use babelprovide[import=he]{hebrew}, then babelfont[hebrew]{rm}{David CLM} (or another font).

– Davislor
20 hours ago













I'll post a working example later.

– Davislor
20 hours ago





I'll post a working example later.

– Davislor
20 hours ago










1 Answer
1






active

oldest

votes


















7














The [hebrew] package option of babel does not really work any more. It tries to load a set of legacy fonts in the 8-bit LHE encoding. (In this case, it is not even looking for a Type 1 font, but the Metafont source for a bitmap font.) In theory, there’s a package called ivritex floating out there that’s supposed to provide backwards compatibility for this; in practice, the maintainer says that it’s a lot simpler to switch to Unicode. Using the new toolchain also obviates all the hacks needed to make UTF-8 and Unicode fonts mostly work with an inherently 8-bit TeX engine.



The workaround is to load Hebrew with babelprovide[import=he]{hebrew} instead. You must then pass the [bidi=default] package option to babel for bidirectional text to work. To change the output encoding to Unicode, you need to define a set of fonts with babelfont.



Here’s an example. I changed the ctexart document class to article with babel, and set all the fonts with babelfont, mainly because ctex has no English documentation. I couldn’t tell you how compatible it is with either babel or polyglossia. If it’s important to write in multiple languages without special markup, you could try ucharclasses, but you might run into problems with right-to-left languages such as Hebrew or Arabic.



documentclass{article}
usepackage[paperwidth=10cm]{geometry}
usepackage[bidi=default]{babel}
usepackage{fontspec}

babelprovide[main, import=en, language=Default]{english}
babelprovide[import=he]{hebrew}
babelprovide[import]{chinese-simplified}
babelprovide[import]{chinese-traditional}

babelfont{rm}
[Scale=1.0, Ligatures={Common, TeX}]{Latin Modern Roman}
babelfont{sf}
[Scale=MatchLowercase, Ligatures={Common, TeX}]{Latin Modern Sans}
babelfont[hebrew]{rm}
[Scale=MatchLowercase, Language=Default]{David CLM}
babelfont[hebrew]{sf}
[Scale=MatchLowercase, Language=Default]{Miriam CLM}
babelfont[chinese-simplified]{rm}
[Scale=MatchLowercase]{Noto Serif CJK SC}
babelfont[chinese-simplified]{sf}
[Scale=MatchLowercase]{Noto Sans CJK SC}
babelfont[chinese-traditional]{rm}
[Scale=MatchLowercase]{Noto Serif CJK TC}
babelfont[chinese-traditional]{sf}
[Scale=MatchLowercase]{Noto Sans CJK TC}

begin{document}

tableofcontents

begin{abstract}
begin{otherlanguage}{chinese-simplified}
这是简介及摘要。
end{otherlanguage}
end{abstract}

section{foreignlanguage{chinese-simplified}{前言}}

section{foreignlanguage{chinese-simplified}{关于数学部分}}
foreignlanguage{chinese-simplified}{数学、中英文皆可以混排。} You can intersperse
math, Chinese and English (Latin script) foreignlanguage{hebrew}{או עברית}
without adding extra environments.

foreignlanguage{chinese-traditional}{這是繁體中文。}

end{document}


Multilingual sample text



“Without adding extra environments” is now a blatant lie. You can make Chinese the main language instead of English, but then you will have to localize certain strings such as the Table of Contents. The call to geometry is solely to make the output fit within the allowed image size here.



If you’re writing documents in Chinese and Hebrew, you presumably have fonts for these languages installed on your system already, and can replace the ones I picked with them. You do not need any special TeX fonts with fontspec; any modern system font will work. If you want to install the fonts I used in this example, you should do so from one of the following sources, in order. A: an operating-system package, such as fonts-noto-cjk and culmus on Ubuntu; B: a CTAN package, such as notoCJKsc; C: from the Culmus project and the Noto CJK homepage.



This compiles with XeLaTeX, requires Babel 3.27 or later, and is written to work around the bug that babelfont in 3.27 ignores default font features. There’s already a patch to fix this.






share|improve this answer


























  • Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

    – Zuriel
    13 hours ago











  • @Zuriel Upgrade to babel 3.27.

    – Davislor
    12 hours ago











  • @Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

    – Davislor
    12 hours 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%2f483605%2fcreating-a-document-with-mixed-languages%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









7














The [hebrew] package option of babel does not really work any more. It tries to load a set of legacy fonts in the 8-bit LHE encoding. (In this case, it is not even looking for a Type 1 font, but the Metafont source for a bitmap font.) In theory, there’s a package called ivritex floating out there that’s supposed to provide backwards compatibility for this; in practice, the maintainer says that it’s a lot simpler to switch to Unicode. Using the new toolchain also obviates all the hacks needed to make UTF-8 and Unicode fonts mostly work with an inherently 8-bit TeX engine.



The workaround is to load Hebrew with babelprovide[import=he]{hebrew} instead. You must then pass the [bidi=default] package option to babel for bidirectional text to work. To change the output encoding to Unicode, you need to define a set of fonts with babelfont.



Here’s an example. I changed the ctexart document class to article with babel, and set all the fonts with babelfont, mainly because ctex has no English documentation. I couldn’t tell you how compatible it is with either babel or polyglossia. If it’s important to write in multiple languages without special markup, you could try ucharclasses, but you might run into problems with right-to-left languages such as Hebrew or Arabic.



documentclass{article}
usepackage[paperwidth=10cm]{geometry}
usepackage[bidi=default]{babel}
usepackage{fontspec}

babelprovide[main, import=en, language=Default]{english}
babelprovide[import=he]{hebrew}
babelprovide[import]{chinese-simplified}
babelprovide[import]{chinese-traditional}

babelfont{rm}
[Scale=1.0, Ligatures={Common, TeX}]{Latin Modern Roman}
babelfont{sf}
[Scale=MatchLowercase, Ligatures={Common, TeX}]{Latin Modern Sans}
babelfont[hebrew]{rm}
[Scale=MatchLowercase, Language=Default]{David CLM}
babelfont[hebrew]{sf}
[Scale=MatchLowercase, Language=Default]{Miriam CLM}
babelfont[chinese-simplified]{rm}
[Scale=MatchLowercase]{Noto Serif CJK SC}
babelfont[chinese-simplified]{sf}
[Scale=MatchLowercase]{Noto Sans CJK SC}
babelfont[chinese-traditional]{rm}
[Scale=MatchLowercase]{Noto Serif CJK TC}
babelfont[chinese-traditional]{sf}
[Scale=MatchLowercase]{Noto Sans CJK TC}

begin{document}

tableofcontents

begin{abstract}
begin{otherlanguage}{chinese-simplified}
这是简介及摘要。
end{otherlanguage}
end{abstract}

section{foreignlanguage{chinese-simplified}{前言}}

section{foreignlanguage{chinese-simplified}{关于数学部分}}
foreignlanguage{chinese-simplified}{数学、中英文皆可以混排。} You can intersperse
math, Chinese and English (Latin script) foreignlanguage{hebrew}{או עברית}
without adding extra environments.

foreignlanguage{chinese-traditional}{這是繁體中文。}

end{document}


Multilingual sample text



“Without adding extra environments” is now a blatant lie. You can make Chinese the main language instead of English, but then you will have to localize certain strings such as the Table of Contents. The call to geometry is solely to make the output fit within the allowed image size here.



If you’re writing documents in Chinese and Hebrew, you presumably have fonts for these languages installed on your system already, and can replace the ones I picked with them. You do not need any special TeX fonts with fontspec; any modern system font will work. If you want to install the fonts I used in this example, you should do so from one of the following sources, in order. A: an operating-system package, such as fonts-noto-cjk and culmus on Ubuntu; B: a CTAN package, such as notoCJKsc; C: from the Culmus project and the Noto CJK homepage.



This compiles with XeLaTeX, requires Babel 3.27 or later, and is written to work around the bug that babelfont in 3.27 ignores default font features. There’s already a patch to fix this.






share|improve this answer


























  • Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

    – Zuriel
    13 hours ago











  • @Zuriel Upgrade to babel 3.27.

    – Davislor
    12 hours ago











  • @Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

    – Davislor
    12 hours ago


















7














The [hebrew] package option of babel does not really work any more. It tries to load a set of legacy fonts in the 8-bit LHE encoding. (In this case, it is not even looking for a Type 1 font, but the Metafont source for a bitmap font.) In theory, there’s a package called ivritex floating out there that’s supposed to provide backwards compatibility for this; in practice, the maintainer says that it’s a lot simpler to switch to Unicode. Using the new toolchain also obviates all the hacks needed to make UTF-8 and Unicode fonts mostly work with an inherently 8-bit TeX engine.



The workaround is to load Hebrew with babelprovide[import=he]{hebrew} instead. You must then pass the [bidi=default] package option to babel for bidirectional text to work. To change the output encoding to Unicode, you need to define a set of fonts with babelfont.



Here’s an example. I changed the ctexart document class to article with babel, and set all the fonts with babelfont, mainly because ctex has no English documentation. I couldn’t tell you how compatible it is with either babel or polyglossia. If it’s important to write in multiple languages without special markup, you could try ucharclasses, but you might run into problems with right-to-left languages such as Hebrew or Arabic.



documentclass{article}
usepackage[paperwidth=10cm]{geometry}
usepackage[bidi=default]{babel}
usepackage{fontspec}

babelprovide[main, import=en, language=Default]{english}
babelprovide[import=he]{hebrew}
babelprovide[import]{chinese-simplified}
babelprovide[import]{chinese-traditional}

babelfont{rm}
[Scale=1.0, Ligatures={Common, TeX}]{Latin Modern Roman}
babelfont{sf}
[Scale=MatchLowercase, Ligatures={Common, TeX}]{Latin Modern Sans}
babelfont[hebrew]{rm}
[Scale=MatchLowercase, Language=Default]{David CLM}
babelfont[hebrew]{sf}
[Scale=MatchLowercase, Language=Default]{Miriam CLM}
babelfont[chinese-simplified]{rm}
[Scale=MatchLowercase]{Noto Serif CJK SC}
babelfont[chinese-simplified]{sf}
[Scale=MatchLowercase]{Noto Sans CJK SC}
babelfont[chinese-traditional]{rm}
[Scale=MatchLowercase]{Noto Serif CJK TC}
babelfont[chinese-traditional]{sf}
[Scale=MatchLowercase]{Noto Sans CJK TC}

begin{document}

tableofcontents

begin{abstract}
begin{otherlanguage}{chinese-simplified}
这是简介及摘要。
end{otherlanguage}
end{abstract}

section{foreignlanguage{chinese-simplified}{前言}}

section{foreignlanguage{chinese-simplified}{关于数学部分}}
foreignlanguage{chinese-simplified}{数学、中英文皆可以混排。} You can intersperse
math, Chinese and English (Latin script) foreignlanguage{hebrew}{או עברית}
without adding extra environments.

foreignlanguage{chinese-traditional}{這是繁體中文。}

end{document}


Multilingual sample text



“Without adding extra environments” is now a blatant lie. You can make Chinese the main language instead of English, but then you will have to localize certain strings such as the Table of Contents. The call to geometry is solely to make the output fit within the allowed image size here.



If you’re writing documents in Chinese and Hebrew, you presumably have fonts for these languages installed on your system already, and can replace the ones I picked with them. You do not need any special TeX fonts with fontspec; any modern system font will work. If you want to install the fonts I used in this example, you should do so from one of the following sources, in order. A: an operating-system package, such as fonts-noto-cjk and culmus on Ubuntu; B: a CTAN package, such as notoCJKsc; C: from the Culmus project and the Noto CJK homepage.



This compiles with XeLaTeX, requires Babel 3.27 or later, and is written to work around the bug that babelfont in 3.27 ignores default font features. There’s already a patch to fix this.






share|improve this answer


























  • Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

    – Zuriel
    13 hours ago











  • @Zuriel Upgrade to babel 3.27.

    – Davislor
    12 hours ago











  • @Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

    – Davislor
    12 hours ago
















7












7








7







The [hebrew] package option of babel does not really work any more. It tries to load a set of legacy fonts in the 8-bit LHE encoding. (In this case, it is not even looking for a Type 1 font, but the Metafont source for a bitmap font.) In theory, there’s a package called ivritex floating out there that’s supposed to provide backwards compatibility for this; in practice, the maintainer says that it’s a lot simpler to switch to Unicode. Using the new toolchain also obviates all the hacks needed to make UTF-8 and Unicode fonts mostly work with an inherently 8-bit TeX engine.



The workaround is to load Hebrew with babelprovide[import=he]{hebrew} instead. You must then pass the [bidi=default] package option to babel for bidirectional text to work. To change the output encoding to Unicode, you need to define a set of fonts with babelfont.



Here’s an example. I changed the ctexart document class to article with babel, and set all the fonts with babelfont, mainly because ctex has no English documentation. I couldn’t tell you how compatible it is with either babel or polyglossia. If it’s important to write in multiple languages without special markup, you could try ucharclasses, but you might run into problems with right-to-left languages such as Hebrew or Arabic.



documentclass{article}
usepackage[paperwidth=10cm]{geometry}
usepackage[bidi=default]{babel}
usepackage{fontspec}

babelprovide[main, import=en, language=Default]{english}
babelprovide[import=he]{hebrew}
babelprovide[import]{chinese-simplified}
babelprovide[import]{chinese-traditional}

babelfont{rm}
[Scale=1.0, Ligatures={Common, TeX}]{Latin Modern Roman}
babelfont{sf}
[Scale=MatchLowercase, Ligatures={Common, TeX}]{Latin Modern Sans}
babelfont[hebrew]{rm}
[Scale=MatchLowercase, Language=Default]{David CLM}
babelfont[hebrew]{sf}
[Scale=MatchLowercase, Language=Default]{Miriam CLM}
babelfont[chinese-simplified]{rm}
[Scale=MatchLowercase]{Noto Serif CJK SC}
babelfont[chinese-simplified]{sf}
[Scale=MatchLowercase]{Noto Sans CJK SC}
babelfont[chinese-traditional]{rm}
[Scale=MatchLowercase]{Noto Serif CJK TC}
babelfont[chinese-traditional]{sf}
[Scale=MatchLowercase]{Noto Sans CJK TC}

begin{document}

tableofcontents

begin{abstract}
begin{otherlanguage}{chinese-simplified}
这是简介及摘要。
end{otherlanguage}
end{abstract}

section{foreignlanguage{chinese-simplified}{前言}}

section{foreignlanguage{chinese-simplified}{关于数学部分}}
foreignlanguage{chinese-simplified}{数学、中英文皆可以混排。} You can intersperse
math, Chinese and English (Latin script) foreignlanguage{hebrew}{או עברית}
without adding extra environments.

foreignlanguage{chinese-traditional}{這是繁體中文。}

end{document}


Multilingual sample text



“Without adding extra environments” is now a blatant lie. You can make Chinese the main language instead of English, but then you will have to localize certain strings such as the Table of Contents. The call to geometry is solely to make the output fit within the allowed image size here.



If you’re writing documents in Chinese and Hebrew, you presumably have fonts for these languages installed on your system already, and can replace the ones I picked with them. You do not need any special TeX fonts with fontspec; any modern system font will work. If you want to install the fonts I used in this example, you should do so from one of the following sources, in order. A: an operating-system package, such as fonts-noto-cjk and culmus on Ubuntu; B: a CTAN package, such as notoCJKsc; C: from the Culmus project and the Noto CJK homepage.



This compiles with XeLaTeX, requires Babel 3.27 or later, and is written to work around the bug that babelfont in 3.27 ignores default font features. There’s already a patch to fix this.






share|improve this answer















The [hebrew] package option of babel does not really work any more. It tries to load a set of legacy fonts in the 8-bit LHE encoding. (In this case, it is not even looking for a Type 1 font, but the Metafont source for a bitmap font.) In theory, there’s a package called ivritex floating out there that’s supposed to provide backwards compatibility for this; in practice, the maintainer says that it’s a lot simpler to switch to Unicode. Using the new toolchain also obviates all the hacks needed to make UTF-8 and Unicode fonts mostly work with an inherently 8-bit TeX engine.



The workaround is to load Hebrew with babelprovide[import=he]{hebrew} instead. You must then pass the [bidi=default] package option to babel for bidirectional text to work. To change the output encoding to Unicode, you need to define a set of fonts with babelfont.



Here’s an example. I changed the ctexart document class to article with babel, and set all the fonts with babelfont, mainly because ctex has no English documentation. I couldn’t tell you how compatible it is with either babel or polyglossia. If it’s important to write in multiple languages without special markup, you could try ucharclasses, but you might run into problems with right-to-left languages such as Hebrew or Arabic.



documentclass{article}
usepackage[paperwidth=10cm]{geometry}
usepackage[bidi=default]{babel}
usepackage{fontspec}

babelprovide[main, import=en, language=Default]{english}
babelprovide[import=he]{hebrew}
babelprovide[import]{chinese-simplified}
babelprovide[import]{chinese-traditional}

babelfont{rm}
[Scale=1.0, Ligatures={Common, TeX}]{Latin Modern Roman}
babelfont{sf}
[Scale=MatchLowercase, Ligatures={Common, TeX}]{Latin Modern Sans}
babelfont[hebrew]{rm}
[Scale=MatchLowercase, Language=Default]{David CLM}
babelfont[hebrew]{sf}
[Scale=MatchLowercase, Language=Default]{Miriam CLM}
babelfont[chinese-simplified]{rm}
[Scale=MatchLowercase]{Noto Serif CJK SC}
babelfont[chinese-simplified]{sf}
[Scale=MatchLowercase]{Noto Sans CJK SC}
babelfont[chinese-traditional]{rm}
[Scale=MatchLowercase]{Noto Serif CJK TC}
babelfont[chinese-traditional]{sf}
[Scale=MatchLowercase]{Noto Sans CJK TC}

begin{document}

tableofcontents

begin{abstract}
begin{otherlanguage}{chinese-simplified}
这是简介及摘要。
end{otherlanguage}
end{abstract}

section{foreignlanguage{chinese-simplified}{前言}}

section{foreignlanguage{chinese-simplified}{关于数学部分}}
foreignlanguage{chinese-simplified}{数学、中英文皆可以混排。} You can intersperse
math, Chinese and English (Latin script) foreignlanguage{hebrew}{או עברית}
without adding extra environments.

foreignlanguage{chinese-traditional}{這是繁體中文。}

end{document}


Multilingual sample text



“Without adding extra environments” is now a blatant lie. You can make Chinese the main language instead of English, but then you will have to localize certain strings such as the Table of Contents. The call to geometry is solely to make the output fit within the allowed image size here.



If you’re writing documents in Chinese and Hebrew, you presumably have fonts for these languages installed on your system already, and can replace the ones I picked with them. You do not need any special TeX fonts with fontspec; any modern system font will work. If you want to install the fonts I used in this example, you should do so from one of the following sources, in order. A: an operating-system package, such as fonts-noto-cjk and culmus on Ubuntu; B: a CTAN package, such as notoCJKsc; C: from the Culmus project and the Noto CJK homepage.



This compiles with XeLaTeX, requires Babel 3.27 or later, and is written to work around the bug that babelfont in 3.27 ignores default font features. There’s already a patch to fix this.







share|improve this answer














share|improve this answer



share|improve this answer








edited 12 hours ago

























answered 19 hours ago









DavislorDavislor

7,2491432




7,2491432













  • Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

    – Zuriel
    13 hours ago











  • @Zuriel Upgrade to babel 3.27.

    – Davislor
    12 hours ago











  • @Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

    – Davislor
    12 hours ago





















  • Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

    – Zuriel
    13 hours ago











  • @Zuriel Upgrade to babel 3.27.

    – Davislor
    12 hours ago











  • @Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

    – Davislor
    12 hours ago



















Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

– Zuriel
13 hours ago





Thanks for your answer! My problem is, Package babel Error: You haven't specified a language option. ...ry to proceed from here, type x to quit.} Do you happen to know any fix to this?

– Zuriel
13 hours ago













@Zuriel Upgrade to babel 3.27.

– Davislor
12 hours ago





@Zuriel Upgrade to babel 3.27.

– Davislor
12 hours ago













@Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

– Davislor
12 hours ago







@Zuriel If you absolutely can’t, you could try, as a workaround, usepackage[bidi, english]{babel} and commenting out the line %babelprovides[main, import=en]{english}. But you want to run an recent TeX engine, or you’ll get a lot of problems we can’t help you with.

– Davislor
12 hours 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%2f483605%2fcreating-a-document-with-mixed-languages%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

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...