TeX - LaTeX Asked on April 14, 2021
I want to write a greek-english text. I am using babel+XeLaTex. I have a problem with the table of contents: When these lines are included in my code
setDefaultTransitions{selectlanguage{english}}{selectlanguage{english}}
setTransitionTo{GreekAndCoptic}{selectlanguage{greek}}
it produces the following error:
"LaTeX Error: Command rmfamily invalid in math mode. output.toc, line
67"
and a warning at the ‘ tableofcontents ‘ command, mentioning:
Package babel Warning: englishcontentsname not set. Please, define it after the language has been loaded (typically in the preamble) with something like: renewcommandenglishcontentsname{..} Reported on input line 23.
In the pdf, instead of ‘ Contents ‘ at the start of the ToC, it has ‘ ?contentsname? ‘
Here is the MWE:
documentclass[12pt]{extarticle}
usepackage{babel}
usepackage{ucharclasses}
babelprovide{greek,english}
babelfont{rm}[Ligatures={Common,Rare}, Scale=1.0]{Libertinus Serif}
babelfont{sf}[Ligatures={Common,Rare}]{Libertinus Sans}
babelfont{tt}{Libertinus Mono}
babelfont[Language=greek]{rm}{Kerkis}
babelfont[Language=greek]{sf}{Kerkis}
babelfont[Language=greek]{tt}{kerkis}
setDefaultTransitions{selectlanguage{english}}{selectlanguage{english}}
setTransitionTo{GreekAndCoptic}{selectlanguage{greek}}
begin{document}
some text
blabla μπλαμπλα
newpage
tableofcontents
newpage
section{Introduction-Εισαγωγή}
subsection{test}
end{document}
Need further clarification on what you want to achieve.
When I make Greek the main language in babel, and set the fonts for the transitions (making Greek blue, to show which font made it into the table of contents), the TOC is OK.
MWE
documentclass[12pt]{extarticle}
usepackage{xcolor}
usepackage{fontspec}
newfontfamily{defaultfont}{Noto Serif}
newfontfamily{greekfont}{Kerkis}[Colour=blue]
usepackage[english,greek]{babel}
usepackage{ucharclasses}
setDefaultTransitions{defaultfont}{}
setTransitionsForGreek{greekfont}{}
%babelprovide{greek,english}
%babelfont{rm}[Ligatures={Common,Rare}, Scale=1.0]{Libertinus Serif}
%babelfont{sf}[Ligatures={Common,Rare}]{Libertinus Sans}
%babelfont{tt}{Libertinus Mono}
%
%babelfont[Language=greek]{rm}{Kerkis}
%babelfont[Language=greek]{sf}{Kerkis}
%babelfont[Language=greek]{tt}{kerkis}
%setDefaultTransitions{selectlanguage{english}}{selectlanguage{english}}
%setTransitionTo{GreekAndCoptic}{selectlanguage{greek}}
begin{document}
some text
blabla μπλαμπλα
newpage
tableofcontents
newpage
section{Introduction-Εισαγωγή}
subsection{test}
end{document}
Answered by Cicada on April 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP