Closed Doc73 closed 3 months ago
Please try branch issue_974_polyglossia
Many thanks! It seems working very well!
Two marginal notes:
BTW, thans, thanks, thanks!
Yep, it is an old code. I wil try to release today or tomorrow...
I should try to find basic information on these things...
Dear Maieul, I did some tests with a major project of mine, but I get several errors like these:
./Scholia3.tex:160: Undefined control sequence.
\\otherlanguage ...{#2}\xpg@set@language@only@aux
[#1]{#2}\ifledRcol \gdef \...
l.160 \input
{Capitoli3/42-Minos}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
and
./Capitoli3/45-Leges3.tex:67: Undefined control sequence.
<recently read> \@select@language
l.67 \Columns
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Without MWE, I can't do anything... you know that...
With spurious text like []greek
or []italian
or []latin
to the corresponding \begin{LANGUAGE}
Here the MWE:
% !TeX TS-program = xelatex
% !TeX encoding = UTF-8
\documentclass{book}
\usepackage[osf]{libertinus-otf}
\usepackage[babelshorthands=true]{polyglossia}
\setmainlanguage[variant=ancient]{greek}
\setotherlanguage[variant=modern]{latin}
\setotherlanguage[]{german}
\setotherlanguage[]{italian}
\usepackage[]{reledmac}
\usepackage[]{reledpar}
\usepackage[style=italian]{csquotes}
\begin{document}
\begin{italian}
Quel ramo del lago di Como, che volge a mezzogiorno, tra due catene non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a ristringersi, e a prender corso e figura di fiume, tra un promontorio a destra, e un’ampia costiera dall’altra parte; e il ponte, che ivi congiunge le due rive, par che renda ancor più sensibile all’occhio questa trasformazione, e segni il punto in cui il lago cessa, e l’Adda rincomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l’acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni. La costiera, formata dal deposito di tre grossi torrenti, scende appoggiata a due monti contigui, l’uno detto di san Martino, l’altro, con voce lombarda, il Resegone, dai molti suoi cocuzzoli in fila, che in vero lo fanno somigliare a una sega: talchè non è chi, al primo vederlo, purchè sia di fronte, come per esempio di su le mura di Milano che guardano a settentrione, non lo discerna tosto, a un tal contrassegno, in quella lunga e vasta giogaia, dagli altri monti di nome più oscuro e di forma più comune. Per un buon pezzo, la costa sale con un pendìo lento e continuo; poi si rompe in poggi e in valloncelli, in erte e in ispianate, secondo l’ossatura de’ due monti, e il lavoro dell’acque.
\end{italian}
\begin{greek}
Ὅτι μὲν ὑμεῖς, ὦ ἄνδρες Ἀθηναῖοι, πεπόνθατε ὑπὸ τῶν ἐμῶν κατηγόρων, οὐκ οἶδα· ἐγὼ δ' οὖν καὶ αὐτὸς ὑπ' αὐτῶν ὀλίγου ἐμαυτοῦ ἐπελαθόμην, οὕτω πιθανῶς ἔλεγον. καίτοι ἀληθές γε ὡς ἔπος εἰπεῖν οὐδὲν εἰρήκασιν. μάλιστα δὲ αὐτῶν ἓν ἐθαύμασα τῶν πολλῶν ὧν ἐψεύσαντο, τοῦτο ἐν ᾧ ἔλεγον ὡς χρῆν ὑμᾶς εὐλαβεῖσθαι μὴ ὑπ' ἐμοῦ ἐξαπατηθῆτε ὡς δεινοῦ ὄντος λέγειν. τὸ γὰρ μὴ αἰσχυνθῆναι ὅτι αὐτίκα ὑπ' ἐμοῦ ἐξελεγχθήσονται ἔργῳ, ἐπειδὰν μηδ' ὁπωστιοῦν φαίνωμαι δεινὸς λέγειν, τοῦτό μοι ἔδοξεν αὐτῶν ἀναισχυντότατον εἶναι, εἰ μὴ ἄρα δεινὸν καλοῦσιν οὗτοι λέγειν τὸν τἀληθῆ λέγοντα
\end{greek}
\end{document}
please try new version of the branch
polyglossia-3.tex: errore: 54: Undefined control sequence. \Columns
New MWE:
% !TeX TS-program = xelatex
% !TeX encoding = UTF-8
\documentclass{book}
\usepackage[osf]{libertinus-otf}
\usepackage[babelshorthands=true]{polyglossia}
\setmainlanguage[variant=ancient]{greek}
\setotherlanguage[variant=modern]{latin}
\setotherlanguage[]{german}
\setotherlanguage[]{italian}
\usepackage[]{reledmac}
\usepackage[]{reledpar}
\usepackage[style=italian]{csquotes}
\begin{document}
\begin{italian}
Quel ramo del lago di Como, che volge a mezzogiorno, tra due catene non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a ristringersi, e a prender corso e figura di fiume, tra un promontorio a destra, e un’ampia costiera dall’altra parte; e il ponte, che ivi congiunge le due rive, par che renda ancor più sensibile all’occhio questa trasformazione, e segni il punto in cui il lago cessa, e l’Adda rincomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l’acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni. La costiera, formata dal deposito di tre grossi torrenti, scende appoggiata a due monti contigui, l’uno detto di san Martino, l’altro, con voce lombarda, il Resegone, dai molti suoi cocuzzoli in fila, che in vero lo fanno somigliare a una sega: talchè non è chi, al primo vederlo, purchè sia di fronte, come per esempio di su le mura di Milano che guardano a settentrione, non lo discerna tosto, a un tal contrassegno, in quella lunga e vasta giogaia, dagli altri monti di nome più oscuro e di forma più comune. Per un buon pezzo, la costa sale con un pendìo lento e continuo; poi si rompe in poggi e in valloncelli, in erte e in ispianate, secondo l’ossatura de’ due monti, e il lavoro dell’acque.
\end{italian}
{\selectlanguage{german}
Paulys Realencyclopädie der classischen Altertumswissenschaft (RE) ist die umfangreichste Enzyklopädie zum Altertum. Sie wurde ab 1890 von Georg Wissowa (1859–1931) herausgegeben und 1980 abgeschlossen. Sie führte die von August Friedrich Pauly (1796–1845) begründete Real-Encyclopädie der classischen Alterthumswissenschaft in alphabetischer Ordnung (1837–1864) fort und war als komplette Neubearbeitung konzipiert. Bis heute gilt die RE als Standardwerk der Altertumswissenschaft. Viele Artikel dieser Enzyklopädie sind mittlerweile gemeinfrei, möglichst alle Artikel sollen mit Hilfe der Scans als Volltext digitalisiert werden.}
\begin{lang}{greek}
Ὅτι μὲν ὑμεῖς, ὦ ἄνδρες Ἀθηναῖοι, πεπόνθατε ὑπὸ τῶν ἐμῶν κατηγόρων, οὐκ οἶδα· ἐγὼ δ' οὖν καὶ αὐτὸς ὑπ' αὐτῶν ὀλίγου ἐμαυτοῦ ἐπελαθόμην, οὕτω πιθανῶς ἔλεγον. καίτοι ἀληθές γε ὡς ἔπος εἰπεῖν οὐδὲν εἰρήκασιν. μάλιστα δὲ αὐτῶν ἓν ἐθαύμασα τῶν πολλῶν ὧν ἐψεύσαντο, τοῦτο ἐν ᾧ ἔλεγον ὡς χρῆν ὑμᾶς εὐλαβεῖσθαι μὴ ὑπ' ἐμοῦ ἐξαπατηθῆτε ὡς δεινοῦ ὄντος λέγειν. τὸ γὰρ μὴ αἰσχυνθῆναι ὅτι αὐτίκα ὑπ' ἐμοῦ ἐξελεγχθήσονται ἔργῳ, ἐπειδὰν μηδ' ὁπωστιοῦν φαίνωμαι δεινὸς λέγειν, τοῦτό μοι ἔδοξεν αὐτῶν ἀναισχυντότατον εἶναι, εἰ μὴ ἄρα δεινὸν καλοῦσιν οὗτοι λέγειν τὸν τἀληθῆ λέγοντα
\end{lang}{greek}
\beginnumbering
\numberpstarttrue
\pstart%
No. 1
\pend
\pausenumbering
\begin{pairs}
\begin{Leftside}
\resumenumbering
\numberpstartfalse
\pstart\noindent%
blabla
\pend
\pausenumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\numberpstartfalse
\pstart\noindent%
blabla
\pend
\endnumbering
\end{Rightside}
\end{pairs}
\Columns
\numberpstarttrue
\resumenumbering
\pstart%
No. 2
\pend
\endnumbering
\numberpstartfalse
\end{document}
There are a lot of change in polyglossia release... try the new version of the branch...
There are a lot of change in polyglossia release... try the new version of the branch...
@maieul Sorry for the inconvenience, we completely rewrote many parts of the code, which have been a hotch-potch of TeX, LaTeX and latex3 and now more consistently employ the latter.
For me this branch is working. Thanks!
@maieul Sorry for the inconvenience, we completely rewrote many parts of the code, which have been a hotch-potch of TeX, LaTeX and latex3 and now more consistently employ the latter.
I saw. The most problematic things is to find the equivalence between the older one and the new one.
@maieul
Yes, I had seen in changelog the many changes in Polyglossia
. And in the meantime we discovered another reledpar
user. :smile:
This new branch seems working fine. I really have to thank you.
Half an hour ago, I deeply regretted that I have updated to texlive 2024. But now I'm fine with that. ;)
@Doc73 it seems I did a mistake and lost some feature with this branch (chapter name etc).
Do you have any specific hooks you would like us to add that we will know to keep so that such a case will not repeat?
Do you have any specific hooks you would like us to add that we will know to keep so that such a case will not repeat?
unfortunatyl, I am not the original autor of the code regarding polyglossia, so I have not any list. But for now, It seems that I use only \polyglossia@language@switched
and \selectlanguage
in the new version of code... but it is still bugy.
yes, my fixes didn't work... we lost information about language I try to do a better
@Udi-Fogiel is there any hook for \begin{otherlanguage}
? not just for switching language
unless I have an answer, i can't really fix the bug...
Can you be more specific? LaTeX provides hooks for all environments
\AddToHook{env/otherlanguage/before}{<code>}
for example. See lthooks-doc.pdf
.
There is \xpg@hook@setlanguage
which is executed after a language has been set (also with the otherlanguage environment). But like @Udi-Fogiel I do not really understand what you are trying to do.
Actually \polyglossia@language@switched
is also used in that case. So it should work
Well,
in reledpar use we have some structure like this
\begin{Leftside}
\begin{russian}
\beginnumbering
....
\end{russian}
\end{Leftside}
I would like to store that russian is used inside leftside.
In the actual version of reledpar, I do that with
\renewcommand{\otherlanguage}[2][]{%
\selectlanguage[#1]{#2}%
\xpg@set@language@only@aux[#1]{#2}%
\ifledRcol \gdef\theledlanguageR{#2}%
\else \gdef\theledlanguageL{#2}%
\fi}%
I tried to avoir redefinition using
\gappto{\polyglossia@language@switched}{%
\ifledRcol%
\xdef\theledlanguageR{\languagename}%
\else%
\xdef\theledlanguageL{\languagename}%
\fi%
}%
but that can't work, as theledlanguageL
is also redefine when we switch back to the main language.
The easiest thing for now, it seems, is that you redefine \xpg_set_foreign_language:nn
. For the future, we can add a more specific hook only at this place:
\ExplSyntaxOn
\cs_gset_nopar:Nn \xpg_set_foreign_language:nn
{
\xpg_select_language:nn { #1 } { #2 }
\__xpg_register_language:nn{#1}{#2}
\ifledRcol
\xdef\theledlanguageR{\languagename}
\else
\xdef\theledlanguageL{\languagename}%
\fi
}
\ExplSyntaxOff
Maybe
\AddToHook{env/otherlanguage/end}{%
\ifledRcol
\xdef\theledlanguageR{\languagename}%
\else
\xdef\theledlanguageL{\languagename}%
\fi
}
I cannot test right now.
Also, if the language name inside the Leftside
environment is needed, wouldn't it be easier to use
\begin{russian}
\begin{Leftside}
\beginnumbering
....
\end{Leftside}
\end{russian}
I understand that the code should be executed whenever a "secondary" language is switched to, right, be it with otherlanguage
environment or otherwise (e.g., \text<lang>
).
If so I propose to add two new hooks:
{ polyglossia / switchlanguage / after }
which is executed whenever a language is switched (main or other), basically a newer version of \polyglossia@language@switched
which is kept for compatibility{ polyglossia / switchotherlanguage / after }
which is only executed if a secondary language is switched to.Would that help, @maieul ?
@jspitz I think we shouldn't be rush with the topic of hooks. Adding new ones should probably be done in a general flexible manner, otherwise there won't be an end to the hooks we need to keep for backwards compatibility.
@Udi-Fogiel I won't rush, but the two insertion points seem to make sense to me. And the old ones, well. There are just two of them.
Also, if the language name inside the Leftside environment is needed, wouldn't it be easier to use
well, indeed... but there is so many historical code...
The easiest thing for now, it seems, is that you redefine \xpg_set_foreign_language:nn. For the future, we can add a more specific hook only at this place:
I tried, it does not work, I have still english defined as ledlanguageL
Maybe
this version with \AddToHook{env/otherlanguage/end}
does not work also
As a MWE (with xelatex)
\documentclass{book}
\usepackage[osf,p,nomath]{libertinus}
\usepackage{microtype}
\usepackage[pdfusetitle,hidelinks]{hyperref}
\usepackage[series={},nocritical,noend,nofamiliar,noledgroup]{reledmac}
\usepackage{reledpar}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{russian}
\setotherlanguage{hebrew}
\usepackage{metalogo}
\linenumincrement*{1}
\firstlinenum*{1}
\setlength{\Lcolwidth}{0.48\textwidth}
\setlength{\Rcolwidth}{0.48\textwidth}
\begin{document}
\title{Parallel columns in two different languages}
\date{}
\maketitle
{\small
This file provides an example of typesetting parallel columns in two different languages, using reledpar, polyglossia and \XeLaTeX.
The main language is English. The left column is in Russian, the right column in Hebrew.
We have enlarged \verb+\Lcolwidth+ and \verb+\Rcolwidth+ to avoid problem with hyphenations.
We also used \verb+\eledchapter+, which implies that chapter titles are printed with accompanying line numbers.
For an example with \LuaLaTeX, look at \href{./lualatex-parallel-rtl.tex}{lualatex-parallel-rtl.tex}.
}
\begin{pairs}
\begin{Rightside}
\begin{RTL}
\begin{hebrew}
\beginnumbering
\pstart
\eledchapter{המאמר השני}\ledleftnote{s}
\pend
\pstart
בפנות התוריות, ר״ל שהם יסודות ועמודים אשר בית אלהים נכון עליהם, ובמציאותם יציר מציאות התורה מסדרת ממנו יתברך, ואלו יציר העדר אחת מהם תפל התורה בכללה חלילה.
\pend
\endnumbering
\end{hebrew}
\end{RTL}
\end{Rightside}
\begin{Leftside}
\begin{russian}
\beginnumbering
\pstart
\eledchapter{Трактат Второй}
\pend
\pstart
О краеугольных [принципах] Торы, имеется ввиду, которые [есть] основы и столпы на которых дом Б-жий опирается/нахон, и с существованием их может быть представлено существование Торы упорядоченной от Него, благословенного, и если бы было представлено отсутствие одного из них — упадет Тора в общем, [Б-же] упаси.
\pend
\endnumbering
\end{russian}
\end{Leftside}
\end{pairs}
\Columns
\theledlanguageR
\theledlanguageL
\end{document}
As you may see at the end of the page, theledlanguageR
is hebrew, \theledlanguageL
is russian.
With both the previous solution proposed by you 2, I have only english...
I understand that the code should be executed whenever a "secondary" language is switched to, right, be it with otherlanguage environment or otherwise (e.g., \text
).
No @jspitz the question of secundary language is not good in the case of reledpar. For example, if we have a left column in the main language (english), if we switch to latin inside this column, we should not change the language associed globally with the column.
But a contrario if you have
What do you mean by the language associed globally with the column
? it really sounds like a user should declare this language, instead of automatically detecting it. If it is the first language switched in the left column, the use a one time hook.
If it is the first language switched in the left column
It is this one (because reledpar work like this since ledpar...). But for now, this autodetection is broken.
@maieul I can't test yet, but can you please test if my proposition works if you use \begin{otherlanguage}{hebrew}
instead of \begin{hebrew}
?
Or even better, maybe
\makeatletter
\AddToHook{env/Rightside/begin}{%
\AddToHookNext{cmd/polyglossia@language@switched/after}{%
\ifledRcol
\xdef\theledlanguageR{\languagename}%
\else
\xdef\theledlanguageL{\languagename}%
\fi
}}
\makeatother
@Udi-Fogiel your last code worked. I don't do anymore LaTeX in my life, and so I didn't know the new hook in LaTeX.
I have just changed the code in order to avoid unnecessary nested hook and test.
f583378a
Now, I will run regression test, hoping all will be well, and if yes, do release.
Thanks a lot for your help
Finally, I needed to use nexted hook, because of compatibility with babel...
so 1b2c3892
So, I have just sent on CTAN.
Version
reledmac 2024/05/11 v2.40.1 reledpar 2024/05/11 v2.25.6a
TeX Engine
Tested with XeLateX and LuaLaTeX
Regression
This error appeared today after updating to the latest version of
polyglossia
:Description
From my tests it seems that it is related to
reledpar
and that the worst results are obtained withcsquotes
, as in this screenshot:The spurious text disappears without
csquotes
. Compilation is successful withoutreledpar
Minimal Working Example
Here is a MWE. I'm sorry, but in this case I am forced to load a font with polytonic Greek and
polyglossia
.Workaround