Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Disable ligatures for mono font #2

Closed
yongrenjie opened this issue Jan 11, 2023 · 0 comments
Closed

Disable ligatures for mono font #2

yongrenjie opened this issue Jan 11, 2023 · 0 comments

Comments

@yongrenjie
Copy link
Owner

\defaultfontfeatures{Ligatures=TeX}
% Main fonts used in the document
\setmainfont[
Path={/Users/yongrenjie/Library/Fonts/},
Extension=.otf,
UprightFont={*-regular},
BoldFont={*-semibold},
ItalicFont={*-italic},
BoldItalicFont={*-semibolditalic},
]{minion3}
\setmonofont[
Path={/Users/yongrenjie/Library/Fonts/},
Extension=.ttf,
UprightFont={*-Regular},
BoldFont={*-SemiBold},
ItalicFont={*-Italic},
BoldItalicFont={*-SemiBoldItalic},
Scale=MatchLowercase
]{RobotoMono}
\setmathfont[
Path={./fonts/},
Scale=MatchLowercase
]{LibertinusMath-Regular.otf}
\mathitalicsmode=1

The use of \defaultfontfeatures{Ligatures=TeX} here is applied to all fonts, including the monospace font. For some reason, this leads to double quotes in code listings turning into curly quotes (I have no clue why it doesn't happen to single quotes).

Because TeX ligatures are by default applied to setmainfont (see fontspec documentation https://texdoc.org/serve/fontspec/0 Part II, section 1), commenting this out should ensure that TeX ligatures are still used for the text (in Minion) but not for the listings such as this one:

thesis/noah/parallel.tex

Lines 176 to 181 in e25af25

\begin{mylisting}[!htbp] % lst:generalised_pp {{{1
\begin{tcbminted}{bruker}
"l0 = td1/2" ; TD1/NBL
"cnst53 = cnst51 - cnst52" ; automatically calculate m_2 = M - m_1
; ...

That should fix the curly double quotes in the listings.

In principle I think I should re-add TeX ligatures for the math font because I really don't know if I've used them somewhere. It would be very odd for that to be the case, but anyway it can be done by just adding Ligatures=TeX as another option in \setmathfont.

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

No branches or pull requests

1 participant