4

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 " " :)

2
  • You could create a mapping (with teckit) similar to tex-text which maps the quote to the greek quotes and then load the greek font as \newfontfamily\greekfont[Script=Greek,Mapping=tex-text-greek]{Times New Roman}. But I prefer to use the csquotes package. Jun 6, 2014 at 12:55
  • If you have a Greek keyboard, you should just be able to type in the Greek quotes in your UTF-8 source.
    – Davislor
    Jun 18, 2023 at 16:21

1 Answer 1

4

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

2
  • egreg that's great, how it defaults to greek quotes unless I specifically specify english environment (which I rarely do in my thesis, since it is written in Greek). Upvote & accept! <3
    – stathisk
    Jun 6, 2014 at 20:46
  • Thank you very much! It worked!! Jun 12, 2023 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .