6

I used to set an specific font for greek text using polyglossia with \newfontfamily{\textgreek}[Ligatures=TeX]{Vusillus Old Face}.

After I updated to TeX Live 2018 all my documents wouldn't compile anymore throwing the error:

LaTeX error: "xparse/command-already-defined" Command '\textgreek' already defined! For immediate help type H .

This is truly unfortunate, because that means the update breaks compatibility to a couple of hundred of my documents. However, my questions are:

  1. What happened in polyglossia, that I cant use the above mentioned
    command anymore, to set the font for a specific language?
  2. How am I supposed to do this now?
  3. How could I make my old documents compile again the easiest way?

By the way, I am using polyglossia due to its compatibility with XeLaTeX. Here is a minimal not working example:

\documentclass[a4paper,10pt,twoside]{memoir}
\usepackage{polyglossia}
\setmainlanguage[spelling=old,babelshorthands=true,script=latin]{german}
\setotherlanguage[variant=polytonic]{greek}
\newfontfamily{\textgreek}[Ligatures=TeX]{Vusillus Old Face}

\begin{document}
textgreek{πάντα ῥεῖ} – Alles fließt.
\end{document}
7
  • 3
    the \text<language> commands are defined by polyglossia to define language switches, so you shouldn't define them to be font commands, Commented Oct 19, 2018 at 8:45
  • 2
    fontspec changed the behaviour of \newfontfamily{\cmd} recently, earlier the command would not check if \cmd was already defined, it would simply overwrite the command. Now \newfontfamily{\cmd} checks if \cmd is defined and errors if that is the case. Since polyglossia defines \textgreek you get an error now.
    – moewe
    Commented Oct 19, 2018 at 8:48
  • 3
    Use \newfontfamily{\greekfont} to specify a font for Greek text.
    – moewe
    Commented Oct 19, 2018 at 8:51
  • 2
    \textgreek is (and has always been) a bad name for a font family selection command, because generally \text... commands require an argument, whereas the syntax for choosing a font family defined with \newfontfamily{\foo}{Font} is {\foo text}, not \foo{text}.
    – egreg
    Commented Oct 19, 2018 at 9:20
  • Also probably a good idea to set Scale= on font families loaded with fontspec, or as a default feature.
    – Davislor
    Commented Oct 19, 2018 at 19:48

1 Answer 1

10

fontspec recently changed the behaviour of \newfontfamily. \newfontfamily<cmd> now throws an error if <cmd> is defined. Earlier \newfontfamily would behave like \setfontfamily behaves now. It would simply overwrite the old definition of the command. (See p. 9 of the fontspec documentation).

As David Carlisle explains in the comments \textgreek is a command defined by polyglossia to typeset Greek. (polyglossia defines \text<language> for all loaded languages. See also p. 5 of the polyglossia documentation.)

So when you get to

\newfontfamily{\textgreek}[Ligatures=TeX]{Vusillus Old Face}

new versions of fontspec throw an error, because \textgreek is already defined. Older version of fontspec will have overwritten polyglossia's definition of \textgreek, which probably meant that you did not actually get proper language switching.

The correct way to specify the font for Greek is by redefining \greekfont. See also pp. 6-7 of the polyglossia documentation.

\documentclass[a4paper,10pt,twoside]{memoir}
\usepackage{polyglossia}
\setmainlanguage[spelling=old,babelshorthands=true,script=latin]{german}
\setotherlanguage[variant=polytonic]{greek}
\newfontfamily{\greekfont}[Ligatures=TeX]{Linux Libertine O}

\begin{document}
\textgreek{πάντα ῥεῖ} – Alles fließt.
\end{document}

You could also use babel instead of polyglossia. babel supports LuaLaTeX and XeLaTeX and is actively being developed. (polyglossia development seems to have stalled recently.) For western languages with Latin scripts polyglossia is barely better than babel. For Greek babel also gives very good results. Even for RTL languages recent babel development looks very promising.

\documentclass[a4paper,10pt,twoside]{memoir}
\usepackage{fontspec}
\usepackage[polutonikogreek,german]{babel}
\babelfont{rm}{Latin Modern Roman}
\babelfont[polutonikogreek]{rm}{Linux Libertine O}

\begin{document}
\foreignlanguage{polutonikogreek}{πάντα ῥεῖ} – Alles fließt.
\end{document}

The output of both examples is the same

πάντα ῥεῖ – Alles fließt.

1
  • 1
    @egreg makes an important point in the comments under the question. With \setfontfamily\textgreek the font will leak out and change everything in the current group since font families are defined as switches and not macros. Which means that \textgreek{πάντα ῥεῖ} – Alles fließt. with older fontspec or \setfontfamily would also change the font of 'Alles fließt', while in the MWE of the answer the font is not changed and stays Latin Modern.
    – moewe
    Commented Oct 19, 2018 at 9:27

You must log in to answer this question.

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