You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
since \xpg@current@opts, \languagename are not expanded it caused an infinite loop.
In the latest commit I made sure \languagename would not be defined as it self, which
caused the infinite loop (which is basically returning to the situation before merging my branch),
but I'm not sure it is the correct solution. Should the reference in the example by typeset in French or English?
The reason will be displayed to describe this comment to others. Learn more.
Just note that we did change the code in the aux file because of our patch to \caption. Compare the lines in the aux
\newlabel{foo}{{1}{1}{\xpg@aux {\xpg@current@opts }{\languagename }שלום}{figure.1}{}} % from the caption
\newlabel{bar}{{1}{1}{שלום}{section.1}{}} % from the section
It works, but maybe removing the undesired \xpg@aux {\xpg@current@opts }{\languagename } would be better.
The reason will be displayed to describe this comment to others. Learn more.
We added it since captions might float to regions with different language, and then the language of the caption entry can be wrong (in LOF). We have a ticket for this, query for it.
If you find a solution that does not break the example in the ticket, I am all for removing redundant code.
The reason will be displayed to describe this comment to others. Learn more.
We added it since captions might float to regions with different language, and then the language of the caption entry can be wrong (in LOF). We have a ticket for this, query for it.
Yes, I'm aware of that.
If you find a solution that does not break the example in the ticket, I am all for removing redundant code.
How about the following patch?
diff --git a/tex/polyglossia.sty b/tex/polyglossia.sty
index 03f3939a..d5b05835 100644
--- a/tex/polyglossia.sty+++ b/tex/polyglossia.sty@@ -1473,14 +1473,20 @@
% for the lot/lof.
% Since captions might float to other language regions,
% we need to specify the language here (#542)
- \cs_set_eq:cc { __xpg_save_caption:n } { @caption }- \cs_new:Npn \xpg@current@opts {}-- \cs_set:Npn \@caption #1 [#2] #3+ \cs_if_exist:cTF { NR@@caption }
{
- % we might be outside of l3 catcode regime- \tl_set_eq:NN \xpg@current@opts \xpg__current_options_tl- \__xpg_save_caption:n { #1 } [ { \xpg@aux{\xpg@current@opts}{\languagename}#2 } ] { #3 }+ \cs_set_eq:Nc \__xpg_save_caption:n { NR@caption }+ \cs_set:Npn \NR@caption #1 [#2] #3+ {+ \__xpg_save_caption:n { #1 } [ { \xpg@aux{\xpg__current_options_tl}{\languagename}#2 } ] { #3 }+ }+ }+ {+ \cs_set_eq:Nc \__xpg_save_caption:n { @caption }+ \cs_set:Npn \@caption #1 [#2] #3+ {+ \__xpg_save_caption:n { #1 } [ { \xpg@aux{\xpg__current_options_tl}{\languagename}#2 } ] { #3 }+ }
}
}
where \NR@@caption is the original \@caption, and \NR@title is a macro that saves the label title.
We want the language information only in the LOF slot, which the second argument of \NR@@caption
is responsible for, while not add the language information to the label title.
Since \NR@@caption is in fact the original \@caption this is what we want to patch.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no starred variant of
\selectlanguage
anymore... Can you give a simple example of the problem?83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Scott's mail to both of us.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks, I've completely missed these messages.
Here is the source of the problem
If you will look in the aux file you will see the line
since
\xpg@current@opts
,\languagename
are not expanded it caused an infinite loop.In the latest commit I made sure
\languagename
would not be defined as it self, whichcaused the infinite loop (which is basically returning to the situation before merging my branch),
but I'm not sure it is the correct solution. Should the reference in the example by typeset in French or English?
Currently it is in French
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it is the same in v2.3.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible patch
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference should be in French since it is in a French context (the figure caption in the LOF should be in English). So this looks correct to me.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we have a redundant language switch...
And what about the following?
Its seems a bit counter productive to me.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but that's how nameref works. This is not related to floating objects. See:
I don't think polyglossia should tinker with that.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just note that we did change the code in the aux file because of our patch to
\caption
. Compare the lines in the auxIt works, but maybe removing the undesired
\xpg@aux {\xpg@current@opts }{\languagename }
would be better.83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We added it since captions might float to regions with different language, and then the language of the caption entry can be wrong (in LOF). We have a ticket for this, query for it.
If you find a solution that does not break the example in the ticket, I am all for removing redundant code.
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm aware of that.
How about the following patch?
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are
NR@caption
andNR@@caption
?83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\NR@@caption
is wherenameref
save the original\@caption
(same as\__xpg_save_caption:n
),\NR@caption
is a typo83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if
\NR@@caption
exists we do not need to patch\@caption
for the LOF to be correct? Why is that?83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct patch
83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nameref
redefines\@caption
aswhere
\NR@@caption
is the original\@caption
, and\NR@title
is a macro that saves the label title.We want the language information only in the LOF slot, which the second argument of
\NR@@caption
is responsible for, while not add the language information to the label title.
Since
\NR@@caption
is in fact the original\@caption
this is what we want to patch.83b1cbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. OK, then (haven't tested, though)