Comments (9)
I’m making some tests with and without babel
, and the result is always the same (the left image). If the pink rectangle is the bounding box, then the spacing is the same even in your images, except the comma comes from different fonts and we can expect the result differs. Note there is a tiny space before the comma in the left image inside the rectangle. I’d say there was a bug in italian
recently fixed, because the expected result is the left one.
from babel.
@jbezos Thank you for testing. In my understanding, the pink rectangle is probably not the bounding box (at least I have not added the pink highlighting via LaTeX commands). The pink highlighting is added by diffpdf
to show where the output (visually, in our case) differs. Concerning the fonts: any idea which two fonts the two commas might come from?
As for the expected result … The form of the letter 𝑇 suggests that whatever glyph is low and goes to right of 𝑇 usually needs less gap than if the following glyph has the height of, say, 𝑥 or even ℎ. (Of course, this is just the usual case based on the form of the glyphs, whereas the semantics of what is being typeset may require adding or removing horizontal space.)
To reproduce the tight spacing for the input stated, I needed an extra machine with a stock Debian TeX Live 2023 having babel 3.84 and italian 2022/03/07 v.1.4.07. Alternatively, use an older TeX Live (I tested 2020).
from babel.
After more testing attempts with \showoutput
, I found out that the output produced with the stock Debian TeX Live 2023 (and hence slightly older packages) is wrong on the comma (it is wrongly taken from cmm) but, in the eyes of the user (and not necessarily in the eyes of lualatex), is correct on producing no kern between 𝑇 and the comma.
With the current up-to-date TeX Live 2023, it's the other way round: the comma is correctly taken from TeX Gyre Termes Math, but there is a useless \kern1.05 (italic)
between 𝑇 and the comma. This seems to be independent of babel or babel-italian. If you also see it this way, please feel free to close the bug report. (After all, reproducibility on my side is not reliable, so I might be very wrong.)
from babel.
It comes down to a font design decision (or a font bug) as far as I can tell.
There is no "useless kern". What you see is the italic correction of the character T and that gets inserted due to rule 17 of math formula processing (TeXbook 445): The current math atom is a simple symbol (i.e. T) and \fontdimen2 of the font is 0pt (which it is) then add an italic correction which is the kern you see, hence called (italic) by luatex. If you use $TT,$
you see the same kern also after the first T.
Now if you drop all the fontsetting (and unicodemath) and use the default fonts (which is Computer modern math) then the situation changes slightly, you then see
....\OML/cmm/m/it/10 T
....\kern1.3889 (italic)
....\OML/cmm/m/it/10 T
....\kern1.3889 (italic)
....\kern-0.55556 (font)
....\OML/cmm/m/it/10 ;
i.e. there is an extra negative kern labeled (font) that undoes most of the italic correction. That appears to be a kerning specification in cmmi10.tfm and in fact it is. We do find there:
(CHARACTER C T
(CHARWD R 0.584376)
(CHARHT R 0.683332)
(CHARIC R 0.13889)
(COMMENT
(KRN O 75 R -0.027779)
(KRN O 73 R -0.055555)
(KRN O 72 R -0.055555)
(KRN O 177 R 0.083336)
)
)
Octal 73 is our "," 72 would be "." and 75 a "/".
Such a kerning correction is not present in TeX Gyre Termes hence the wider spacing. It is also not present in Latin Modern Math and one could argue that this is a font bug as Latin Modern attempts to provide a similar appearance as Computer Modern.
from babel.
… \fontdimen2 of the font is 0pt (which it is)
It is not:
\documentclass[italian,ngerman]{article}
\usepackage[italian,main=ngerman]{babel}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
\((T
\the\fontdimen2\font
,{\le})\)
\end{document}
yields “(𝑇 3.33𝑝𝑡, ≤)”, and 3.33pt ≠ 0.
from babel.
You can't query the current font this way in a math formula. What you test there is really what the fontdimen2 of lmr is. At the point \the\fontdimen2
is executed the math formula has not been converted from atoms to fonts glyphs so it is the outer font that you see.
Try \showthe\font
at this point. Or alternatively put
\fontencoding{OML}\fontfamily{cmm}\selectfont
before the whole formula and see what is happening.
from babel.
@FrankMittelbach Thx; I see!
As for adapting to the italic correction, if we repair the font locally with fontforge (say, for \mathitalicsmode=2
), what would good pairwise kerns for TeX Gyre Termes Math be? -28 for “𝑇/”, -56 for “𝑇,”, -56 for “𝑇.”, and 83 for “𝑇⁀”? I have no intuition on how to choose the values exactly.
from babel.
I’m closing this issue because it’s not directly related to babel
. By the way, \the\fontdimen2\font
returns the value of the current text font.
from babel.
@FrankMittelbach Thx; I see!
As for adapting to the italic correction, if we repair the font locally with fontforge (say, for
\mathitalicsmode=2
), what would good pairwise kerns for TeX Gyre Termes Math be? -28 for “𝑇/”, -56 for “𝑇,”, -56 for “𝑇.”, and 83 for “𝑇⁀”? I have no intuition on how to choose the values exactly.
This is really a font design question and also a matter of taste. In my opinion this is would be best addressed by the TeX Gyre designers rather than individuall adjusted. So I suggest you bring that to their attention and see if they are willing to make adjustments.
Please also note that given the license of the fonts you should probably not alter them without renaming them. Even if you do it just for yourself, such changes tend to spread over time even if this wasn't the original intention and it is just not good if different installations produce different results just because some font metrics have been altered.
from babel.
Related Issues (20)
- Interaction between babel and ltxtable HOT 15
- hbox inside equation is problematic HOT 5
- An outdated link in doc
- \endotherlanguage leaves @ignore globally true HOT 17
- TL2024 + latex or pdflatex + norsk = “! Missing number, treated as zero.” HOT 15
- [british]babel should spit out a warning of a noticeable kind if hyphen-english is missing HOT 9
- Tibetan line breaks HOT 3
- Problems with \Ref and babel (The Latex Companion 3rd edition p.78) HOT 2
- Rollback option for .ldf files HOT 5
- Estonia babel won't compile due to missing headtoname HOT 2
- Spurious space in welsh.ldf HOT 3
- \babelfont fails with some fonts as of recent update HOT 2
- Change first item in abjad alph counter for Algeria, Morocco and Tunisia. HOT 2
- Incompatibility with igo gameborard typesetting package HOT 2
- eqref is misaligned when placed above equal sign in align and gather environments
- LuaLaTeX + babel + hyperref: extraneous = HOT 5
- Fix Finnish typo HOT 2
- Vietnamese warnings with babel and biblatex
- Bidi: Insert paragraph indent according to its direction HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel.