Re: lib/languages polutonikogreek bug

2010-01-12 Thread Jürgen Spitzmüller
Guenter Milde wrote:
 * as the special meaning of the ~ character in babel's polutonikogreek
   is now cared for by LyX, we don't need special setup code.
   
 --- a/lib/languages
 +++ b/lib/languages
 @@ -43,7 +43,7 @@ german  germanGerman (old spelling)
  false  iso8859-1 ngerman ngermanGermanfalse  iso8859-15
  de_DE   german-ch   ngermanGerman (Switzerland)  false  iso8859-15
  de_CH  
  greek   greek  Greek false  iso8859-7  el_GR  
  -polutonikogreek polutonikogreekGreek
  (polytonic) false  iso8859-7  el_GR 
  \addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\cha
 r126} +polutonikogreek polutonikogreekGreek
  (polytonic) false  iso8859-7  el_GR  
  hebrew  hebrew Hebrewtrue   cp1255 he_IL   #
  hungarian is a synonym for the magyar babel language option #
  hungarian might be used for special purposes, see
  http://www.math.bme.hu/la

This extra definition is there to enable accent-tilde with Greek. Does this 
still work with your patch?

Jürgen


Re: lib/languages polutonikogreek bug

2010-01-12 Thread Guenter Milde
On 2010-01-12, Jürgen Spitzmüller wrote:
 Guenter Milde wrote:
 * as the special meaning of the ~ character in babel's polutonikogreek
   is now cared for by LyX, we don't need special setup code.

 --- a/lib/languages
 +++ b/lib/languages
  -polutonikogreek polutonikogreekGreek (polytonic) false iso8859-7 
 el_GR 
 \addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\char126}
  
  +polutonikogreek polutonikogreekGreek (polytonic) false  
 iso8859-7  el_GR  
...

 This extra definition is there to enable accent-tilde with Greek. 

Actually, the extra definition was already changed away from your
accent-tilde saving and is currently broken.

Also, as your accent-tilde saving code was only added to
'polutonikogreek' but not 'greek', accent-tilde always failed for
(monotonic) Greek where babel (re)defines \~ as \char126 too. (This is a
minor issue, as monotonic Greek does not use the perispomeni accent.)

 Does this still work with your patch?

Accent-tilde works for polytonic Greek: 

  the “combining” feature does not place {} around the accented character
  if the current language is polutonikogreek. The “input ligatures”
  defined in the LGR font encoding then work to convert e.g. ~a to an
  accented alpha.

It fails:

1. for Greek characters that cannot be encoded in the document encoding
   because then we get e.g. \~\textgreek{a}

2. for '~'-accented characters in any other language inside a Greek
   document (both polytonic and monotonic) 
   
   * if the textgreek feature is used (i.e. the document contains at
 least one Greek char that is converted via the 'unicodesymbols'
 file,
 
   * except when the accented character is passed to LaTeX in a
 suitable encoding.

See the test case attachments at the (closed) ticket 5976.
http://www.lyx.org/trac/ticket/5976


Fixes:

Bug 1
-

Problem:
  The 'accent-tilde' LFUN places a COMBINING TILDE (Unicode char 0x0303)
  behind the to-be-accented char and normalizes them if possible.

  By default, the unicodesymbols file converts “char + COMBINING TILDE”
  to \~{char}. Also, most normalized unicode chars (like ñ) are
  expanded in the same way.

possible solutions:

a) apply combining before textgreek to get e.g. \textgreek{\~a}.
   This would also solve cases like accent-circonflex α.

b) a sloppy normalization that merges greek car + COMBINING TILDE
   to the corresponding GREEK char WITH PERISPOMENI

Bug 2
-

This is caused by the current (re)definition of \greektext with the
textgreek feature interfering with babels internal use of \greektext:

  \providecommand*{\perispomeni}{\char126}
  \AtBeginDocument{\DeclareRobustCommand{\greektext}{%
\fontencoding{LGR}\selectfont\def\encodingdefault{LGR}%
\renewcommand{\~}{\perispomeni}%
  }}
  \DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
  \DeclareFontEncoding{LGR}{}{}

A possible fix is to change this to

\DeclareRobustCommand{\textgreek}[1]{\leavevmode{%
  \fontencoding{LGR}\selectfont\def\encodingdefault{LGR}%
  \renewcommand{\~}{\char126}%
  \greektext #1%
}}

(patch for LaTeXFeatures.cpp below)

Alternatively, one could do without the renewcommand and use \char126 for
the perispomeni in 'unicodesymbols' (patch on request).
   
   
Thanks,

Günter


---a/src/LaTeXFeatures.cpp
+++b/src/LaTeXFeatures.cpp

@@ -195,12 +195,11 @@ static docstring const changetracking_none_def = 
from_ascii(
\\newcommand{\\lyxdeleted}[3]{}\n);
 
 static docstring const textgreek_def = from_ascii(
-   \\providecommand*{\\perispomeni}{\\char126}\n
-   \\AtBeginDocument{\\DeclareRobustCommand{\\greektext}{%\n
- \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}\n
- \\renewcommand{\\~}{\\perispomeni}\n
+   \\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{%\n
+ \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}%\n
+ \\renewcommand{\\~}{\\char126}%\n
+ #1%\n
}}\n
-   \\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{\\greektext #1}}\n
\\DeclareFontEncoding{LGR}{}{}\n);
 
 static docstring const textcyr_def = from_ascii(




Re: lib/languages polutonikogreek bug

2010-01-12 Thread Jürgen Spitzmüller
Guenter Milde wrote:
> * as the special meaning of the ~ character in babel's polutonikogreek
>   is now cared for by LyX, we don't need special setup code.
>   
> --- a/lib/languages
> +++ b/lib/languages
> @@ -43,7 +43,7 @@ german  german"German (old spelling)"
>  false  iso8859-1 ngerman ngerman"German"false  iso8859-15
>  de_DE  "" german-ch   ngerman"German (Switzerland)"  false  iso8859-15
>  de_CH  ""
>  greek   greek  "Greek" false  iso8859-7  el_GR  ""
>  -polutonikogreek polutonikogreek"Greek
>  (polytonic)" false  iso8859-7  el_GR 
>  "\addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\cha
> r126}" +polutonikogreek polutonikogreek"Greek
>  (polytonic)" false  iso8859-7  el_GR  ""
>  hebrew  hebrew "Hebrew"true   cp1255 he_IL  "" #
>  "hungarian" is a synonym for the "magyar" babel language option #
>  "hungarian" might be used for special purposes, see
>  http://www.math.bme.hu/la

This extra definition is there to enable accent-tilde with Greek. Does this 
still work with your patch?

Jürgen


Re: lib/languages polutonikogreek bug

2010-01-12 Thread Guenter Milde
On 2010-01-12, Jürgen Spitzmüller wrote:
> Guenter Milde wrote:
>> * as the special meaning of the ~ character in babel's polutonikogreek
>>   is now cared for by LyX, we don't need special setup code.

>> --- a/lib/languages
>> +++ b/lib/languages
>>  -polutonikogreek polutonikogreek"Greek (polytonic)" false iso8859-7 
>> el_GR 
>> "\addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\char126}"
>>  
>>  +polutonikogreek polutonikogreek"Greek (polytonic)" false  
>> iso8859-7  el_GR  ""
...

> This extra definition is there to enable accent-tilde with Greek. 

Actually, the extra definition was already changed away from your
"accent-tilde saving" and is currently broken.

Also, as your "accent-tilde saving" code was only added to
'polutonikogreek' but not 'greek', accent-tilde always failed for
(monotonic) Greek where babel (re)defines \~ as \char126 too. (This is a
minor issue, as monotonic Greek does not use the perispomeni accent.)

> Does this still work with your patch?

Accent-tilde works for polytonic Greek: 

  the “combining” feature does not place {} around the accented character
  if the current language is polutonikogreek. The “input ligatures”
  defined in the LGR font encoding then work to convert e.g. ~a to an
  accented alpha.

It fails:

1. for Greek characters that cannot be encoded in the document encoding
   because then we get e.g. \~\textgreek{a}

2. for '~'-accented characters in any other language inside a Greek
   document (both polytonic and monotonic) 
   
   * if the "textgreek" feature is used (i.e. the document contains at
 least one Greek char that is converted via the 'unicodesymbols'
 file,
 
   * except when the accented character is passed to LaTeX in a
 suitable encoding.

See the test case attachments at the (closed) ticket 5976.
http://www.lyx.org/trac/ticket/5976


Fixes:

Bug 1
-

Problem:
  The 'accent-tilde' LFUN places a COMBINING TILDE (Unicode char 0x0303)
  behind the to-be-accented char and normalizes them if possible.

  By default, the unicodesymbols file converts “ + COMBINING TILDE”
  to \~{}. Also, most normalized unicode chars (like ñ) are
  expanded in the same way.

possible solutions:

a) apply "combining" before "textgreek" to get e.g. \textgreek{\~a}.
   This would also solve cases like "accent-circonflex α".

b) a "sloppy" normalization that merges " + COMBINING TILDE"
   to the corresponding "GREEK  WITH PERISPOMENI"

Bug 2
-

This is caused by the current (re)definition of \greektext with the
"textgreek" feature interfering with babels internal use of \greektext:

  \providecommand*{\perispomeni}{\char126}
  \AtBeginDocument{\DeclareRobustCommand{\greektext}{%
\fontencoding{LGR}\selectfont\def\encodingdefault{LGR}%
\renewcommand{\~}{\perispomeni}%
  }}
  \DeclareRobustCommand{\textgreek}[1]{\leavevmode{\greektext #1}}
  \DeclareFontEncoding{LGR}{}{}

A possible fix is to change this to

\DeclareRobustCommand{\textgreek}[1]{\leavevmode{%
  \fontencoding{LGR}\selectfont\def\encodingdefault{LGR}%
  \renewcommand{\~}{\char126}%
  \greektext #1%
}}

(patch for LaTeXFeatures.cpp below)

Alternatively, one could do without the renewcommand and use \char126 for
the perispomeni in 'unicodesymbols' (patch on request).
   
   
Thanks,

Günter


---a/src/LaTeXFeatures.cpp
+++b/src/LaTeXFeatures.cpp

@@ -195,12 +195,11 @@ static docstring const changetracking_none_def = 
from_ascii(
"\\newcommand{\\lyxdeleted}[3]{}\n");
 
 static docstring const textgreek_def = from_ascii(
-   "\\providecommand*{\\perispomeni}{\\char126}\n"
-   "\\AtBeginDocument{\\DeclareRobustCommand{\\greektext}{%\n"
-   "  \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}\n"
-   "  \\renewcommand{\\~}{\\perispomeni}\n"
+   "\\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{%\n"
+   "  \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}%\n"
+   "  \\renewcommand{\\~}{\\char126}%\n"
+   "  #1%\n"
"}}\n"
-   "\\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{\\greektext #1}}\n"
"\\DeclareFontEncoding{LGR}{}{}\n");
 
 static docstring const textcyr_def = from_ascii(




lib/languages polutonikogreek bug

2010-01-11 Thread Guenter Milde
Dear developers,

I have to admit that my latest patch for poytonic Greek, though
looking simple and innocent contained a bug that makes compilation of
(some) documents in polutonikogreek fail.

Fortunately, the fix is simple and even more simplifies lib/languages:

* as the special meaning of the ~ character in babel's polutonikogreek
  is now cared for by LyX, we don't need special setup code.
  
--- a/lib/languages
+++ b/lib/languages
@@ -43,7 +43,7 @@ german  germanGerman (old spelling) false  iso8859-1
 ngerman ngermanGermanfalse  iso8859-15 de_DE  
 german-ch   ngermanGerman (Switzerland)  false  iso8859-15 de_CH  
 greek   greek  Greek false  iso8859-7  el_GR  
-polutonikogreek polutonikogreekGreek (polytonic) false  
iso8859-7  el_GR  
\addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\char126}
+polutonikogreek polutonikogreekGreek (polytonic) false  
iso8859-7  el_GR  
 hebrew  hebrew Hebrewtrue   cp1255 he_IL  
 # hungarian is a synonym for the magyar babel language option
 # hungarian might be used for special purposes, see http://www.math.bme.hu/la


The other part of this patch (change to src/LaTeXFeatures.cpp) is OK.

Should I post/upload the test files? Where?

sorry for the inconvenience,

Günter



lib/languages polutonikogreek bug

2010-01-11 Thread Guenter Milde
Dear developers,

I have to admit that my latest patch for poytonic Greek, though
looking simple and innocent contained a bug that makes compilation of
(some) documents in "polutonikogreek" fail.

Fortunately, the fix is simple and even more simplifies lib/languages:

* as the special meaning of the ~ character in babel's polutonikogreek
  is now cared for by LyX, we don't need special setup code.
  
--- a/lib/languages
+++ b/lib/languages
@@ -43,7 +43,7 @@ german  german"German (old spelling)" false  iso8859-1
 ngerman ngerman"German"false  iso8859-15 de_DE  ""
 german-ch   ngerman"German (Switzerland)"  false  iso8859-15 de_CH  ""
 greek   greek  "Greek" false  iso8859-7  el_GR  ""
-polutonikogreek polutonikogreek"Greek (polytonic)" false  
iso8859-7  el_GR  
"\addto\extraspolutonikogreek{\let\~\char126}\addto\extrasgreek{\let\~\char126}"
+polutonikogreek polutonikogreek"Greek (polytonic)" false  
iso8859-7  el_GR  ""
 hebrew  hebrew "Hebrew"true   cp1255 he_IL  ""
 # "hungarian" is a synonym for the "magyar" babel language option
 # "hungarian" might be used for special purposes, see http://www.math.bme.hu/la


The other part of this patch (change to src/LaTeXFeatures.cpp) is OK.

Should I post/upload the test files? Where?

sorry for the inconvenience,

Günter