On 2012-07-10, Georg Baum wrote: > Uwe Stöhr wrote: >> Am 08.07.2012 22:18, schrieb Georg Baum:
>>> Please forget about LyX for a moment. As far as LaTeX is concerned, >>> english is the only language that explicitly appears in a LaTeX command >>> (or rather the preamble in this case) in this document. All other >>> languages do not appear explicitly in the document, you rather guess them >>> from the used encodings. Therefore, from a LaTeX point of view, the >>> language is clearly english. >> I don't agree. There is only one paragraph in English in this file. > But this one is typeset using rules for the english language (hyphenation > etc). If for some reason the document language was not set to english this > paragraph would need to be marked as english, otherwise the output might be > different. Only, if the document language were set to another language than "english", not if there were no language indication at all. >> But the CJK encoding determines the language. E.g. EUC-JP can only be >> Japanese. OK, the UTF8 case is problematic. > No, it could also be english. AFAIK we do not support encodings that are not > a superset of ASCII. EUC-JP is a strong hint that the language is probably > japanese, and we should make use of this hint, but it is not 100% sure. This is not completely true: One reason for the difficulties with babel's Greek support is that it uses a Latin transliteration, so that you cannot write text in Latin script (without marking it as being in a language using Latin script) if the document language is Greek. AFAIK, the same goes for tipa input. ... > This is very vague: "guess he might wonder". I am not sure whether this > guess is true, but I am pretty sure that the note will upset users who know > what they are doing. If you want you can also implement a better heuristic, > e.g. if babel is not used, set the document langauge to the language that is > used by the majority of the text. IMHO this would be much better than the > note, since it covers the main use case of single language documents > perfectly. Please don't use overly cleverly heuristics nor guesswork. ... > Babel is not used if you import a .tex file that does not use it (at least > this was the case some time ago). If this is not true anymore it is a bug. It is a bug. ... >> I don't understand. We don't guess, we only tell the user that his file >> contains CJK so that the document languages set by LyX _can_ be the wrong >> one. > My argument is that the language is never wrong. Setting "English" explicitly when no language is specified in the source is wrong. >> The user decides what is correct as document language, not tex2lyx! >> tex2lyx only sets one because the LyX fileformat requires this. How about using \language ignore (defined as internal in "lyx/lib/languages") in case of an unknown document language. Would this require a file-format change? > The only special case is if babel is not used. Then the document language is > arbitrarily set to english. We could indeed argue whether a "no language" > would be better, but technically it works (this language does not influence > the exported .tex at all). It can influence the exported .tex, because the document class options are handed to all packages. We don't know which packages a user loads in the custom preamble and whether the argument may change their behaviour. > In all other cases (even the original CJK.tex test file), the language is > set to the last one that appears in the babel options. This is the only > correct thing to do (think e.g. of hyphenation). Yes. Günter