LaTeX forum ⇒ XeTeX-- en-dash problem

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

-- en-dash problem

Postby victorclaessen » Wed Jan 19, 2011 10:41 pm

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:

  1. \documentclass[b5paper,10pt,twoside,openright]{memoir}
  2.  
  3. \usepackage{xltxtra}
  4. \usepackage{fixltx2e}
  5.  
  6.  
  7. \setromanfont{Arno Pro}
  8.  
  9. \begin{document}
  10. -
  11. \\
  12. --
  13. \\
  14. ---
  15. \\
  16. \textendash
  17. \\
  18. \textemdash
  19. \end{document}
Last edited by victorclaessen on Thu Jan 20, 2011 1:49 am, edited 1 time in total.

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

Postby frabjous » Thu Jan 20, 2011 12:06 am

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:

  1. \defaultfontfeatures{Mapping=tex-text}

or equivalently
  1. \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

Postby victorclaessen » Thu Jan 20, 2011 1:48 am

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.

  1. ! Package xkeyval Error: `TeX' undefined in families `Ligatures'.
  2.  
  3. See the xkeyval package documentation for explanation.
  4. Type H <return> for immediate help.
  5. ...
  6.  
  7. 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

Postby frabjous » Thu Jan 20, 2011 2:51 am

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.


Return to “XeTeX”

Who is online

Users browsing this forum: No registered users and 2 guests