On Thu, Jul 12, 2007 at 09:19:15PM +0300, Dov Feldstern wrote:

> What the patch is trying to fix is the case where a language switch was 
> being missed, for example in the following situation:
> 
> document language is english
> \lang english
> bla bla bla
> \lang hebrew
> BLA BLA BLA
> \footnote
> \lang english   <----
> bla bla bla
> 
> The marked language switch was being missed, because LyX was assuming 
> the language at the beginning of a new paragraph is either the language 
> of the previous paragraph, or if there is none, the language of the 
> document. However, inside the inset, paragraph count start at 0 again 
> --- so there's no previous paragraph, so LyX assumes the current 
> language is english, and therefore decides that the "\lang english" 
> command is unnecessary upon entering the inset. LyX is wrong, however: 
> as far as latex is concerned, upon entering the footnote, the current 
> language is hebrew, and therefore to input english, it *is* necessary to 
> include the \lang english command inside the footnote...
> 
> So that's what I'm trying to solve. The problem is, I may be breaking 
> other, similar, situations...

Dov,

this is what I did. Without your patch applied, I started a new
document, so the language is english, and then activated "View Source".
I wrote "bla bla bla ", then switched the language to italian and wrote
"BLA BLA BLA". Now I inserted a footnote and wrote "bla bla bla".

At this point, this is what I saw in the "LaTeX Source" window:

(Point 1a)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{\selectlanguage{italian}
bla bla bla\selectlanguage{english}
%
}

Now I pressed backspace until I deleted the last "bla bla bla" I wrote.
The following is what the "LaTeX Source" window was showing at this point:

(Point 2a)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{%
}

Writing again "bla bla bla", I got:

(Point 3a)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{bla bla bla%
}

which lacks the \selectlanguage commands, meaning that I obtain different
results after backspacing and writing again!

Now I applied your patch and repeated the previous steps. The results I
was getting at the same points as before, are the following:

(Point 1b)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{bla bla bla\selectlanguage{english}
%
}

Note that a \selectlanguage{italian} is missing here wrt Point 1a.


(Point 2b)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{\selectlanguage{english}
%
}

Note that a \selectlanguage{english} is still here wrt Point 2a.


(Point 3b)
bla bla bla \foreignlanguage{italian}{BLA BLA BLA}%
\footnote{\selectlanguage{english}
bla bla bla%
}

Note that what I wrote now was coming after \selectlanguage{english}

I think that now I am more confused than you... Without your patch,
LyX seems correctly translating to LaTeX after backspacing and writing
again in the footnote, as the text in the foreign language is the argument
of \foreignlanguage, so it should not apply to the footnote. With your
patch applied, there's only a \selectlanguage{english} in the footnote,
so it should always be correct without the need of backspacing.

Anyway, with or without your patch I am concerned about obtaining
different results after simply backspacing and writing again in the
footnote.

-- 
Enrico

Reply via email to