2

When producing en- or em-dashes with fontspec enabled i XeLaTeX, the ligatures are not produced, it simply prints -- and ---.

MWE:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine}
% \usepackage{libertine}

\begin{document}

So let's try an en-dash: 32--34 wonder what that will look like? 
How about the em-dash---does it makes any difference?

\end{document}

Produces this result:

enter image description here

If in stead I load the commented Libertine-package instead, everything works fine and produces the following output:

enter image description here

Any suggestions?

  • You may want to load package libertine. It takes care of all this stuff and provides you with other useful macros. It also sets biolinum as the sans font (but you can prevent that giving the option rm). – Johannes_B Oct 27 '14 at 7:43
  • 1
    You probably have an old version of fontspec, because the last version sets Ligatures=TeX by default. – egreg Oct 27 '14 at 7:45
  • @Johannes_B As I wrote in my question, that is a solution, but my question was why it didn't work with fontspec. – Stenskjaer Oct 27 '14 at 8:04
  • libertine does the exact same thing internally. It tests for the engine and loads fontspec itself. Less trouble for you. – Johannes_B Oct 27 '14 at 8:07
7

To enable the TeX-Shortcuts, setting the fonts should look like this:

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine}

To your preamble.

Edit: as of TL2015, this is now the default behavior.

  • This does not solve the problem, but using \setmainfont[Ligatures=TeX]{Linux Libertine} does (as implied by @egreg in his comment to my question). – Stenskjaer Oct 27 '14 at 8:02
  • 1
    Did you add the command before setting libertine as font? – MaxNoe Oct 27 '14 at 8:06
  • My bad, you're right. – Stenskjaer Oct 27 '14 at 8:10
  • Should have mentioned it ;) I improved my answer. – MaxNoe Oct 27 '14 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.