On Tue, 29 Jul 2008 17:10:36 +0200
Jürgen Spitzmüller <[EMAIL PROTECTED]> wrote:

> The current status is that, without my patch applied, Japanese characters are 
> not encoded correctly if "Japanese" (i.e. the pLaTeX-variant) is chosen as a 
> foreign language in a non-Japanese (e.g. English) document.
> 
> This is because Japanese is (IMHO) not correctly implemented in LyX.
> 
> My patch aims at fixing this.
...
> Yes, it needs testing. I do not have pLaTeX installed, so all I can do is 
> judge from the LaTeX export.
> 
> Could you please test if this testcase
> http://bugzilla.lyx.org/attachment.cgi?id=2720&action=view
> 
> is compiled correctly to DVI/PDF with my (or your) patch attached? And also, 
> if it's true that compilation fails without the patch?

If you do not mind mixing of package name and language name used for
babel, your patch works well.
[1] Without any patch Japanese characters are 'uncodable'.
[2] With your patch Japanese characters are codable.
[3] With my patch  Japanese characters are codable,
    but test case lyx file needs to be modified slightly.
    The patch that you revered my naming convention would work well
    without the modification.

=== OS, compiler ===
Debian etch

=== LyX ===
$ svn info
URL: svn://svn.lyx.org/lyx/lyx-devel/trunk
Revision: 26122

=== platex ===
I used ptetex3, a recent version of platex package which can handle
bable: ( http://www.nn.iij4u.or.jp/~tutimura/tex/ptetex.html , 
http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/ptetex3-20080616.tar.gz )
based on tetex-texmf-3.0po.tar.gz and tetex-src-3.0.tar.gz .
There seems to be pdflatex which can convert Japanese characters in MS
Windows
( http://www.fsci.fuk.kindai.ac.jp/kakuto/win32-ptex/web2c75.html ),
but I have not tested it.

[1] Without any patch
$ rm -rf ~/.lyx
$ lyx 2720.lyx

=== settingsA=======================================================
----------------------------------------- 
Document -> Settings ->
Language: Language: English, Encoding: Language Default
----------------------------------------
Tools -> Preferences -> Language Settings -> Language:
Default language: English
Language package: \usepackage{babel}
\selectlanguage{$$lang}
=== results==========================================================
--- % Preview source code-----------------------------------------
\selectlanguage{japanese}
<LyX Warning: uncodable character 'NI'>
<LyX Warning:uncodable character 'HON'>
<LyX Warning: uncodable character 'GO'>
---------------------------------------------
File -> Export -> LaTeX (plain) fails with a message
"Could not find LaTeX command for character 'NI' (code point 0x65e5)."

=== settings B======================================================
Document ->Settigs -> Language Language: japanese
Encoding: Other japanese(non-CJK)(EUC-JP)
---------------------------------------------------------------------------
Tools -> Preferences -> File Handling -> Converters:
Converter Definitions -> LaTeX (plain) -> DVI:
converter: platex
---
results--------------------------------------------------------------
View ->DVI OK Export LaTeX (plain) suceeds


[2] with your patch
$ patch -p0 ../2711.patch
$ make
$ rm -rf ~/.lyx
$ src/lyx ../2720.lyx

===settings=============================================================
--- same as the output of the configure script-------------------------
Document -> Settings -> Language -> 
Language:english, Encoding: Language Default

--- same as the output of the configure script-------------------------
Tools -> Preferences -> Language Settings :
Default language: English
Language package: \usepackage{babel}
\selectlanguage{$$lang}

--- I changed the latex converter----------------------------------
Tools -> Preferences-> FileHandling-> Converters-> 
Converter Difinitions -> latex(plain)->DVI converter: platex

===results====================================================
View->DVI OK View->dvipdfm OK View->pdflatex (Not Available in my PC.)
View->ps2pdf OK View->Postscript OK

=== Note ============================================================== 
It is noted that there is no way to specify encoding of japanese
characters.

[3] With my original patch that I posted last time

=== Test case file 2720.lyx ===========================================
--- % Preview source code ---------------------------------------------
\selectlanguage {japanese}
 <LyX Warning: uncodable character 'NI'>
<LyX Warning: uncodable character 'HON'>
<LyX Warning: uncodable character 'GO'>

 
--- stdout or stderr --------------------------------------------------
Export fails with a message: LyX: Unknown language `japanese' ...

=== Thereofre, I need to modify test case file 2720.lyx ==============
- \lang japanese
+ \lang japanese-platex
See also below[5].

--- same as the output of the configure script ---------------------
Document -> Settings -> Language -> Language: english, Encoding:
Language Default

--- same as the output of the configure script ----------------------
Tools -> Preferences -> Language Settings : Default language: English
Language package: \usepackage{babel}
\selectlanguage{$$lang}

--- Note that the latex converter is configured to be platex ---------
Tools -> Preferences -> File Handling-> Converters-> Converter
Difinitions -> latex(plain)->DVI converter: platex
See [4].

--- results ----------------------------------------------------------
View->DVI OK View->dvipdfm OK
View->pdflatex (Not Available in my PC.)
View->ps2pdf OK
View->Postscript OK

Therefore, the patch you have reverted would work well, although I have
not tested it yet.

[4] 
With my patch, LATEX is set to be 'platex' if PPLATEX ==''.
Now I think the following script is better for latex users:
--- configure.py ---
    if cmdOutput(PLATEX + ' chklatex.ltx').find('pLaTeX2e') != -1:
        # We have the Japanese pLaTeX2e
        addToRC(r'\converter japaneseplatex   dvi    "%s"   "latex"' %
PLATEX)
-       LATEX = PLATEX
+       # LATEX = PLATEX

In this case, users who use Japanese as a minor language needs to change
settings as follows:

LaTeX(plain) -> DVI converter: platex

or
Document Setting -> Language -> Encoding -> 
Other:Japanese (pLaTeX, EUC-JP), while Language: english

[5]
It is noted that Encoding::japanese is a package name becuse
--- in Encoding.cpp ------------------
if (p == "japanese-platex")
  package = Encoding::japanese_platex;
---------------------------------------,
However, \selectlanguage uses Encoding::japanese, which is derived from
the last column in the file lib/encoding.
I prefer that \selectlanguage uses language name used for babel,
i.e. the second column in the file lib/language.
 
> Also, I would be interested to know if it works if languages with special 
> characters (French, German, etc.) are involved?

Could you please prepare a LyX file for testing the special characters ?

Thank you.
Tetsuya Makimura

Reply via email to