Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Doesn’t Work Properly in LaTeX With multicols and babel #149

Closed
amarakon opened this issue Mar 15, 2023 · 9 comments
Closed

[Bug] Doesn’t Work Properly in LaTeX With multicols and babel #149

amarakon opened this issue Mar 15, 2023 · 9 comments

Comments

@amarakon
Copy link

I noticed a bug in LaTeX that happens with only this font, but no other font that I've tried. If you try to use babel and multicols together, and add a paragraph end before \end{otherlanguage}, only the last page of the document will be properly compiled. The other pages will look like the text has been pushed far to the left. The reason I want to put a paragraph end before \end{otherlanguage} is to work around another bug I found in the linebreaker LaTeX package. I will provide a minimum working example along with screenshots.

\documentclass{book}

\usepackage{multicol, lipsum, linebreaker}
\usepackage[bidi = basic]{babel}

\babelprovide[main, import]{english}
\babelprovide[import]{arabic}

\babelfont[english]{rm}{EB Garamond}
\babelfont[arabic]{rm}{Amiri}

\begin{document}

\begin{multicols}{2}
	\lipsum[1-6]

	\begin{otherlanguage}{arabic}
		لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم
		نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد
		يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن
		السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف
		الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم
		ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي.

	\end{otherlanguage}
\end{multicols}

\end{document}

If you replace EB Garamond with any other font, such as Libertinus Serif, you will get the expected result.

@amarakon
Copy link
Author

Actually, it also happens with Junicode Two Beta, but not Junicode. Weird. I don’t know what’s causing this problem, the fonts themselves, or a LaTeX package.

@georgd
Copy link
Owner

georgd commented Mar 17, 2023

I can reproduce it. But only with RTL fonts in the second column. It’s weird, but I have no idea why. As far as I understand things, this macrotypographic effect shouldn’t be provoqued by the font. The only things I can think of where the features of the font influence the typeset lines are the settings for vertical metrics and the opbd opentype feature. I don’t think that EBG’s vertical metrics are too special but the opbd features (lfbd and rtbd) which allow for setting character protrusion from within the font (as in the microtype package) are not at all commonly found in fonts. Junicode Two Beta however doesn’t have this feature. I’m clueless.

@khaledhosny
Copy link

That is highly unlikely to be a font issue. You might get a better answer asking on https://tex.stackexchange.com.

@amarakon
Copy link
Author

Okay, I posted a question on https://tex.stackexchange.com.

@georgd
Copy link
Owner

georgd commented Mar 20, 2023

OK, thanks! I’ll close this issue. Please, feel free to reopen it if some bug of the font is found to be involved.

@georgd georgd closed this as completed Mar 20, 2023
@hpvd
Copy link

hpvd commented Mar 20, 2023

not sure if this is helpful in this case, but when
enabling microtype package, I got some font specif warnings not shown with other fonts:

Package microtype Warning: Unknown slot number of character
(microtype) /f.long' (microtype) in font encoding TU' in inheritance list
(microtype) `mt-EBGaramond.cfg/962(protrusion)'.

Package microtype Warning: Unknown slot number of character
(microtype) /f.short' (microtype) in font encoding TU' in inheritance list
(microtype) `mt-EBGaramond.cfg/962(protrusion)'.

Package microtype Warning: Unknown slot number of character
(microtype) /u.LATmedi' (microtype) in font encoding TU' in inheritance list
(microtype) `mt-EBGaramond.cfg/962(protrusion)'.

@hpvd
Copy link

hpvd commented Mar 20, 2023

code to reproduce:

\documentclass[12pt,a4paper]{book}

\usepackage{lipsum}

\usepackage[bidi = basic]{babel}

\babelprovide[main, import]{english}
\babelfont[english]{rm}{EB Garamond}

\usepackage{microtype}

\begin{document}

\twocolumn
	\lipsum[1-5]

\end{document}

@georgd
Copy link
Owner

georgd commented Mar 20, 2023

Thanks for calling my attention on this. What you see is because protrusion setting in microtype for EB Garamond references glyphs that aren’t available in the font you’re using. That’s because the default installation uses Octavio Pardo’s variant (i.e. the Google Fonts one). For easier compatibility with their tools he changed some of the glyph names and for other reasons he dropped some of the glyphs and features. Obviously not all of them were catched when microtype was updated for that font version.

When I compile your code here, microtype complains about the figure glyphs missing, as the fonts from this repository use a different naming scheme.

My plan is to merge the two versions during the months to come and re-add the dropped features and glyphs, so this message should go away, eventually.

@kess
Copy link

kess commented Mar 20, 2023

@georgd That sounds like music in my ears. I have patiently been waiting for years to hear that, and I can wait years more if needed. EB Garamond is still my go-to font for personal documents.

I really appreciate all the time and effort that all of you are putting into this font!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants