void InsetMathChar::validate(LaTeXFeatures & features) const
{
- if (char_ >= 0x80)
+ if (!isASCII(char_))
encodings.validate(char_, features, true);
}
}
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);
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) {
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);
#include "support/FileName.h"
#include "support/filetools.h" // LibFileSearch
#include "support/lstrings.h"
+#include "support/textutils.h"
#include "frontends/FontLoader.h"
bool isAsciiOrMathAlpha(char_type c)
{
- return c < 0x80 || Encodings::isMathAlpha(c);
+ return isASCII(c) || Encodings::isMathAlpha(c);
}
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);
#include "support/convert.h"
#include "support/debug.h"
#include "support/lstrings.h"
+#include "support/textutils.h"
#include <algorithm>
#include <boost/next_prior.hpp>
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;
// \\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);
}
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 \
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;
}
} // 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;
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";
{
vector<string> options = split_options(opts);
add_package(name, options);
- string scale;
char const * const * where = 0;
if (is_known(name, known_xetex_packages)) {
// 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();
}
}
// 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();
}
}
}
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,
<< "\\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")
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") {
// 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();
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
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;
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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{CJK}{EUC-JP}{hei}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{CJK}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{CJK}{Bg5}{}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{CJK}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{CJK}{SJIS}{}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{CJK}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{CJK}{JIS}{}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
$
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
$
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{CJK}
--- /dev/null
+#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
--- /dev/null
+\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}
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})
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
textgreek[numerals=arabic, variant=ancient]
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
mbox{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
centering
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
setlength{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{picture}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
put
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
makebox(0,0)[tr]{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
put
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
makebox(0,0){
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
put
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
framebox(0,0){
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
put
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
line
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{picture}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raisebox{8.5mm}{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raisebox{-6.5mm}{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
fbox{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
framebox{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
framebox{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
textcolor{darkgreen}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
definecolor{violet}{rgb}{0.5, 0, 1}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
textcolor{violet}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
xout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
centering
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raggedright
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raggedleft
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raggedright
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
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)
\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
\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
\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
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
let
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
let
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
let
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
providecommand{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
kill
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
raggedleft
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
code
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
env
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
centering
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
cmidrule
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
cmidrule
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
morecmidrules
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
cmidrule
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
morecmidrules
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
cmidrule
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
providecommand{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
providecommand*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
newcommand*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
renewcommand*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
providecommandx{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
providecommandx*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
newcommandx*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
renewcommandx*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
DeclareRobustCommand{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
DeclareRobustCommand*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
DeclareRobustCommandx{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
DeclareRobustCommandx*{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroa
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrob
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroc
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrod
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroe{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrof{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrog{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroi{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrok{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macrom{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroo{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macroq{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
macror{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
%
\backslash
macros{x}
macrot{x}
\end_layout
-\begin_layout Standard
+\begin_layout Plain Layout
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
linebreak[4]
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
pagebreak[4]
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LaTeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
TeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LaTeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LaTeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
TeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LaTeX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
mycommand
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
mycommand
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
settowidth{
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
LyX
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{lem}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{lem}
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
begin{foo}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
end{foo}
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
centering
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
centering
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{}
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
x y z
\end_layout
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
$
\backslash
left[
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
verb~
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
verb+
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
verb+something
\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
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
em
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
\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
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
{
\end_layout
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
\backslash
em
\begin_inset ERT
status collapsed
-\begin_layout Standard
+\begin_layout Plain Layout
}
\end_layout
// 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);
{
// 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);
}
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);
// 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 == '\\')