TransWikia.com

lf becoming fl and if becoming fi

TeX - LaTeX Asked by Dr. Y. Chahlaoui on February 8, 2021

I’m creating a glossary between English and Arabic words.

newglossaryentry{glos:halfsp}{name=Half-Spaces,text={myLR{$Half$-Spaces}},description={أنصاف الفضاء}}

is giving Hafl-Spaces in the pdf file.

In the preamble, I am using

usepackage{polyglossia}
setmainlanguage[locale=morocco]{arabic}
setotherlanguage{english}

newfontfamilyenglishfont[Scale=1]{Amiri}
newfontfamilyarabicfont[Script=Arabic,Scale=1.2]{Amiri}

As I am writing a book in Arabic.

I have tried many things without solutions.
Any help?

As a sample:

documentclass[12pt,a4paper]{report}

usepackage{glossaries}
usepackage{glossary-mcols}
renewcommand*{glspostdescription}{hfill}

makeglossaries


usepackage{polyglossia}
setmainlanguage[locale=morocco]{arabic}
setotherlanguage{english}

newfontfamilyenglishfont[Scale=1]{Amiri}
newfontfamilyarabicfont[Script=Arabic,Scale=1.2]{Amiri}


newglossaryentry{glos:halfpln}{name=Half-Plane,text={LR{Half-Plane}},description={نصف المستوى}}

begin{document}

gls{glos:halfpln}
end{document}

2 Answers

The one solution that I could use (any other sols?) is to replace Half-Plane by begin{english}Half-Planeend{english} everywhere in the glos file

It is working

Answered by Dr. Y. Chahlaoui on February 8, 2021

The problem is that you aren’t selecting the English language, so you’re still loading Amiri with the Script=Arabic option. As you note in your self-answer, explicit language tagging solves this problem. You could write textenglish{half-plane} as shorthand.

If you want the document to change languages automatically whenever you change script, babel supports that. This template compiles with LuaLaTeX from 2020 or later:

documentclass[12pt,a4paper]{report}
tracinglostchars=2

usepackage{glossaries}
usepackage{glossary-mcols}
renewcommand*{glspostdescription}{hfill}

makeglossaries

% Requires LuaHBTeX, or LuaLaTeX from 2020 or later.
usepackage[bidi=basic, layout=sectioning]{babel}
usepackage{unicode-math}

babelprovide[import=ar-MA, main, onchar=ids fonts]{arabic}
babelprovide[onchar=ids fonts]{english}

defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz}

babelfont{rm}
          [Scale=1.0, Ligatures=Common, Script=Default, Language=Default]{Libertinus Serif}
babelfont[arabic]{rm}
          {Amiri}
babelfont{sf}
          [Ligatures=Common, Script=Default, Language=Default]{Libertinus Sans}
babelfont[arabic]{sf}
          [Language=Default]{Noto Sans Arabic}
babelfont{tt}
          [Script=Default, Language=Default]{Libertinus Mono}
babelfont[arabic]{tt}
          {ALM Fixed}

setmathfont{Libertinus Math}

babeltags{english=english}
babeltags{Arabic=arabic}

newglossaryentry{glos:halfpln}{name=Half-Plane,text={Half-Plane},description={نصف المستوى}}

begin{document}
chapter{A Chapter}

gls{glos:halfpln}
printglossaries

للُّغَة العَرَبِيّة هي أكثر اللغات السامية تحدثاً، وإحدى أكثر اللغات انتشاراً في العالم، يتحدثها أكثر من 467 مليون نسمة،

begin{english}
Arabic (اَلْعَرَبِيَّةُ, al-ʿarabiyyah, [al ʕaraˈbijːa] or عَرَبِيّ‎, ʿarabīy, [ˈʕarabiː]
or [ʕaraˈbij]) is a Semitic language that first emerged in the 1st to 4th
centuries CE.
end{english}

end{document}

Amiri/Libertinus sample

A few notes. I still used a bit of language tagging, which was actually for the IPA characters. It’s possible to tweak which characters are considered part of which language, but in a more complex document that needs to interpret the same characters multiple ways, you might need to go back to manual tagging.

I selected Khaled Hosny’s Libertinus family (based on Linux Libertine) as the companion English and math fonts for his Amiri. They are both attractive in themselves and a close match. I also loaded sans-serif and fixed-width Arabic fonts, which you are free to change.

All documents that use different fonts for different scripts should include the command tracinglostchars=2. This prints a warning when a character is missing from the current font, instead of logging the error silently.

If you want the numerals and counters to use different forms, you can give options such as maparabic and alph=alphabetic.

Answered by Davislor on February 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP