Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is my MWE:

%!TEX TS-program = xelatex
\documentclass[a4paper]{report}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Times New Roman}

\begin{document}
``abcde''
\end{document}

This produces:

enter image description here

If I comment out the \defaultfontfeatures line, the result is:

enter image description here

If I remove both that and the use of xltxtra (and obviously the \setromanfont), I get:

enter image description here

So the question is: what is happening to the quotation marks? What does xltxtra do to them and what does \defaultfontfeatures do?

share|improve this question
    
OK OK, \setromanfont is not necessary, but I don't want to redo the screenshots just to remove it :). –  MickG Jul 26 at 19:58
    
Do you know what version of xelatex / xltxtra you are using? I cannot reproduce this on TeXLive 2014 with XeLaTeX 3.14159265-2.6-0.99991 and xltxtra v0.5e. I always get smart quotes... –  ig0774 Jul 26 at 20:15
    
TeXShop's console tells me This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013) restricted \write18 enabled.. As for xltxtra, on the .sty I find 2010/09/20 v0.5e Improvements for the "XeLaTeX" format. –  MickG Jul 26 at 20:19
1  
Would you please change the example word? Don't force me to do it. I know what the word means. –  egreg Jul 26 at 20:27
    
It appears newer versions of fontspec set the Ligatures=TeX option by default which implies Mapping=tex-text. xltxtra sets Mapping=tex-text for the default fonts it sets, hence, your invocation of \setromanfont removes that mapping. I'm not sure what causes the behaviour of your third iteration. –  ig0774 Jul 26 at 20:29

1 Answer 1

up vote 7 down vote accepted

Some years ago, the package xltxtra was recommended for usage with XeLaTeX, but it isn't any more. To the contrary, it is not recommended to load xltxtra, unless you really need its extra functions (you usually don't).

The \setromanfont command has been deprecated some years ago, favoring the clearer command \setmainfont. The Mapping=tex-text option has been changed into

Ligatures=TeX

and, with the most recent version of fontspec on TeX Live 2014 it is even unnecessary to specify it. So, with an up-to-date TeX distribution, the correct code is

\documentclass[a4paper]{report}

\usepackage{fontspec}

\setmainfont{Times New Roman}

\begin{document}
``parola''.
\end{document}

On an older TeX distribution such as TeX Live 2013, you need

\setmainfont[Ligatures=TeX]{Times New Roman}

Don't specify the option in \defaultfontfeatures, because it would affect also the monospaced font (in case you declare it) and you don't want that.


Now to your question.

  1. The Ligatures=TeX option (formerly Mapping=tex-text) makes the usual ligatures to work also with XeLaTeX; so `` is mapped to , '' to , -- to the en-dash, --- to the em-dash (there are some others). This explains the first case

  2. If you remove the Ligatures=TeX option, these ligatures are not defined, so you get `` and '' as expected.

  3. If you don't load fontspec (done by xltxtra), XeLaTeX loads the usual fonts, which do have the ligatures. But, of course, accented characters will probably not work.

  4. If you load fontspec but don't use \setmainfont, the standard Latin Modern fonts are used, which are preloaded with Ligatures=TeX.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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