mtheme icon indicating copy to clipboard operation
mtheme copied to clipboard

Re-enable TeX ligatures in XeTeX.

Open m-oliver opened this issue 9 years ago • 11 comments

The font theme on XeLaTeX does not enable the regular TeX ligatures. This issue is discussed, for example, in

https://tex.stackexchange.com/questions/37855/fontspec-with-helvetica-breaks-quotes

This one-line patch implements one of the solutions suggested on Stackexchange.

m-oliver avatar Feb 12 '16 15:02 m-oliver

Seems you are affected by the same problem as reported by me in #154. fontspec does in fact enable ligatures but you probably have an older fontspec version.

@benjamin-weiss: what exactly was speaking against enabling TeX ligatures by default?

matze avatar Feb 13 '16 17:02 matze

First of all the line should be

\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}

because we don't want ligatures for the monospaced font.

The downside of adding it to the theme is, that if somebody uses a custom fontspec.cfg file the defaultfontfeatures settings in it will be overwritten by the theme. And I don't think we should do that if not absolutely necessary.

And yes you are right: it is a default setting now for over 2 years, so @m-oliver should probably update his TeX distribution.

benjamin-weiss avatar Feb 14 '16 03:02 benjamin-weiss

Thanks for the replies. I am on Fedora 23 and realize that they are still on TeXlive 2014. It's easier for me to patch up the theme than to update the distribution manually, especially given that I need this for a collaborative project and cannot expect everybody to update their TeX just for the beamer theme. But of course you may have different priorities for the master branch, which is fine. (Personal remark: I like your theme and it's a bit of a shame that it does not run with a fontspec file dated May 23, 2014, which is a bit less than two years. I have yet to meet anybody messing with their fontspec.cfg, but having older TeX installations around is faily common, for the better or worse...)

m-oliver avatar Feb 14 '16 17:02 m-oliver

... it's a bit of a shame that it does not run with a fontspec file dated May 23, 2014.

Sorry, but I don't see it that way. The theme runs fine with this version (afaik) and it just respects your local fontspec settings. If you want to have ligatures then you just have to add

\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}

to your preamble, like you have to with every other document you typeset on your system using fontspec.

But you are right i mixed up the months and days in the date notation in the change log. So it is not yet a default setting for two years. Version 2.4 was released June 01, 2014. So they unfortunately missed the TeX Live 2014 deadline by some days.

@matze What is your take on this issue? We already have seen that I am a bit too hostile to old versions. :smirk: Is adding some infos to the "Known Issues" section enough here or should we overwrite the default font features?

benjamin-weiss avatar Feb 15 '16 04:02 benjamin-weiss

The problem is that adding \defaultfontfeatures to the preamble does not help. It seems to be necessary to patch the font theme, adding this command after loading the fontspec package and before \setXXXfont.

m-oliver avatar Feb 15 '16 23:02 m-oliver

I don't see a problem there. But I could be wrong, as I don't have an old fontspec version at hand right know to test it. Just load fontspec before loading the theme and set the defaultfontfeatures as you want them.

\documentclass{beamer}

\usepackage{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}
\usetheme{metropolis}

\begin{document}
\begin{frame}{Ligatures Test}
    \begin{itemize}
        \item fi
        \item fl
    \end{itemize}
\end{frame}
\end{document}

benjamin-weiss avatar Feb 15 '16 23:02 benjamin-weiss

Benjamin Weiss writes:

\usepackage{fontspec} \defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX} \usetheme{metropolis}

Sure, that's the next logical step in reverse engineering - I realized just after I sent the last message. I still don't think that these are the details you'd want to expose to the user. Surely there must be a way to make sure that the defaults are reasonably set even when they aren't and stilll get out of the way of users who manually override their defaults?

m-oliver avatar Feb 16 '16 09:02 m-oliver

Hmm, maybe we could check for the package version and implement it like this:

\@ifpackagelater{fontspec}{2014/06/01}{}{%
    \defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}
}%

benjamin-weiss avatar Feb 16 '16 09:02 benjamin-weiss

If this works, I'd definitely include it. Better than annoying people stuck with older TeX distributions [like myself ;-)]

matze avatar Feb 22 '16 11:02 matze

Was anything decided about this? More than 3 years passed.

XVilka avatar Sep 14 '19 09:09 XVilka

Hmm, maybe we could check for the package version and implement it like this:

\@ifpackagelater{fontspec}{2014/06/01}{}{%
    \defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}
}%

I don't think this is necessary in 2020. I suggest to close this pull request without merge.

rriemann avatar Apr 24 '20 18:04 rriemann