[Tex/LaTex] XeLatex and greek quotation marks

greekpunctuationxetex

Background: «» are the greek analogues of the English quotation marks "".

Goal: To be able to write "quote" in my .tex file and have XeLateX render it as «quote».

Minimal test case that fails for me: taken from here

\documentclass[twoside,a4paper, 12pt]{article}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Ligatures=TeX}
\setmainfont{Times New Roman}
\newfontfamily\greekfont[Script=Greek]{Times New Roman}
\usepackage{polyglossia}
\setdefaultlanguage{greek}
\setotherlanguage{english}
\begin{document}
Outside ``english'' environment --

\begin{english}
``Quotes'' -- inside english environment  
\end{english}

\begin{greek}
  ``Ελληνικό'' -- περιβάλλον
\end{greek}

``Ελληνικά''
\end{document}

Output:

enter image description here

System specs:

% xelatex --version
XeTeX 3.1415926-2.6-0.9999.3 (TeX Live 2014/dev)
kpathsea version 6.2.0dev
( ... snip ... )
Compiled with ICU version 50.1.2; using 50.1.2
Compiled with zlib version 1.2.8; using 1.2.8
Compiled with FreeType2 version 2.5.0; using 2.4.12
Compiled with Graphite2 version 1.2.2; using 1.2.2
Compiled with HarfBuzz version 0.9.27; using 0.9.27
Compiled with fontconfig version 2.11.0; using 2.11.0
Compiled with libpng version 1.6.3; using 1.6.6
Compiled with poppler version 0.24.3

Note: I already know that I can insert them as unicode characters, yet I'd like to be able to use " " 🙂

Best Answer

Use the csquotes package. But I wouldn't: use the real quotes you want to see.

\documentclass[twoside,a4paper, 12pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}

\defaultfontfeatures{Ligatures=TeX}

\setmainfont{Times New Roman}
\newfontfamily\greekfont[Script=Greek]{Times New Roman}

\setmainlanguage{greek}
\setotherlanguage{english}

\usepackage[autostyle,english=american]{csquotes}
\MakeOuterQuote{"}

\begin{document}
Outside "english" environment --

\begin{english}
"Quotes" -- inside english environment  
\end{english}

\begin{greek}
"Ελληνικό" -- περιβάλλον
\end{greek}

"Ελληνικά"
\end{document}

Of course, if you want LaTeX to guess the quotes to use based on the text, you're asking too much: LaTeX can't read and doesn't really know languages, it just follows instructions.

enter image description here