TeX - LaTeX Asked by Alex Roberts on May 30, 2021
When I use ucharclasses
with XeLaTeX to automatically change the font for Greek text, I find that it sometimes inserts transitions at the wrong point, within the Greek text. (Note: I am using the GreekExtended
option of ucharclasses
because my Greek text uses accents and breathing marks of various sorts as is conventional in typesetting ancient Greek.)
In particular, it looks like it works fine if the first character of Greek has an accent or breathing mark on it but not (or not always) otherwise. (This question appears to be related to this one, but I’m not sure how to apply the partial answers given there to my issue.)
Is there some way to fix this?
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
documentclass[12pt]{article}
usepackage{fontspec}
newfontfamilydefaultfont[Mapping=tex-text]{Times}
newfontfamilygreekfont{Gentium}
usepackage[Latin, GreekExtended]{ucharclasses}
setDefaultTransitions{defaultfont}{}
setTransitionsForGreek{greekfont}{}
begin{document}
Latin text.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
end{document}
The output is correct, with the Latin in Times
and the Greek in Gentium
, the fonts I chose to use for each.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
documentclass[12pt]{article}
usepackage{fontspec}
newfontfamilydefaultfont[Mapping=tex-text]{Times}
newfontfamilygreekfont{Gentium}
usepackage[Latin, GreekExtended]{ucharclasses}
setDefaultTransitions{defaultfont}{}
setTransitionsForGreek{greekfont}{}
begin{document}
Latin text.
μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
end{document}
This time, with the first word deleted, the fonts are now incorrect: in particular, the first word, μοι, appears in the Times
font (which I had set as the default font), even though the rest of the Greek text appears in the Gentium
font (which I had set as the Greek font).
GreekExtended
covers this range of unicode:
do{GreekExtended}{"01F00}{"01FFF}
Greek
is a class which combine four ranges:
defGreekClasses{
do{Coptic}
do{CopticEpactNumbers}
do{GreekAndCoptic}
do{GreekExtended}
}
These cover
do{GreekExtended}{"01F00}{"01FFF}
do{GreekAndCoptic}{"0370}{"03FF}
do{Coptic}{"02C80}{"02CFF}
do{CopticEpactNumbers}{"0102E0}{"0102FF}
and include the GreekExtended.
So Greek
is the more general setup.
Correct answer by Ulrike Fischer on May 30, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP