Creating a document with mixed languages The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Do we need more moderators?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)
How to handle characters who are more educated than the author?
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
What was the last x86 CPU that did not have the x87 floating-point unit built in?
How to read αἱμύλιος or when to aspirate
University's motivation for having tenure-track positions
Does Parliament need to approve the new Brexit delay to 31 October 2019?
What would this chord progression be called?
What aspect of planet Earth must be changed to prevent the industrial revolution?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
How did passengers keep warm on sail ships?
Can withdrawing asylum be illegal?
Word for: a synonym with a positive connotation?
What do I do when my TA workload is more than expected?
What's the point in a preamp?
Simulating Exploding Dice
Why can't devices on different VLANs, but on the same subnet, communicate?
Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?
How to determine omitted units in a publication
Could an empire control the whole planet with today's comunication methods?
"... to apply for a visa" or "... and applied for a visa"?
What can I do if neighbor is blocking my solar panels intentionally?
Would an alien lifeform be able to achieve space travel if lacking in vision?
Do working physicists consider Newtonian mechanics to be "falsified"?
Creating a document with mixed languages
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Do we need more moderators?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)
I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:
documentclass[UTF8]ctexart
begindocument
tableofcontents
beginabstract
这是简介及摘要。
endabstract
section 前言
section关于数学部分
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
這是繁體中文。
enddocument
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@languagehebrew
Anyone knows how to fix the problem?
babel languages
add a comment |
I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:
documentclass[UTF8]ctexart
begindocument
tableofcontents
beginabstract
这是简介及摘要。
endabstract
section 前言
section关于数学部分
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
這是繁體中文。
enddocument
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@languagehebrew
Anyone knows how to fix the problem?
babel languages
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 usebabelprovide[import=he]hebrew
, thenbabelfont[hebrew]rmDavid CLM
(or another font).
– Davislor
Apr 7 at 4:41
I'll post a working example later.
– Davislor
Apr 7 at 4:42
add a comment |
I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:
documentclass[UTF8]ctexart
begindocument
tableofcontents
beginabstract
这是简介及摘要。
endabstract
section 前言
section关于数学部分
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
這是繁體中文。
enddocument
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@languagehebrew
Anyone knows how to fix the problem?
babel languages
I am typing a document in both Chinese and Hebrew. When I use the following codes for Chinese, everything works fine:
documentclass[UTF8]ctexart
begindocument
tableofcontents
beginabstract
这是简介及摘要。
endabstract
section 前言
section关于数学部分
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
這是繁體中文。
enddocument
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@languagehebrew
Anyone knows how to fix the problem?
babel languages
babel languages
edited Apr 7 at 11:19
Zuriel
asked Apr 7 at 2:18
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 usebabelprovide[import=he]hebrew
, thenbabelfont[hebrew]rmDavid CLM
(or another font).
– Davislor
Apr 7 at 4:41
I'll post a working example later.
– Davislor
Apr 7 at 4:42
add a comment |
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 usebabelprovide[import=he]hebrew
, thenbabelfont[hebrew]rmDavid CLM
(or another font).
– Davislor
Apr 7 at 4:41
I'll post a working example later.
– Davislor
Apr 7 at 4:42
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]rmDavid CLM
(or another font).– Davislor
Apr 7 at 4:41
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]rmDavid CLM
(or another font).– Davislor
Apr 7 at 4:41
I'll post a working example later.
– Davislor
Apr 7 at 4:42
I'll post a working example later.
– Davislor
Apr 7 at 4:42
add a comment |
1 Answer
1
active
oldest
votes
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.
documentclassarticle
usepackage[paperwidth=10cm]geometry
usepackage[bidi=default]babel
usepackagefontspec
babelprovide[main, import=en, language=Default]english
babelprovide[import=he]hebrew
babelprovide[import]chinese-simplified
babelprovide[import]chinese-traditional
babelfontrm
[Scale=1.0, Ligatures=Common, TeX]Latin Modern Roman
babelfontsf
[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
begindocument
tableofcontents
beginabstract
beginotherlanguagechinese-simplified
这是简介及摘要。
endotherlanguage
endabstract
sectionforeignlanguagechinese-simplified前言
sectionforeignlanguagechinese-simplified关于数学部分
foreignlanguagechinese-simplified数学、中英文皆可以混排。 You can intersperse
math, Chinese and English (Latin script) foreignlanguagehebrewאו עברית
without adding extra environments.
foreignlanguagechinese-traditional這是繁體中文。
enddocument
“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.
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
Apr 7 at 11:33
@Zuriel Upgrade tobabel
3.27.
– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
documentclassarticle
usepackage[paperwidth=10cm]geometry
usepackage[bidi=default]babel
usepackagefontspec
babelprovide[main, import=en, language=Default]english
babelprovide[import=he]hebrew
babelprovide[import]chinese-simplified
babelprovide[import]chinese-traditional
babelfontrm
[Scale=1.0, Ligatures=Common, TeX]Latin Modern Roman
babelfontsf
[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
begindocument
tableofcontents
beginabstract
beginotherlanguagechinese-simplified
这是简介及摘要。
endotherlanguage
endabstract
sectionforeignlanguagechinese-simplified前言
sectionforeignlanguagechinese-simplified关于数学部分
foreignlanguagechinese-simplified数学、中英文皆可以混排。 You can intersperse
math, Chinese and English (Latin script) foreignlanguagehebrewאו עברית
without adding extra environments.
foreignlanguagechinese-traditional這是繁體中文。
enddocument
“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.
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
Apr 7 at 11:33
@Zuriel Upgrade tobabel
3.27.
– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
add a comment |
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.
documentclassarticle
usepackage[paperwidth=10cm]geometry
usepackage[bidi=default]babel
usepackagefontspec
babelprovide[main, import=en, language=Default]english
babelprovide[import=he]hebrew
babelprovide[import]chinese-simplified
babelprovide[import]chinese-traditional
babelfontrm
[Scale=1.0, Ligatures=Common, TeX]Latin Modern Roman
babelfontsf
[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
begindocument
tableofcontents
beginabstract
beginotherlanguagechinese-simplified
这是简介及摘要。
endotherlanguage
endabstract
sectionforeignlanguagechinese-simplified前言
sectionforeignlanguagechinese-simplified关于数学部分
foreignlanguagechinese-simplified数学、中英文皆可以混排。 You can intersperse
math, Chinese and English (Latin script) foreignlanguagehebrewאו עברית
without adding extra environments.
foreignlanguagechinese-traditional這是繁體中文。
enddocument
“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.
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
Apr 7 at 11:33
@Zuriel Upgrade tobabel
3.27.
– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
add a comment |
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.
documentclassarticle
usepackage[paperwidth=10cm]geometry
usepackage[bidi=default]babel
usepackagefontspec
babelprovide[main, import=en, language=Default]english
babelprovide[import=he]hebrew
babelprovide[import]chinese-simplified
babelprovide[import]chinese-traditional
babelfontrm
[Scale=1.0, Ligatures=Common, TeX]Latin Modern Roman
babelfontsf
[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
begindocument
tableofcontents
beginabstract
beginotherlanguagechinese-simplified
这是简介及摘要。
endotherlanguage
endabstract
sectionforeignlanguagechinese-simplified前言
sectionforeignlanguagechinese-simplified关于数学部分
foreignlanguagechinese-simplified数学、中英文皆可以混排。 You can intersperse
math, Chinese and English (Latin script) foreignlanguagehebrewאו עברית
without adding extra environments.
foreignlanguagechinese-traditional這是繁體中文。
enddocument
“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.
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.
documentclassarticle
usepackage[paperwidth=10cm]geometry
usepackage[bidi=default]babel
usepackagefontspec
babelprovide[main, import=en, language=Default]english
babelprovide[import=he]hebrew
babelprovide[import]chinese-simplified
babelprovide[import]chinese-traditional
babelfontrm
[Scale=1.0, Ligatures=Common, TeX]Latin Modern Roman
babelfontsf
[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
begindocument
tableofcontents
beginabstract
beginotherlanguagechinese-simplified
这是简介及摘要。
endotherlanguage
endabstract
sectionforeignlanguagechinese-simplified前言
sectionforeignlanguagechinese-simplified关于数学部分
foreignlanguagechinese-simplified数学、中英文皆可以混排。 You can intersperse
math, Chinese and English (Latin script) foreignlanguagehebrewאו עברית
without adding extra environments.
foreignlanguagechinese-traditional這是繁體中文。
enddocument
“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.
edited Apr 7 at 12:44
answered Apr 7 at 5:35
DavislorDavislor
7,3641432
7,3641432
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
Apr 7 at 11:33
@Zuriel Upgrade tobabel
3.27.
– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
add a comment |
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
Apr 7 at 11:33
@Zuriel Upgrade tobabel
3.27.
– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
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
Apr 7 at 11:33
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
Apr 7 at 11:33
@Zuriel Upgrade to
babel
3.27.– Davislor
Apr 7 at 12:15
@Zuriel Upgrade to
babel
3.27.– Davislor
Apr 7 at 12:15
@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
Apr 7 at 12:16
@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
Apr 7 at 12:16
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
, thenbabelfont[hebrew]rmDavid CLM
(or another font).– Davislor
Apr 7 at 4:41
I'll post a working example later.
– Davislor
Apr 7 at 4:42