How to get straight quotation marks?

I found this post in the last few days while searching for an answer to the same problem. I'm also using XeLaTeX, and also need fontspec, so I feel your pain. I tried all kinds of things, which I won't list here.

Here's the solution I came up with:

As you discovered, the Mapping=tex-text option is what is changing the straight quotes to curly (no matter what). As you also saw, removing it results in no curly quotes anywhere. That's no good either.

The standard XeLaTeX template in TeXShop (I've excluded the sans and mono font declarations) has:

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text]{Hoefler Text}

I decided to define a new font, using the same typeface as the roman font, but not include any mapping.

\newfontfamily{\S}{Hoefler Text}

As a final step, the \defaultfontfeatures{Mapping=tex-text} line must be deleted or commented out. If not, it adds mapping to all font declarations. I suppose that's meant to be helpful in case one forgets it, but in this case, it's holding us back. Since \setromanfont above already declared its mapping, removing it as a default feature won't alter the appearance of normal typing, giving you access to curly quotes.

The altered preamble section will then be:

\usepackage{fontspec,xltxtra,xunicode}
%\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text]{Hoefler Text}
\newfontfamily{\S}{Hoefler Text}

When you need straight quotes, put them within the custom font call. Since there is no mapping, you will get finally them.

The ``antique'' table is 5{\S '}6{\S "} long.

I set custom commands to make writing easier.

\newcommand{\inch}{{\S "}}
\newcommand{\feet}{{\S '}}

This allows me to write:

The ``antique'' table is 5\feet 6\inch\ long.

I hope this helps. I was creating a 100+ page document, and needed both curly and straight quotes frequently. This is the only thing I've tried that works, period. If there is a more elegant way (in XeLaTeX with fontspec), I'd love to learn it. I've only been using TeX/XeLaTeX for 2-3 months, so I'm kind of a newbie.


alt text

Using \usepackage[T1]{fontenc} is @TH's idea. I just add \usepackage{upquote} to provide a single straight quote using \textquotesingle.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{upquote}

\begin{document}

\textquotesingle single straight quote\textquotesingle\ 
and "double straight quote"

\vspace{5mm}

`single curly quote' and ``double curly quote''
\end{document}

enter image description here

The LaTeX encoding specific commands for quotes of various sorts are listed below. The first group are defined in (at least) T1 encoding and the second group are defined in (at least) TS1 encoding. If in addition to loading the encodings (via \usepackage[TS1,T1]{fontenc} the TS1 encoding is loaded via \usepackage{textcomp} then in addition to declaring the TS1 quotes for TS1 encoding, this is made the default encoding, so if you use \textquotesingle in an encoding for which the straight quote is not declared then LaTeX will switch to TS1 encoding just for this character.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{textcomp}

\def\showq#1{\texttt{\string#1}&abc#1xyz\\}

\begin{document}


\begin{tabular}{ll}
\multicolumn{2}{c}{T1}\\
\showq\quotedblbase
\showq\quotesinglbase
\showq\textquotedblleft
\showq\textquotedblright
\showq\textquotedbl
\showq\textquoteleft
\showq\textquoteright
\multicolumn{2}{c}{TS1}\\
\showq\textquotestraightbase
\showq\textquotestraightdblbase
\showq\textquotesingle
\end{tabular}

\end{document}

It's advisable to use \textquotedbl rather than simply " to get straight double quotes even if your document encoding is T1. These will produce the same character (and " is easier to type) but using \textquotedbl will make your text more easily usable if it is reused in other contexts that may be set up to use other default encodings.