Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I got a little Problem with the combination of polyglossia and ledpar. First the example

\documentclass[11pt,a4paper]{scrartcl}
\usepackage{xltxtra}
\usepackage{libertine}
\usepackage{polyglossia}
    \setmainlanguage[spelling=new,babelshorthands=true]{german}
    \setotherlanguage{latin}
    \setotherlanguage[variant=poly]{greek}
\usepackage{ledmac,ledpar}% PROBLEM-LINE
\begin{document}
\minisec{german}
Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien
leben die Blindtexte. Abgeschieden wohnen Sie in Buchstabhausen an der Küste
des Semantik, eines großen Sprachozeans.

\minisec{latin}
\begin{latin}
Ulpianus libro primo institutionum pr Iuri operam daturum prius nosse oportet,
unde nomen iuris descendat. est autem a iustitia appellatum: nam, ut eleganter
Celsus definit, ius est ars boni et aequi.
\end{latin}

\minisec{greek}
\begin{greek}
μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος οὐλομένην, ἣ μυρί' Ἀχαιοῖς ἄλγε'
ἔθηκε, πολλὰς δ' ἰφθίμους ψυχὰς Ἄϊδι προί̈αψεν ἡρώων
\end{greek}

\minisec{short-versions}
Hier steht etwas griechisches: \textgreek{Πηληϊάδεω}
\end{document}

Without the problem-line, which includes ledpar, every thing works fine but with it the foreign-language-environments I get the problem which leads to some extra-text (]latin or ]greek) in the PDF at the beginning of environment’s content.

There’s no problem with the short-versions \text⟨lang⟩.

share|improve this question
1  
@Martin You deleted my greetings, should I never use them here? –  Tobi Apr 18 '11 at 17:07
    
No, we prefer to have no opening or closing text in the posts here. –  Martin Scharrer Apr 18 '11 at 17:08
    
@Martin: OK, I'll keep it in mind … –  Tobi Apr 18 '11 at 18:45
add comment

3 Answers

up vote 5 down vote accepted

The same problem was mentioned here: http://tug.org/pipermail/xetex/2010-June/017029.html

I proposed a document based patch:

\letcs\POLYselectlanguage{\string\selectlanguage}
\usepackage{ledmac}
\usepackage{ledpar}
\AtBeginDocument{
\renewcommand{\selectlanguage}[2][]{%
   \POLYselectlanguage[#1]{#2}%
   \ifledRcol
     \gdef\theledlanguageR{#2}%
   \else
     \gdef\theledlanguageL{#2}%
  \fi}
}

that, as the OP said, solved the problem. François Charette proposed a patch to ledpar and ledmac (http://tug.org/pipermail/xetex/2010-June/017067.html), but I don't know what happened later.

The patch proposed by François is to change some lines in ledpar.sty: lines 1481--1498

\AtBeginDocument{%
  \@ifundefined{bbl@main@language}{%
    \l@dusedbabelfalse
    \renewcommand*{\selectlanguage}[1]{}}{%
    \l@dusedbabeltrue
    \let\l@doldselectlanguage\selectlanguage
    \let\l@doldbbl@set@language\bbl@set@language
    \let\bbl@set@language\l@dbbl@set@language
    \renewcommand{\selectlanguage}[1]{%
      \l@doldselectlanguage{#1}%
      \ifledRcol \gdef\theledlanguageR{#1}%
      \else      \gdef\theledlanguageL{#1}%
      \fi}
    \renewcommand*{\l@duselanguage}[1]{%
      \l@doldselectlanguage{#1}}
    \gdef\theledlanguageL{\bbl@main@language}%
    \gdef\theledlanguageR{\bbl@main@language}%
}}

should become

\AtBeginDocument{
  \@ifundefined{xpg@main@language}{% 
    \@ifundefined{bbl@main@language}{% no babel, no polyglossia
      \l@dusedbabelfalse
      \renewcommand*{\selectlanguage}[1]{}%
      }{% else babel loaded
      \l@dusedbabeltrue
      \let\l@doldselectlanguage\selectlanguage
      \let\l@doldbbl@set@language\bbl@set@language
      \let\bbl@set@language\l@dbbl@set@language
      \renewcommand{\selectlanguage}[1]{%
        \l@doldselectlanguage{#1}%
        \ifledRcol \gdef\theledlanguageR{#1}%
        \else      \gdef\theledlanguageL{#1}%
        \fi}
      \renewcommand*{\l@duselanguage}[1]{%
        \l@doldselectlanguage{#1}}
      \gdef\theledlanguageL{\bbl@main@language}%
      \gdef\theledlanguageR{\bbl@main@language}%
      }%
    }{%else polyglossia loaded
      \apptocmd{\xpg@set@language}{%
        \ifledRcol \gdef\theledlanguageR{#1}%
        \else      \gdef\theledlanguageL{#1}%
        \fi}%
      \let\l@duselanguage\xpg@set@language
      \gdef\theledlanguageL{\xpg@main@language}%
      \gdef\theledlanguageR{\xpg@main@language}%
    }}

It's essentially the (document based) patch I suggested, but cleaner.

share|improve this answer
    
Thank you! Could you explain hot to use the patch by Charette? Otherwise I’m going to use you document based version … –  Tobi Apr 18 '11 at 20:28
add comment

August 2011:

Maïeul Rouquette has updated the ledpar.dtx file in CTAN with the François Charette patch above. (See https://groups.google.com/d/topic/comp.text.tex/NCly-8DJtkM/discussion.) The newest version of ledpar.dtx, with this new patch, is

With this version ledpar, Martin Scharrer's problem mentioned above is solved.

However, I've recently installed TeXlive 2011, and I note that it delivers ledpar.sty in version 0.3b, and it does not have the Charette patch. Until TeXlive 2011 updates this, you'll need to get and install version 0.3c manually.

share|improve this answer
    
In the quoted posting it says, that the patch has bee submitted to CTAN nearly two month ago -- but on the servers there's still the old one. Can anyone point me to the new ledparpatch.sty? Shouldn't it be considered an error, that the new version isn't available? –  Florian Aug 11 '11 at 11:49
    
The patch 0.3c is now on the CTAN mirrors. I haven't done any extensive testing, but the example above doesn't produce errors any more. –  Florian Aug 15 '11 at 10:59
add comment

Both, polyglossia and ledpar redefines \selectlanguage. The definition of ledpar "win" and is active in the document, but is has a different number of arguments: \renewcommand{\selectlanguage}[1] versus \renewcommand{\selectlanguage}[2][] from polyglossia.

You will need someone who understand what ledpar is trying to achieve by redefining \selectlanguage to solve the clash.

share|improve this answer
    
Thank you for finding the problem :) –  Tobi Apr 18 '11 at 20:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.