Consider this MWE:
\documentclass[10pt,twoside,openright]{book}
% http://tex.stackexchange.com/a/44701/2595
\usepackage{iftex}
\ifPDFTeX
\usepackage[greek,danish,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\else
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{greek,danish} %% (A): causes "Command \proofname already defined."; do it after ntheorem?
\ifXeTeX
\usepackage{xltxtra}
\else
\usepackage{luatextra}
\fi
\defaultfontfeatures{Ligatures=TeX}
\fi
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[framed,amsmath,amsthm,thmmarks]{ntheorem}
% \ifPDFTeX \else %% (B):
% \setotherlanguages{greek,swedish} % polyglossia leftover; causes "Command \greek already defined."
% \fi
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}
Compiling this with lualatex --file-line-error test.tex
, I get:
...
(/media/texlive/2014/texmf-dist/tex/latex/ntheorem/ntheorem.sty
Style `ntheorem', Version 1.33 <2011/08/15>
(/media/texlive/2014/texmf-dist/tex/latex/base/ifthen.sty)
/media/texlive/2014/texmf-dist/tex/latex/ntheorem/ntheorem.sty:1175:
LaTeX Error: Command \proofname already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1175 \ProcessOptions\relax
?
After seeing "Command \proofname already defined", I tried to look a bit in polyglossia.dtx
:
$ awk 'BEGIN{tdo=0;}
/captions(danish|swedish|.*greek)/ {print $0; tdo=1;}
/proofname/{if(tdo==1){print $0; tdo=0;}}
' `kpsewhich polyglossia.dtx`
\def\captionsdanish{%
\def\proofname{Bevis}%
\def\captionsgreek{\monogreekcaptions}%
\def\captionsgreek{\polygreekcaptions}%
\def\captionsgreek{\ancientgreekcaptions}%
\def\captionsgreek{\monogreekcaptions}%
\def\proofname{Απόδειξη}%
\def\captionsswedish{%
\def\proofname{Bevis}%
... and indeed, all languages redefine \proofname
; so my first idea was to replace (A) with (B) in the MWE - but that results with "Command \greek already defined.".
Now this is the funny thing: this error occurs in (A) only when {greek,danish}
is used in \setotherlanguages
- it does not occur for, say, {greek,swedish}
or just {greek}
! (Note that the error in (B) occurs also for Swedish)
Best I could do here, was to compare the polyglossia files for Danish and Swedish, and see if there is a difference - and I tried
meld `kpsewhich gloss-swedish.ldf` `kpsewhich gloss-danish.ldf`
... and I cannot see any significant difference?!
So my question is - how can I use polyglossia
with \setotherlanguages{greek,danish}
without crashing?
\usepackage[greek,danish,english]{babel}
for xelatex and lualatex too. The main difference between danish and swedish is imho the handling of the dates.polyglossia
was replacement forbabel
? Then again, I just found tex.stackexchange.com/questions/88481/polyglossia-vs-babel, where it mentions: "The relationship between babel and polyglossia with respect to XeTeX is complicated. The general rule of thumb is that if the babel .ldf file uses non-Latin scripts, then you should use polyglossia and generally can't use babel but if it assumes Latin scripts, you may still be able to use babel". So, I guess (haven't tested) here Greek would be a problem?