reutenauer / polyglossia

An alternative to Babel for XeLaTeX and LuaLaTeX
http://www.ctan.org/pkg/polyglossia
MIT License
187 stars 52 forks source link

csquotes `MakeOuterQuote` does not work #592

Closed sorashi closed 1 year ago

sorashi commented 1 year ago

This seems to be the exact same issue as #421 that was supposed to be fixed in polyglossia 1.50 (if I understand correctly). Now I'm on 1.62 and the issue persists.

Reproduce:

\documentclass[12pt, a4paper]{report}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands=false]{czech}

\usepackage{csquotes}
\MakeOuterQuote{"}

\begin{document}
Testing "quotes".

Testing \enquote{quotes}.

Testing "`quotes"'.
\end{document}

Result: image

Expected: image

(The third test is to see that babelshorthands are really off)

Am I doing something wrong or is the issue back?

jspitz commented 1 year ago

The issue came back with d2f6bf39da62a8dd6 which was necessary to fix a different bug. The only advise for now is to use a different character for the csquotes purpose.

jspitz commented 1 year ago

I have fixed it differently now. I have introduced a central command to activate and deactivate shorthands in the package. This tracks whether we have ourselves activated shorthands and only deactivates them if this was the case, thus leaving " active it is was activated by another package (such as csquotes).

The only gloss file I have not touched is latin, as this has not only "-based shorthands and also handles them generally differently. So the problem still persists if latin is involved.

@wehro You might want to have a look at this and check whether and what needs to be done for latin. Of course, extending the command to other shorthand characters (via an optional argument) is principally possible

In any case, now the above example yields: grafik (which is the expected outcome IMHO as the quotes are also cs-ones in the third case)

and #320 remains fixed.

wehro commented 1 year ago

The only gloss file I have not touched is latin, as this has not only "-based shorthands and also handles them generally differently. So the problem still persists if latin is involved.

@wehro You might want to have a look at this and check whether and what needs to be done for latin. Of course, extending the command to other shorthand characters (via an optional argument) is principally possible

gloss-latin.ldf also needs a change. On first sight I would say that the mechanism you devised should hold for " and ', but not for = and ^, which are more special. I am going to prepare a pull request.

jspitz commented 1 year ago

Should I extend \xpg@activate@shorthands to take an optional argument, or are you doing that in your PR anyway?

jspitz commented 1 year ago

Should I extend \xpg@activate@shorthands to take an optional argument, or are you doing that in your PR anyway?

Well, I went ahead and did that (433dc8ff20e1b). You can now use \xpg@activate@shorthands['] and \xpg@deactivate@shorthands[']. Without optional argument, " is presumed.

As for the PR, note that I will have to do a release soon after the new LaTeX version has been published (which will be in the coming days), since we have a regression that needs to be addressed.

jspitz commented 1 year ago

Fully resolved now (c6a8b3ad1210)