XeTeX-- en-dash problem

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
victorclaessen
Posts: 12
Joined: Thu Dec 16, 2010 2:09 pm

-- en-dash problem

Post by victorclaessen »

Hi,

I'm using XeLaTeX to write a thesis using the Arno Pro font. I've noticed that -- isn't automatically translated to an en-dash when I use that font. However when I type \textendash, I *do* get an en-dash. Why is this happening? And can I fix it?

Kind regards,

Vic

Minimal (ok ok quasi-minimal) working example:

Code: Select all

\documentclass[b5paper,10pt,twoside,openright]{memoir}

\usepackage{xltxtra}
\usepackage{fixltx2e}


\setromanfont{Arno Pro}	

\begin{document}
-
\\
--
\\
---
\\
\textendash
\\
\textemdash
\end{document}
Last edited by victorclaessen on Thu Jan 20, 2011 1:49 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

-- en-dash problem

Post by frabjous »

You need to make sure you're using the tex-text mapping.

You can do this font-by-font, but it's easiest just to do once and for all with the command:

Code: Select all

\defaultfontfeatures{Mapping=tex-text}
or equivalently

Code: Select all

\defaultfontfeatures{Ligatures=TeX}
in your preamble. I usually do this right after loading the fontspec package. (fontspec is loaded by xltxtra in your case.) See sec. 12.1 of its manual.
victorclaessen
Posts: 12
Joined: Thu Dec 16, 2010 2:09 pm

-- en-dash problem

Post by victorclaessen »

Thanks! The first line solved it.

I also tried the second line, but if I add that (right after xltxtra), then I get this error.

Code: Select all

! Package xkeyval Error: `TeX' undefined in families `Ligatures'.

See the xkeyval package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.28 \setromanfont{Arno Pro}
But (to me) that is not important, because the first line worked well.

Thanks again!

Vic
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: -- en-dash problem

Post by frabjous »

The commands do the same thing so you certainly don't need both. I'd guess, however, that you're using an older version of fontspec than I am, in which case the command is what you need anyway.
Post Reply