On Sat, Sep 24, 2016 at 01:25:42AM +0000, Enrico Forestieri wrote:
> commit 3bc08a76c42cd350a3141f00f37082bc9fab8967
> Author: Enrico Forestieri <for...@lyx.org>
> Date:   Sat Sep 24 03:15:02 2016 +0200
> 
>     Sort the language nesting mess with polyglossia
>     
>     When using polyglossia, lyx was making a real mess when changing
>     language inside nested insets. The \begin{language} and
>     \end{language} commands were not well paired such that they could
>     easily occur just before and after the start or end of an
>     environment. Of course this was causing latex errors such that
>     "\begin{otherlanguage} ended by \end{environment}".
>     There may still be some cases I did not take into account.

A git bisect suggests this caused a change in behavior. The attached
.lyx file fails to compile to XeTeX or LuaTeX starting with this commit.

Attached also is the XeTeX code that LyX writes for this file. The
problem is here:

\begin{english}%
\item[\(\star\)}]  \textfrench{Agissez sur chaque entrée...}
\end{english}%

From what I can tell, the problem is the curly brace after "(\star\)".

Current 2.3.x produces a different LaTeX file (I attach this .tex file
also). There are two notable differences compared to the .tex file
created from this commit. For one, the package xunicode is no longer
loaded in current 2.3.x. And second, there is no longer a
"\end{english}", which causes an error even if the curly brace
referenced above is removed.

I created the attached .lyx MWE from the 2.3.x branch fr/Additional.lyx.
ctests started failing recently on that file (probably after we copied
some new English into it to be translated?). I don't know how that part
of fr/Additional.lyx was created. Perhaps the problem is in the the
creation of the file, not the parsing?

Enrico, thanks a lot for tackling these language nesting issues. The
only thing I understand from this code is that it is very complex and
fragile. Let me know if you want me to run the ctests on a potential
patch.

I'm open to whatever you suggest for 2.3.0. If this code is so fragile
that you suggest we leave it as it is, that's fine with me. 2.3.x is
already in a much better state as far as language nesting, compared to
2.2.0, thanks to your work.

Scott

Attachment: switching_mwe_bad.21.lyx
Description: application/lyx

%% LyX 2.3.0dev created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,french]{article}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{FreeSans}
\setsansfont[Mapping=tex-text]{FreeSans}
\setmonofont{FreeSans}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguage{english}
\begin{document}
\begin{itemize}
\item abc
\begin{english}[variant=american]%
\item[\(\star\)}]  \textfrench{Agissez sur chaque entrée...}
\end{itemize}

\end{document}
%% LyX 2.3.0dev created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,french]{article}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{FreeSans}
\setsansfont[Mapping=tex-text]{FreeSans}
\setmonofont{FreeSans}
\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguage{english}
\begin{document}
\begin{itemize}
\item abc
\begin{english}%
\item[\(\star\)}]  \textfrench{Agissez sur chaque entrée...}
\end{english}%
\end{itemize}

\end{document}

Attachment: signature.asc
Description: PGP signature

Reply via email to