Latex turnoff lualatex ligatures #5790
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #5179. Notice that also
-{}-
mark-up (cf.sphinx/sphinx/util/texescape.py
Lines 45 to 46 in 415ebc1
where the invisible escaped character is a U+FEFF ZERO WIDTH NO-BREAK SPACE)
which prevents ligatures with pdflatex and xelatex does not prevent it with lualatex. This PR fixes that, too.
This is a bugfix but not applied to 1.8 branch because due to the fact LuaLaTeX is configured on 1.8 branch to not modify the default fonts (Latin Modern) chosen by
fontspec
, it would need different approach to turn off the automatic TeX ligatures, this PR works by disabling TeX ligatures for any font configured after loading of fontspec.(besides the
fontspec
manual is obscure about exact syntax, it mentions..Off
orNo..
variants which do not work at all, so it is quite a mess).The method here is to not complicate our TeX escaping, keep it the same, but make sure fonts are loaded without the automatic
Ligatures = TeX
done by fontspec by default (LuaLaTeX contrarily to XeLaTeX applies ligature even if mark-up is like\textgreater{}\textgreater{}
or-{}-
).But this requires 2.0, because workaround needs that
\setmainfont
,\setsansfont
are explicitly used at least once after loadingfontspec
, thus either by user custom choice of fonts, or Sphinx default font choice as done inLUALATEX_DEFAULT_FONTPKG
.