]> git.lyx.org Git - features.git/commitdiff
Fix bug #8468: Wrong import of UTF8 CJK.
authorGeorg Baum <baum@lyx.org>
Sun, 30 Dec 2012 10:58:21 +0000 (11:58 +0100)
committerGeorg Baum <baum@lyx.org>
Sun, 30 Dec 2012 19:52:49 +0000 (20:52 +0100)
Actually, the test case showed several problems:
- ERT insets did use layout "Standard", not "Plain Layout"
- The font scale was read correctly, but tex2lyx claimed that it did ignore
  the option "scaled=0.95"
- If a third argument of the CJK environment was given, it caused the whole
  environment to be put in ERT with a broken encoding. This is now fixed for
  the bug test case by using the \font_cjk header variable, but the encoding
  problem still exists for unsupported encodings. I'll file a separate bug
  for that.
- The CJKutf8 package was not handled in the preamble parsing. Therefore the
  chinese comment in the preamble was read with a wrong encoding, and guessing
  the document language did not work.
The new file CJKutf8.tex was created by copying and modifying CJK.tex, but
unfortunately it is impossible to tell git to inherit the history of CJK.tex
for the new file (search the web for git svn copy if you want to know details).

23 files changed:
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathString.cpp
src/mathed/MathFactory.cpp
src/mathed/MathMacro.cpp
src/output_latex.cpp
src/tex2lyx/Context.cpp
src/tex2lyx/Makefile.am
src/tex2lyx/Preamble.cpp
src/tex2lyx/Preamble.h
src/tex2lyx/TODO.txt
src/tex2lyx/test/CJK.lyx.lyx
src/tex2lyx/test/CJKutf8.lyx.lyx [new file with mode: 0644]
src/tex2lyx/test/CJKutf8.tex [new file with mode: 0644]
src/tex2lyx/test/CMakeLists.txt
src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx
src/tex2lyx/test/box-color-size-space-align.lyx.lyx
src/tex2lyx/test/runtests.py
src/tex2lyx/test/test-insets.lyx.lyx
src/tex2lyx/test/test-modules.lyx.lyx
src/tex2lyx/test/test-structure.lyx.lyx
src/tex2lyx/test/test.lyx.lyx
src/tex2lyx/text.cpp

index e23723ca8d3a6ed17b1dd117ae49faab4b9900e5..2e62ffcd6073d8732edcada6e45e50c60fbf68c7 100644 (file)
@@ -140,7 +140,7 @@ void InsetMathChar::write(WriteStream & os) const
 
 void InsetMathChar::validate(LaTeXFeatures & features) const
 {
-       if (char_ >= 0x80)
+       if (!isASCII(char_))
                encodings.validate(char_, features, true);
 }
 
index e74d549c48506c91113e462d0345d2b518847664..b4619de470a0f3d3baadf6565393e0774a521c7a 100644 (file)
@@ -1343,7 +1343,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                }
                InsetMathGrid grid(buffer_, 1, 1);
                if (!topaste.empty())
-                       if ((topaste.size() == 1 && topaste.at(0) < 0x80)
+                       if ((topaste.size() == 1 && isAscii(topaste))
                            || !mathed_parse_normal(grid, topaste, parseflg)) {
                                resetGrid(grid);
                                mathed_parse_normal(grid, topaste, parseflg | Parse::VERBATIM);
index 5217566c219bcd4899cd0530be2c35618830f72d..44aad43c805075d3176fa88d4fe670ba1e1222a0 100644 (file)
@@ -120,7 +120,7 @@ void InsetMathString::write(WriteStream & os) const
                docstring command(1, c);
                try {
                        bool termination = false;
-                       if (c < 0x80 ||
+                       if (isASCII(c) ||
                            Encodings::latexMathChar(c, mathmode, os.encoding(), command, termination)) {
                                if (os.textMode()) {
                                        if (in_forced_mode) {
@@ -129,12 +129,12 @@ void InsetMathString::write(WriteStream & os) const
                                                os.textMode(false);
                                                in_forced_mode = false;
                                        }
-                                       if (c >= 0x80 && os.textMode()) {
+                                       if (!isASCII(c) && os.textMode()) {
                                                os << "\\ensuremath{";
                                                os.textMode(false);
                                                in_forced_mode = true;
                                        }
-                               } else if (c < 0x80 && in_forced_mode) {
+                               } else if (isASCII(c) && in_forced_mode) {
                                        // we were inside \ensuremath
                                        os << '}';
                                        os.textMode(true);
index 5266edae67e08d526c4ae91143a81e9811a784a4..ac3ac9861965ea336afffbc5942d665cdd20a260 100644 (file)
@@ -62,6 +62,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h" // LibFileSearch
 #include "support/lstrings.h"
+#include "support/textutils.h"
 
 #include "frontends/FontLoader.h"
 
@@ -588,7 +589,7 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
 
 bool isAsciiOrMathAlpha(char_type c)
 {
-       return c < 0x80 || Encodings::isMathAlpha(c);
+       return isASCII(c) || Encodings::isMathAlpha(c);
 }
 
 
index 1786e81c29d4fd3427314aaf14c843467a3d0ae7..76aafb7cd25bc9539cb51320d7b4fadebcf7cdee 100644 (file)
@@ -732,7 +732,7 @@ void MathMacro::write(WriteStream & os) const
        for (; i < cells_.size(); ++i) {
                if (cell(i).size() == 1 
                        && cell(i)[0].nucleus()->asCharInset()
-                       && cell(i)[0].nucleus()->asCharInset()->getChar() < 0x80) {
+                       && isASCII(cell(i)[0].nucleus()->asCharInset()->getChar())) {
                        if (first)
                                os << " ";
                        os << cell(i);
index cd67e1729fff468ac6042a24ec22bb4b87307df7..f2c99db146a68b9558a0b3311fdc82dbc02abf79 100644 (file)
@@ -33,6 +33,7 @@
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
+#include "support/textutils.h"
 
 #include <algorithm>
 #include <boost/next_prior.hpp>
@@ -744,7 +745,7 @@ void TeXOnePar(Buffer const & buf,
                                par.getFontSettings(bparams, i).language()->encoding();
                        if (encoding->package() != Encoding::CJK
                                && runparams.encoding->package() == Encoding::inputenc
-                               && c < 0x80)
+                               && isASCII(c))
                                continue;
                        if (par.isInset(i))
                                break;
index fecc11aedfb5a6ba4babd9d2002f1dcb9600a85b..6de70f9c1f3b5d2c81c51ac0b4995d5fe88eace8 100644 (file)
@@ -115,7 +115,7 @@ void Context::begin_layout(ostream & os, Layout const * const & l)
        // \\Huge par1 \\par par2
        // FIXME: If the document language is not english this outputs a
        // superflous language change. Fortunately this is only file format
-       // bloat an does not change the TeX export of LyX.
+       // bloat and does not change the TeX export of LyX.
        output_font_change(os, normalfont, font);
 }
 
index 44143e26fe39f1e25b8d7bf79b67e2d1b7f22003..f7193082380717bce1a0445c109cc785201144db 100644 (file)
@@ -23,6 +23,7 @@ TEST_FILES = \
        test/runtests.py \
        test/box-color-size-space-align.tex \
        test/CJK.tex \
+       test/CJKutf8.tex \
        test/DummyDocument.tex \
        test/Dummy~Document.tex \
        test/Dummy\ Document.tex \
index 31ac0916e2409c93581cf7232b3c1a6f26ed4688..0c523c7f5d3e4e7a907a5b28afcfe20a4e63a762 100644 (file)
@@ -405,18 +405,18 @@ void Preamble::add_package(string const & name, vector<string> & options)
 
 namespace {
 
-// Given is a string like "scaled=0.9", return 0.9 * 100
-string const scale_as_percentage(string const & scale)
+// Given is a string like "scaled=0.9" or "Scale=0.9", return 0.9 * 100
+bool scale_as_percentage(string const & scale, string & percentage)
 {
        string::size_type pos = scale.find('=');
        if (pos != string::npos) {
                string value = scale.substr(pos + 1);
-               if (isStrDbl(value))
-                       return convert<string>(100 * convert<double>(value));
+               if (isStrDbl(value)) {
+                       percentage = convert<string>(100 * convert<double>(value));
+                       return true;
+               }
        }
-       // If the input string didn't match our expectations.
-       // return the default value "100"
-       return "100";
+       return false;
 }
 
 
@@ -432,7 +432,8 @@ string remove_braces(string const & value)
 } // anonymous namespace
 
 
-Preamble::Preamble() : one_language(true), title_layout_found(false)
+Preamble::Preamble() : one_language(true), title_layout_found(false),
+       h_font_cjk_set(false)
 {
        //h_backgroundcolor;
        //h_boxbgcolor;
@@ -455,6 +456,7 @@ Preamble::Preamble() : one_language(true), title_layout_found(false)
        h_font_osf                = "false";
        h_font_sf_scale           = "100";
        h_font_tt_scale           = "100";
+       //h_font_cjk
        h_graphics                = "default";
        h_default_output_format   = "default";
        h_html_be_strict          = "false";
@@ -642,7 +644,6 @@ void Preamble::handle_package(Parser &p, string const & name,
 {
        vector<string> options = split_options(opts);
        add_package(name, options);
-       string scale;
        char const * const * where = 0;
 
        if (is_known(name, known_xetex_packages)) {
@@ -673,9 +674,9 @@ void Preamble::handle_package(Parser &p, string const & name,
        // sansserif fonts
        if (is_known(name, known_sans_fonts)) {
                h_font_sans = name;
-               if (!opts.empty()) {
-                       scale = opts;
-                       h_font_sf_scale = scale_as_percentage(scale);
+               if (options.size() == 1) {
+                       if (scale_as_percentage(opts, h_font_sf_scale))
+                               options.clear();
                }
        }
 
@@ -685,9 +686,9 @@ void Preamble::handle_package(Parser &p, string const & name,
                // fourier as typewriter is handled in handling of \ttdefault
                if (name != "fourier") {
                        h_font_typewriter = name;
-                       if (!opts.empty()) {
-                               scale = opts;
-                               h_font_tt_scale = scale_as_percentage(scale);
+                       if (options.size() == 1) {
+                               if (scale_as_percentage(opts, h_font_tt_scale))
+                                       options.clear();
                        }
                }
        }
@@ -766,6 +767,12 @@ void Preamble::handle_package(Parser &p, string const & name,
                registerAutomaticallyLoadedPackage("CJK");
        }
 
+       else if (name == "CJKutf8") {
+               h_inputencoding = "UTF8";
+               p.setEncoding(h_inputencoding);
+               registerAutomaticallyLoadedPackage("CJKutf8");
+       }
+
        else if (name == "fontenc") {
                h_fontencoding = getStringFromVector(options, ",");
                /* We could do the following for better round trip support,
@@ -1000,8 +1007,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
           << "\\font_sc " << h_font_sc << "\n"
           << "\\font_osf " << h_font_osf << "\n"
           << "\\font_sf_scale " << h_font_sf_scale << "\n"
-          << "\\font_tt_scale " << h_font_tt_scale << "\n"
-          << "\\graphics " << h_graphics << "\n"
+          << "\\font_tt_scale " << h_font_tt_scale << '\n';
+       if (!h_font_cjk.empty())
+               os << "\\font_cjk " << h_font_cjk << '\n';
+       os << "\\graphics " << h_graphics << '\n'
           << "\\default_output_format " << h_default_output_format << "\n"
           << "\\output_sync " << h_output_sync << "\n";
        if (h_output_sync == "1")
@@ -1212,9 +1221,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
                                if (pos != string::npos) {
                                        string::size_type i = fontopts.find(',', pos);
                                        if (i == string::npos)
-                                               scale = scale_as_percentage(fontopts.substr(pos + 1));
+                                               scale_as_percentage(fontopts.substr(pos + 1), scale);
                                        else
-                                               scale = scale_as_percentage(fontopts.substr(pos, i - pos));
+                                               scale_as_percentage(fontopts.substr(pos, i - pos), scale);
                                }
                        }
                        if (t.cs() == "setsansfont") {
@@ -1666,7 +1675,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
        // the babel options. Instead, we guess which language is used most
        // and set this one.
        default_language = h_language;
-       if (is_full_document && auto_packages.find("CJK") != auto_packages.end()) {
+       if (is_full_document &&
+           (auto_packages.find("CJK") != auto_packages.end() ||
+            auto_packages.find("CJKutf8") != auto_packages.end())) {
                p.pushPosition();
                h_language = guessLanguage(p, default_language);
                p.popPosition();
index d438c95e2f7485fe1d92bcb6dc4bb4e6c8ef4a5c..aef89530f8b6ee39d4b3711a234b6da04f85e8e7 100644 (file)
@@ -38,6 +38,12 @@ public:
        std::string inputencoding() const { return h_inputencoding; }
        ///
        std::string notefontcolor() const { return h_notefontcolor; }
+       ///
+       bool fontCJKSet() const { return h_font_cjk_set; }
+       ///
+       std::string fontCJK() const { return h_font_cjk; }
+       ///
+       void fontCJK(std::string const & f) { h_font_cjk_set = true; h_font_cjk = f; }
        /// The document language
        std::string docLanguage() const { return h_language; }
        /// The language of text which is not explicitly marked
@@ -123,6 +129,8 @@ private:
        std::string h_font_osf;
        std::string h_font_sf_scale;
        std::string h_font_tt_scale;
+       bool h_font_cjk_set;
+       std::string h_font_cjk;
        std::string h_graphics;
        std::string h_default_output_format;
        std::string h_html_be_strict;
index b23aa446da45d18ead3184dc16cf36ea076d2c94..61a7346c06b4dc5768545f3c81548d299509f011 100644 (file)
@@ -31,7 +31,6 @@ Format LaTeX feature                        LyX feature
 326    PDFLaTeX for external insets         InsetExternal
 329    master documents                     \master
 332    ?                                    InsetGraphics groupId
-336    ?                                    \font_cjk
 343    ?                                    \use_default_options
 353    \printsubindex                       InsetIndex
 354    \printindex*, \printsubindex*        InsetIndex
index a6c5cdaaec82d79f76a072bd7f4f996c35e4bb64..c8c1a7e7b609ef8d19525d23d11291145baf8f1f 100644 (file)
@@ -112,7 +112,7 @@ Chinese simplified
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{CJK}{EUC-JP}{hei}
@@ -124,7 +124,7 @@ begin{CJK}{EUC-JP}{hei}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{CJK}
@@ -146,7 +146,7 @@ Chinese simplified
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{CJK}{Bg5}{}
@@ -160,7 +160,7 @@ Big5 文鼎楷書
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{CJK}
@@ -182,7 +182,7 @@ English
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{CJK}{SJIS}{}
@@ -196,7 +196,7 @@ Shift_JIS 日本語の文章
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{CJK}
@@ -216,7 +216,7 @@ hello
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{CJK}{JIS}{}
@@ -229,7 +229,7 @@ JIS-code \e
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 $
 \end_layout
 
@@ -239,7 +239,7 @@ BF|K
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 
@@ -251,7 +251,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 $
 \end_layout
 
@@ -262,7 +262,7 @@ NJ8>O\e(B
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{CJK}
diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx
new file mode 100644 (file)
index 0000000..1472ff2
--- /dev/null
@@ -0,0 +1,173 @@
+#LyX file created by tex2lyx 2.1.0dev
+\lyxformat 457
+\begin_document
+\begin_header
+\textclass article
+\begin_preamble
+
+\usepackage{babel}
+
+
+% It is impossible to get the document language because the document could start with a command,
+% whitespace, and English word or whatever and the rest is in Japanese. Checking for the first CJK
+% environment is no solution because the document could be English and contain only some Japanese.
+
+
+\end_preamble
+\use_default_options false
+\maintain_unincluded_children false
+\language chinese-traditional
+\language_package default
+\inputencoding UTF8
+\fontencoding T1
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_math auto
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 0
+\use_package esint 1
+\use_package mathdots 0
+\use_package mathtools 0
+\use_package mhchem 0
+\use_package stackrel 0
+\use_package stmaryrd 0
+\use_package undertilde 0
+\cite_engine basic
+\cite_engine_type numerical
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Standard
+
+\lang chinese-traditional
+Japanese 
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+Chinese traditional
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+ Japanese 
+\end_layout
+
+\begin_layout Standard
+hello 
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+Chinese simplified 
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+begin{CJK}{UTF8}{hei}
+\end_layout
+
+\end_inset
+
+ Japanese 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+end{CJK}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+Chinese simplified 
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+ Big5 文鼎楷書 
+\end_layout
+
+\begin_layout Standard
+
+\lang english
+English
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+ 日本語の文章 
+\end_layout
+
+\begin_layout Standard
+hello
+\end_layout
+
+\begin_layout Standard
+
+\lang chinese-traditional
+Korean 
+\end_layout
+
+\end_body
+\end_document
diff --git a/src/tex2lyx/test/CJKutf8.tex b/src/tex2lyx/test/CJKutf8.tex
new file mode 100644 (file)
index 0000000..52b68be
--- /dev/null
@@ -0,0 +1,39 @@
+\documentclass[english]{article}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{CJKutf8}
+\usepackage{babel}
+
+% It is impossible to get the document language because the document could start with a command,
+% whitespace, and English word or whatever and the rest is in Japanese. Checking for the first CJK
+% environment is no solution because the document could be English and contain only some Japanese.
+
+\begin{document}
+\begin{CJK}{UTF8}{}%
+Japanese \end{CJK} \begin{CJK}{UTF8}{}Chinese traditional\end{CJK} \begin{CJK}{UTF8}{}
+Japanese \end{CJK}
+hello
+\begin{CJK}{UTF8}{}%
+Chinese simplified \end{CJK}\begin{CJK}{UTF8}{hei} Japanese \end{CJK} \begin{CJK}{UTF8}{}Chinese simplified
+\end{CJK}
+
+\begin{CJK}{UTF8}{}
+Big5 文鼎楷書
+\end{CJK}
+
+\inputencoding{latin9}%
+\selectlanguage{english}%
+English
+
+\begin{CJK}{UTF8}{}
+日本語の文章
+\end{CJK}
+
+hello
+
+\begin{CJK}{UTF8}{}%
+Korean
+\end{CJK}
+
+\end{document}
index 36be3606781dc0fe43a08069a35483781f819bb0..a86e581a65bbb993aa1fd6121cf24f5c6e0d5da9 100644 (file)
@@ -12,7 +12,7 @@ project(test)
 
 set(_tex_tests test.ltx test-structure.tex test-insets.tex
                test-modules.tex box-color-size-space-align.tex
-               CJK.tex XeTeX-polyglossia.tex)
+               CJK.tex CJKutf8.tex XeTeX-polyglossia.tex)
 
 foreach(_fl ${_tex_tests})
   set(fl ${_fl})
index b9079495e5ba7274dd8c7a20319a8d06d02d1a7b..2a41e69065c2db94b5ca9c135fb07436ccec3e88 100644 (file)
@@ -96,7 +96,7 @@ ancient Greek
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 textgreek[numerals=arabic, variant=ancient]
@@ -108,7 +108,7 @@ textgreek[numerals=arabic, variant=ancient]
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -122,7 +122,7 @@ reek
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -170,11 +170,11 @@ df
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %empty language paragraph
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
index 1315f5ef13f938dce26bfe3a528c32ec0bb72f0c..1f63c36355a68cf98b12e49668f60a3530374a12 100644 (file)
@@ -137,7 +137,7 @@ blabla
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 mbox{
@@ -149,7 +149,7 @@ mbox
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -247,7 +247,7 @@ status open
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 centering
@@ -259,7 +259,7 @@ centering
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 setlength{
@@ -277,7 +277,7 @@ unitlength}{.2in}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{picture}
@@ -289,7 +289,7 @@ begin{picture}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 put
@@ -301,7 +301,7 @@ put
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -311,7 +311,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 makebox(0,0)[tr]{
@@ -323,7 +323,7 @@ AAA
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -333,7 +333,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -343,7 +343,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 put
@@ -355,7 +355,7 @@ put
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -365,7 +365,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 makebox(0,0){
@@ -377,7 +377,7 @@ BBB
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -387,7 +387,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -397,7 +397,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 put
@@ -409,7 +409,7 @@ put
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -419,7 +419,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 framebox(0,0){
@@ -431,7 +431,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -441,7 +441,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -451,7 +451,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 put
@@ -463,7 +463,7 @@ put
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -473,7 +473,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 line
@@ -485,7 +485,7 @@ line
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -495,7 +495,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -505,7 +505,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -515,7 +515,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{picture}
@@ -536,7 +536,7 @@ end{picture}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raisebox{8.5mm}{
@@ -548,7 +548,7 @@ test
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -558,7 +558,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raisebox{-6.5mm}{
@@ -570,7 +570,7 @@ tset
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -659,7 +659,7 @@ blabla
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 fbox{
@@ -671,7 +671,7 @@ fbox
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -685,7 +685,7 @@ blabla
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 framebox{
@@ -701,7 +701,7 @@ box 1
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -765,7 +765,7 @@ This is an example text.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 framebox{
@@ -814,7 +814,7 @@ box height.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -936,7 +936,7 @@ doublebox
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -1070,7 +1070,7 @@ test
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 textcolor{darkgreen}
@@ -1082,7 +1082,7 @@ textcolor{darkgreen}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1092,7 +1092,7 @@ dark green
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1106,7 +1106,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 definecolor{violet}{rgb}{0.5, 0, 1}
@@ -1122,7 +1122,7 @@ test
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 textcolor{violet}
@@ -1134,7 +1134,7 @@ textcolor{violet}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1144,7 +1144,7 @@ violet
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1366,7 +1366,7 @@ Crossed out:
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 xout
@@ -1378,7 +1378,7 @@ xout
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1388,7 +1388,7 @@ test
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1565,7 +1565,7 @@ bla
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 centering
@@ -1589,7 +1589,7 @@ blabla
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raggedright
@@ -1613,7 +1613,7 @@ raggedright 2 raggedright 2 raggedright 2 raggedright 2 raggedright 2 raggedrigh
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raggedleft
@@ -1637,11 +1637,11 @@ raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 ra
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %set back to justified
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -1651,7 +1651,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raggedright
@@ -1663,7 +1663,7 @@ raggedright
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
index 9fa28e67e8cd712309462096020f47b626b53efc..1ae90debd27cc2ac9e2e921c91276b06afce4175 100755 (executable)
@@ -56,7 +56,7 @@ def main(argv):
     else:
         files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
              'test-modules.tex', 'box-color-size-space-align.tex', \
-             'CJK.tex', 'XeTeX-polyglossia.tex']
+             'CJK.tex', 'CJKutf8.tex', 'XeTeX-polyglossia.tex']
 
     errors = []
     overwrite = (outputdir == inputdir)
index bb1574ac6d25eea20f19d1f15cbe1366cc60520a..93d652691f5c4317188a1e2853b611ee13bd96c5 100644 (file)
@@ -92,11 +92,11 @@ Title
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %stupid stuff
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -577,13 +577,13 @@ key "article-crossref"
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % Remove duplicate call of 
 \backslash
 bibliography since LaTeX throws an error.
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -593,13 +593,13 @@ bibliography since LaTeX throws an error.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %
 \backslash
 bibliographystyle{unsrt}
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -609,13 +609,13 @@ bibliographystyle{unsrt}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % 
 \backslash
 bibliography{xampl}
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -1248,7 +1248,7 @@ textbackslash etc.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 let
@@ -1264,7 +1264,7 @@ textsf
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 let
@@ -1280,7 +1280,7 @@ textsf
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 let
@@ -1296,7 +1296,7 @@ texttt
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 providecommand{
@@ -1336,7 +1336,7 @@ LINE!!!!
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 kill
@@ -1584,7 +1584,7 @@ of the table
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -1596,7 +1596,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1606,7 +1606,7 @@ longtable
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1636,7 +1636,7 @@ same way as in the
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -1648,7 +1648,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1658,7 +1658,7 @@ tabular
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1688,7 +1688,7 @@ environment.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -1700,7 +1700,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1710,7 +1710,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1749,7 +1749,7 @@ Each row ends with a
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -1761,7 +1761,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1775,7 +1775,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1796,7 +1796,7 @@ The
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -1808,7 +1808,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1822,7 +1822,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1872,7 +1872,7 @@ the
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -1884,7 +1884,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1894,7 +1894,7 @@ tabular
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -1924,7 +1924,7 @@ environment.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -1936,7 +1936,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -1950,7 +1950,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2060,7 +2060,7 @@ Also
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2072,7 +2072,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2084,7 +2084,7 @@ hline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2103,7 +2103,7 @@ as in
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -2115,7 +2115,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2125,7 +2125,7 @@ tabular
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2146,7 +2146,7 @@ That was a
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2158,7 +2158,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2170,7 +2170,7 @@ hline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2200,7 +2200,7 @@ That was
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2212,7 +2212,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2226,7 +2226,7 @@ hline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2256,7 +2256,7 @@ This is a
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2268,7 +2268,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2280,7 +2280,7 @@ multicolumn{2}{||c||}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2306,7 +2306,7 @@ If a page break occurs at a
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2318,7 +2318,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2330,7 +2330,7 @@ hline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2380,7 +2380,7 @@ The
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2392,7 +2392,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2402,7 +2402,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2412,7 +2412,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -2424,7 +2424,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2434,7 +2434,7 @@ tabular
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2473,7 +2473,7 @@ The optional argument may be one of
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -2485,7 +2485,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -2495,7 +2495,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -2965,7 +2965,7 @@ Some lines may take up a lot of space, like this:
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 raggedleft
@@ -2998,7 +2998,7 @@ will never break a page within such a row. Page breaks only occur between rows o
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 code
@@ -3010,7 +3010,7 @@ code
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -3022,7 +3022,7 @@ hline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -3229,7 +3229,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 env
@@ -3241,7 +3241,7 @@ env
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -3251,7 +3251,7 @@ longtable
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -3320,7 +3320,7 @@ From bug 7412 another example with more captions (can currently not produced in
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -3391,7 +3391,7 @@ A long table -- continued
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -3401,7 +3401,7 @@ Continued on next page
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -4274,11 +4274,11 @@ A table*:
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % some comment
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -4371,7 +4371,7 @@ Special booktabs-table
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 centering
@@ -4383,7 +4383,7 @@ centering
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -4450,7 +4450,7 @@ Chip
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 cmidrule
@@ -4462,7 +4462,7 @@ cmidrule
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -4472,7 +4472,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -4482,7 +4482,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 cmidrule
@@ -4494,7 +4494,7 @@ cmidrule
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -4504,7 +4504,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -4514,7 +4514,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 morecmidrules
@@ -4526,7 +4526,7 @@ morecmidrules
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 cmidrule
@@ -4538,7 +4538,7 @@ cmidrule
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -4548,7 +4548,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -4714,7 +4714,7 @@ MTF at
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 morecmidrules
@@ -4726,7 +4726,7 @@ morecmidrules
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 cmidrule
@@ -4738,7 +4738,7 @@ cmidrule
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -4748,7 +4748,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -4872,7 +4872,7 @@ Macros
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -4902,7 +4902,7 @@ LyX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 providecommand{
@@ -4916,7 +4916,7 @@ macroe}[1]{e #1 e}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 providecommand*{
@@ -4940,7 +4940,7 @@ macrof}[1]{f #1 f}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 newcommand*{
@@ -4954,7 +4954,7 @@ macroi}[1]{i #1 i}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 renewcommand*{
@@ -4968,7 +4968,7 @@ macroi}[1]{j #1 j}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 providecommandx{
@@ -4982,7 +4982,7 @@ macrok}[1]{k #1 k}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 providecommandx*{
@@ -5006,7 +5006,7 @@ macrok}[1]{l #1 l}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 newcommandx*{
@@ -5020,7 +5020,7 @@ macroo}[1]{o #1 o}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 renewcommandx*{
@@ -5034,7 +5034,7 @@ macroo}[1]{p #1 p}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 DeclareRobustCommand{
@@ -5048,7 +5048,7 @@ macroq}[1]{q #1 q}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 DeclareRobustCommand*{
@@ -5062,7 +5062,7 @@ macror}[1]{r #1 r}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 DeclareRobustCommandx{
@@ -5076,7 +5076,7 @@ macros}[1]{s #1 s}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 DeclareRobustCommandx*{
@@ -5094,7 +5094,7 @@ Now use them all:
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroa
@@ -5106,7 +5106,7 @@ macroa
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -5116,7 +5116,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5126,7 +5126,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrob
@@ -5138,7 +5138,7 @@ macrob
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -5148,7 +5148,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5158,7 +5158,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroc
@@ -5170,7 +5170,7 @@ macroc
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -5180,7 +5180,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5190,7 +5190,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrod
@@ -5202,7 +5202,7 @@ macrod
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -5212,7 +5212,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5222,7 +5222,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroe{
@@ -5234,7 +5234,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5244,7 +5244,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrof{
@@ -5256,7 +5256,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5266,7 +5266,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrog{
@@ -5278,7 +5278,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5288,7 +5288,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroi{
@@ -5300,7 +5300,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5310,7 +5310,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrok{
@@ -5322,7 +5322,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5332,7 +5332,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macrom{
@@ -5344,7 +5344,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5354,7 +5354,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroo{
@@ -5366,7 +5366,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5376,7 +5376,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macroq{
@@ -5388,7 +5388,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5398,7 +5398,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 macror{
@@ -5410,7 +5410,7 @@ x
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -5420,7 +5420,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %
 \backslash
 macros{x} 
@@ -5428,7 +5428,7 @@ macros{x}
 macrot{x}
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -5456,7 +5456,7 @@ Special formattings
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5729,7 +5729,7 @@ They can also or be broken by a newline
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 
@@ -5743,7 +5743,7 @@ or by a newline with space, comment and argument
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 
@@ -5765,7 +5765,7 @@ or by a defined line break
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 linebreak[4]
@@ -5781,7 +5781,7 @@ There are even newlines with weird arguments, but these are not handled by
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5791,7 +5791,7 @@ LyX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 
@@ -5831,7 +5831,7 @@ or by a defined page break
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 pagebreak[4]
@@ -5865,7 +5865,7 @@ Then one has those macros with a long name for a short meaning, like ~, ^ or
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LaTeX
 \end_layout
 
@@ -5882,7 +5882,7 @@ nation mark, ellipsis\SpecialChar \ldots{}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5898,7 +5898,7 @@ fy ligature break.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5908,7 +5908,7 @@ LyX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5918,7 +5918,7 @@ LyX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 TeX
 \end_layout
 
@@ -5928,7 +5928,7 @@ TeX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LaTeX
 \end_layout
 
@@ -5938,7 +5938,7 @@ LaTeX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LaTeX
 \end_layout
 
@@ -5948,7 +5948,7 @@ LaTeX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -5958,7 +5958,7 @@ LyX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 TeX
 \end_layout
 
@@ -5968,7 +5968,7 @@ TeX
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LaTeX
 \end_layout
 
@@ -5986,7 +5986,7 @@ builtin ^ unicodesymbols ȷ user
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 mycommand
@@ -5998,7 +5998,7 @@ mycommand
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -6012,7 +6012,7 @@ builtin ^ unicodesymbols ȷ user
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 mycommand
@@ -6024,7 +6024,7 @@ mycommand
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -6038,7 +6038,7 @@ builtin ^ unicodesymbols ȷ user
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 mycommand
@@ -6050,11 +6050,11 @@ mycommand
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % and another
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -6064,7 +6064,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -6156,7 +6156,7 @@ hello
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 settowidth{
index f1bc38583694e8f2019539f8b289e5c649bf9860..8f3300221cfc2bb236c91cc834c8526a390b075b 100644 (file)
@@ -92,7 +92,7 @@ The lemma is not recognized as a command provided by a module, since the preambl
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 LyX
 \end_layout
 
@@ -112,7 +112,7 @@ The proof is recognized as a builtin style provided by the text class.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{lem}
@@ -124,7 +124,7 @@ begin{lem}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{lem}
index 65ee7a35bfb6acbb4fbc42610a063e7bff35db18..a7b04b3783675fd6a0bcb292d0cde1e54085dffb 100644 (file)
@@ -118,11 +118,11 @@ Title
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % this should be recognized as empty date:
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -162,7 +162,7 @@ An environment...
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 begin{foo}
@@ -174,7 +174,7 @@ begin{foo}
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 end{foo}
@@ -338,7 +338,7 @@ rotated table, spanning all columns
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 centering
@@ -350,7 +350,7 @@ centering
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -516,7 +516,7 @@ fdg
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 centering
@@ -528,7 +528,7 @@ centering
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {}
 \end_layout
 
@@ -896,7 +896,7 @@ BCD second one
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 x y z
 \end_layout
 
@@ -910,11 +910,11 @@ x y z
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 x y % bla
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 z
 \end_layout
 
@@ -951,7 +951,7 @@ label
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 $
 \backslash
 left[
@@ -1004,7 +1004,7 @@ zzz \backslash section{
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 verb~
@@ -1018,7 +1018,7 @@ verb~
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 verb+
@@ -1032,7 +1032,7 @@ item[ABC] first item+
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 verb+something
@@ -1087,11 +1087,11 @@ The Müller Book
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %dummy comment inserted by tex2lyx to ensure that this paragraph is not empty
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
index 4eaaba78930fdb57acd4f72c507c7f6b9cd10567..a9bb1ec1317dc05cecb5af9f13ba73ccc8b9ab67 100644 (file)
@@ -114,11 +114,11 @@ d
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 %Midline comment
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -173,7 +173,7 @@ quoted
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -183,7 +183,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 em
@@ -234,7 +234,7 @@ I keep
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
@@ -275,11 +275,11 @@ _ is a neat token.
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 % This line won't print!
 \end_layout
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \end_layout
 
@@ -374,7 +374,7 @@ Here's a
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 {
 \end_layout
 
@@ -384,7 +384,7 @@ status collapsed
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 
 \backslash
 em
@@ -408,7 +408,7 @@ This
 \begin_inset ERT
 status collapsed
 
-\begin_layout Standard
+\begin_layout Plain Layout
 }
 \end_layout
 
index 6f15a7ce45bb8dc20a27f0dbcd11aa0b699ef190..90728a960e242ce2e660f2053928845f85dcb35c 100644 (file)
@@ -519,6 +519,9 @@ void handle_ert(ostream & os, string const & s, Context & context)
        // We must have a valid layout before outputting the ERT inset.
        context.check_layout(os);
        Context newcontext(true, context.textclass);
+       InsetLayout const & layout = context.textclass.insetLayout(from_ascii("ERT"));
+       if (layout.forcePlainLayout())
+               newcontext.layout = &context.textclass.plainLayout();
        begin_inset(os, "ERT");
        os << "\nstatus collapsed\n";
        newcontext.check_layout(os);
@@ -540,6 +543,9 @@ void handle_comment(ostream & os, string const & s, Context & context)
 {
        // TODO: Handle this better
        Context newcontext(true, context.textclass);
+       InsetLayout const & layout = context.textclass.insetLayout(from_ascii("ERT"));
+       if (layout.forcePlainLayout())
+               newcontext.layout = &context.textclass.plainLayout();
        begin_inset(os, "ERT");
        os << "\nstatus collapsed\n";
        newcontext.check_layout(os);
@@ -1440,7 +1446,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
        }
 
        else if (name == "CJK") {
-               // the scheme is \begin{CJK}{encoding}{mapping}{text}
+               // the scheme is \begin{CJK}{encoding}{mapping}text\end{CJK}
                // It is impossible to decide if a CJK environment was in its own paragraph or within
                // a line. We therefore always assume a paragraph since the latter is a rare case.
                eat_whitespace(p, os, parent_context, false);
@@ -1452,19 +1458,27 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                // JIS does not work with LyX's encoding conversion
                if (encoding != "Bg5" && encoding != "JIS" && encoding != "SJIS")
                        p.setEncoding(encoding);
-               else
+               else {
+                       // FIXME: This will read garbage, since the data is not encoded in utf8.
                        p.setEncoding("utf8");
-               // LyX doesn't support the second argument so if
-               // this is used we need to output everything as ERT
-               string const mapping = p.getArg('{', '}');
+               }
+               // LyX only supports the same mapping for all CJK
+               // environments, so we might need to output everything as ERT
+               string const mapping = trim(p.getArg('{', '}'));
                char const * const * const where =
                        is_known(encoding, supported_CJK_encodings);
-               if ((!mapping.empty() && mapping != " ") || !where) {
+               if (!preamble.fontCJKSet())
+                       preamble.fontCJK(mapping);
+               bool knownMapping = mapping == preamble.fontCJK();
+               if (!knownMapping || !where) {
                        parent_context.check_layout(os);
                        handle_ert(os, "\\begin{" + name + "}{" + encoding + "}{" + mapping + "}",
                                       parent_context);
                        // we must parse the content as verbatim because e.g. JIS can contain
                        // normally invalid characters
+                       // FIXME: This works only for the most simple cases.
+                       //        Since TeX control characters are not parsed,
+                       //        things like comments are completely wrong.
                        string const s = p.plainEnvironment("CJK");
                        for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
                                if (*it == '\\')