3

I know the conversion of --- to an em-dash is an on-going problem with lualatex. But I don't understand why using Greek in one font should (afterwards) break conversion of 3 hyphens to an em-dash in another.

Here is my code:

%!TEX encoding = UTF-8 Unicode
\documentclass{article}

\usepackage{fontspec}
\usepackage{ednotes}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
\newfontfamily\myGk[Script=Greek,Scale=MatchUppercase,Ligatures=TeX]{Cambria}
%\newfontfamily\myGk[Script=Greek,Scale=MatchUppercase,Ligatures=TeX]{Linux Libertine O}

\newcommand\textgreek[1]{\myGk\emph{#1}}

\begin{document}
\fontsize{11.5}{13}\selectfont


This is a test---to see if dashes are being converted to emdashes.

\textgreek{Ἐν ἀρχῇ ἦν ὁ λόγος}

This is a test---to see if dashes are being converted to emdashes.

\end{document}

For me, if I run the above code as is, the second "This is a test..." comes out with dashes instead of an em-dash. If I use the Linux Libertine O font for the Greek, I don't have the problem.

Can anyone tell me how I can use the Cambria Greek (which I prefer) without breaking em-dashes in the main font? I am using TeXLive 2012 with Mac TeXShop.

Paul Dulaney
  • 5,310

2 Answers2

7

hold the definition local:

\newcommand\textgreek[1]{{\myGk\emph{#1}}}
%  {{...}}
4

I think the solution is pretty clear as it is a little bit my fault. (Sorry!)

When I first posted my answer to your previous question here, I made a little mistake, which I corrected later. You, however, did not use the updated version of my answer. This mistakes seems to cause your present problem.

You need to use this:

\newcommand{\textgreek}[1]{\bgroup\myGk\emph{#1}\egroup}

You see, the fontcommands for the greek font are now enclosed by bgroup ... egroup. Without this, the Greek font is used for the rest of the document and not just for the few Greek words.

Since the em-dash is not part of your Greek font, it does not typeset it. I am currently not able to check my assumption, but I am pretty sure, this is it.

In effect, this is very similar to Herbert's solution, but -- imho -- more elegant and perhaps in some extreme cases even more secure to use.

  • 3
    Cambria has the em-dash, but with luaotfload's render=node, it is broken (at the moment). With render=basic the em-dash in Cambria works fine. – topskip Aug 21 '12 at 21:13
  • The answer is not similar it is the same, \bgroup ... \egroup is not different to {...} –  Aug 22 '12 at 14:20