maieul / ledmac

package reledmac for latex
http://www.ctan.org/tex-archive/macros/latex/contrib/reledmac
54 stars 28 forks source link

Strange behavior of \lemma{} inside pairs #914

Open BatrachosPyktes opened 3 years ago

BatrachosPyktes commented 3 years ago

Switch of language inside \lemma{x} works only in normal typesetting.

Version

reledmac: 2021/04/04 v2.37.2 reledpar: 2021/03/08 v2.25.1a

TeX Engine

LuaLaTeX

Description

The poem is in Greek. In normal typesetting (\beginnumbering \stanza ... \& \endnumbering) I can switch to another language and another font inside \lemma (\lemma{οἴμοι \textgerman{exclamation}), which doesn't work if the lemma is inside \begin{pairs}...\end{pairs}\Columns.

If you TeXify the sample, you'll see the difference in the B-apparatus on line 4 ("Adv." is missing on the second page) and line 5-6 ("Kleanthes, Zenon") are missing.

Minimal Working Example

\RequirePackage{etex}
\RequirePackage{xpatch}
\reserveinserts{40}
\listfiles
\documentclass[ngerman,fontsize=10pt]{scrartcl}
\usepackage[main=ngerman,greek]{babel}
\languageattribute{greek}{ancient}
\usepackage[noend,nofamiliar,series={A,B}]{reledmac}
\usepackage{reledpar}
\usepackage{mathtools}
\usepackage{unicode-math}
\defaultfontfeatures{PunctuationSpace=1.5}
\defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{Ligatures={TeX,Common}}
\babelfont[greek]{rm}[Ligatures=TeX]{GFS Porson}
\usepackage{microtype}
\makeatletter
\NewDocumentCommand{\textgerman}{ m }{%
  \begin{otherlanguage}{ngerman}#1%
  \end{otherlanguage}
}
\NewDocumentCommand{\textgreek}{ m }{%
  \begin{otherlanguage}{greek}#1%    
  \end{otherlanguage}
}
\setstanzaindents{5,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2}
\makeatother
\begin{document}

\begin{ledgroup}
  \begin{otherlanguage}{greek}
    \beginnumbering
    \stanza Πέντε θανὼν κείσῃ κατέχων πόδας. οὐδὲ τὰ τερπνὰ&
    ζωῆς οὐδ'\thinspace αὐγὰς ὄψεαι ἠελίου·&
    ὥστε λαβὼν Βάκχου
    \edtext{ζωρὸν}{\lemma{ζωρός}\Bfootnote{\textgerman{rein (wie}\ 
        ἄκρατος\textgerman{)}}} δέπας ἕλκε γεγηθώς,&
    Κίγκιε, καλλίστην \edtext{ἀγκὰς}{\lemma{ἀγκάς
        \textgerman{Adv.}}\Bfootnote{\textgerman{in den
          Armen}}} ἔχων
    \edtext{ἄλοχον}{\Afootnote[nosep]{ \textgerman{Cod.: } ἄκοιτιν
        \textgerman{Planudes}}}.& 
    εἰ δέ \edtext{\edtext{σοι}{\Bfootnote{\textgerman{">für
              Dich"<, ">in Deinen Augen"<}}}
      ἀθάνατος \edtext{σοφίης}{\lemma{σοφίης $\simeq$
          φιλοσοφίας}\Bfootnote{}} νόος}{\lemma{σοι [...]
        νόος}\Bfootnote{\textgerman{konstruiere}\ νόος σοφίης
         σοι ἀθάνατος [ἐστιν]}}, ἴσθι, \edtext{Κλεάνθης&
      καὶ Ζήνων}{\lemma{\textgerman{Kleanthes,
          Zenon}}\Bfootnote{\textgerman{stoische Philosophen}}} Ἀίδην
    τὸν βαθὺν ὡς ἔμολον.\&
    \endnumbering
  \end{otherlanguage}
\end{ledgroup}

\newpage
\setlength{\Lcolwidth}{0.63\textwidth}
\setlength{\Rcolwidth}{0.7\textwidth}
\setlength{\columnseparator}{1em}

\hspace*{-7em}\begin{minipage}[t]{1.1\linewidth}
  \begin{pairs}
    \begin{Leftside}
      \beginnumbering
      \begin{otherlanguage}{greek}
        \stanza Πέντε θανὼν κείσῃ κατέχων πόδας. οὐδὲ τὰ τερπνὰ&
        ζωῆς
        οὐδ'\thinspace αὐγὰς ὄψεαι ἠελίου·&
        ὥστε λαβὼν Βάκχου
        \edtext{ζωρὸν}{\lemma{ζωρός}\Bfootnote{\textgerman{rein
              (wie\ \textgreek{ἄκρατος})}}} δέπας ἕλκε γεγηθώς,&
        Κίγκιε, καλλίστην
        \edtext{ἀγκὰς}{\lemma{ἀγκάς
            \textgerman{Adv.}}\Bfootnote{\textgerman{in den Armen}}}
        ἔχων
        \edtext{ἄλοχον}{\Afootnote[nosep]{ \textgerman{Cod.:
            }\textgreek{ἄκοιτιν}\ \textgerman{Planudes}}}.& 
        εἰ δέ \edtext{\edtext{σοι}{\Bfootnote{\textgerman{">für
                  Dich"<, ">in Deinen Augen"<}}}
          ἀθάνατος \edtext{σοφίης}{\lemma{σοφίης $\simeq$
              φιλοσοφίας}\Bfootnote{}} νόος}{\lemma{σοι [...]
            νόος}\Bfootnote{\textgerman{\textit{konstruiere}}\
            \textgreek{νόος σοφίης σοι ἀθάνατος [ἐστιν]}}}, ἴσθι,
        \edtext{Κλεάνθης&
          καὶ Ζήνων}{\lemma{\textgerman{Kleanthes,
              Zenon}}\Bfootnote{\textgerman{\textit{stoische
                Philosophen}}}} Ἀίδην τὸν βαθὺν ὡς ἔμολον.\&
      \end{otherlanguage}
      \endnumbering
    \end{Leftside}    
    \begin{Rightside}
      \beginnumbering
      \stanza Fünf Fuß weit wirst Du bedecken, wenn Du tot
      daliegst. Weder die Freuden &
      des Lebens noch die Strahlen der Sonne &
      bla &
      bla &
      bla &
      bla\&
      \endnumbering
    \end{Rightside}
  \end{pairs}
  \Columns
\end{minipage}
\end{document}

Workaround

maieul commented 3 years ago

I look on this, but please next time, provide a really minimal working example. For example, your font settings are not concerned for your problem. I dont need also math...

Also, the example should be working. Here, we miss csquotes package.

maieul commented 3 years ago

In my case, mathtool create a running bug. If I disable it, all work well.

So, please provide a more simple example.

BatrachosPyktes commented 3 years ago

All of the packages, plus the missing csquotes, do make sense. Without mathtools and unicode-math I get things like 1em plus 7emplus 7em or PunctuationSpace=1.5 [,,]Ligatures=TeX,Common TeX Gyre Pagella X TeX Gyre Heros TeX Gyre Cursor on top of the second page: Without mathtools and unicode-math I cannot use defaultfontfeatures. And I really need csquotes, though I will remove it in the sample. The document has two pages for two reasons: The poems are to be printed twice; first for translation, second with translation for the greekless users. The second reason is that I wanted to show what works in normal textmode and fails in two column-mode. I you display the facing pages, you can see the difference at once. Of course I can remove some lines of the poem, but I don't think that this makes much difference.

maieul commented 3 years ago

maybe it make sense for you, but to debug i need a really miniwal working example :)

for now, i dont see any problem... so I can't help you.

but i see that the you have changed your example (that is not the same that in in the original mail I get). I will look.

maieul commented 3 years ago

for example, I could simplify your example with


\documentclass[ngerman,fontsize=10pt]{scrartcl}
\usepackage[main=ngerman,greek]{babel}
\languageattribute{greek}{ancient}
\usepackage[noend,noeledsec,nofamiliar,series={A,B}]{reledmac}
\usepackage{reledpar}
\usepackage{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{Ligatures={TeX,Common}}
\babelfont[greek]{rm}[Ligatures=TeX]{GFS Porson}
\usepackage{microtype}
\makeatletter
\NewDocumentCommand{\textgerman}{ m }{%
  \begin{otherlanguage}{ngerman}#1%
  \end{otherlanguage}
}
\NewDocumentCommand{\textgreek}{ m }{%
  \begin{otherlanguage}{greek}#1%
  \end{otherlanguage}
}
\setstanzaindents{5,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2}
\firstlinenum{5}
\linenumincrement{5}
\makeatother
\begin{document}

\newpage
\setlength{\Lcolwidth}{0.63\textwidth}
\setlength{\Rcolwidth}{0.7\textwidth}
\setlength{\columnseparator}{1em}
  \begin{pairs}
    \begin{Leftside}
      \beginnumbering
      \begin{otherlanguage}{greek}
        \stanza Πέντε θανὼν κείσῃ κατέχων πόδας. οὐδὲ τὰ τερπνὰ&
        ζωῆς
        οὐδ'\thinspace αὐγὰς ὄψεαι ἠελίου·&
        ὥστε λαβὼν Βάκχου
        \edtext{ζωρὸν}{\lemma{ζωρός}\Bfootnote{\textgerman{rein
              (wie\ \textgreek{ἄκρατος})}}} δέπας ἕλκε γεγηθώς,&
        Κίγκιε, καλλίστην
        \edtext{ἀγκὰς}{\lemma{ἀγκάς
            \textgerman{Adv.}}\Bfootnote{\textgerman{in den Armen}}}
        ἔχων
        \edtext{ἄλοχον}{\Afootnote[nosep]{ \textgerman{Cod.:
            }\textgreek{ἄκοιτιν}\ \textgerman{Planudes}}}.&
        εἰ δέ \edtext{\edtext{σοι}{\Bfootnote{\textgerman{">für
                  Dich"<, ">in Deinen Augen"<}}}
          ἀθάνατος \edtext{σοφίης}{\lemma{σοφίης $\simeq$
              φιλοσοφίας}\Bfootnote{}} νόος}{\lemma{σοι [...]
            νόος}\Bfootnote{\textgerman{\textit{konstruiere}}\
            \textgreek{νόος σοφίης σοι ἀθάνατος [ἐστιν]}}}, ἴσθι,
        \edtext{Κλεάνθης&
          καὶ Ζήνων}{\lemma{\textgerman{Kleanthes,
              Zenon}}\Bfootnote{\textgerman{\textit{stoische
                Philosophen}}}} Ἀίδην τὸν βαθὺν ὡς ἔμολον.\&
      \end{otherlanguage}
      \endnumbering
    \end{Leftside}
    \begin{Rightside}
      \beginnumbering
      \stanza Fünf Fuß weit wirst Du bedecken, wenn Du tot
      daliegst. Weder die Freuden &
      des Lebens noch die Strahlen der Sonne &
      bla &
      bla &
      bla &
      bla\&
      \endnumbering
    \end{Rightside}
  \end{pairs}
  \Columns
\end{document}

(and now I see the problem)

maieul commented 3 years ago

OK.

So

  1. It is not related directly to lemma (thaht is, if you switch in the first argument of \edtext, same problem)
  2. I don't know exatcly why it happens only in parallel typesetting, but I suppose that is related to the time the font selection is made
  3. By "font selection" I means that, usually, reledmac set the font of the lemma in the note to be the same as the lemma in the text.
  4. It is a very sensitive part of code
  5. I am busy, no time to investiguate more to understand the problem
  6. Howver, there is a quick workaround in your case : change your def of \textgerman to
    
    \NewDocumentCommand{\textgerman}{ m }{%
    \begin{otherlanguage}{ngerman}\normalfont #1%
    \end{otherlanguage}
    }