Fix CJK environment nesting issue.

If the last paragraph is nested in an environment,
we'll have to \end that first.
This commit is contained in:
Günter Milde 2019-01-28 23:02:33 +01:00
parent d6aec0dd33
commit 62865d190d
2 changed files with 5 additions and 7 deletions

View File

@ -91,9 +91,6 @@ export/examples/ja/multilingual_.*_systemF
# but that is not so easy if the main language does not require CJK:
export/export/latex/CJK/en-de-el-ru-.*_utf8_pdf2
#
# CJK environment closes too early when the final paragraph is nested:
export/export/latex/CJK/final-paragraph-nested_utf8-cjk_pdf2
#
# "language default" legacy encodings fail (missing fonts)
export/export/latex/CJK/ko_default_pdf2
export/export/latex/CJK/zh_CN_default_pdf2

View File

@ -1272,9 +1272,10 @@ void TeXOnePar(Buffer const & buf,
}
// If this is the last paragraph, close the CJK environment
// if necessary. If it's an environment, we'll have to \end that first.
// FIXME: don't close if the paragraph is nested in an environment
if (runparams.isLastPar && !style.isEnvironment()) {
// if necessary. If it's an environment or nested in an environment,
// we'll have to \end that first.
if (runparams.isLastPar && !style.isEnvironment()
&& par.params().depth() < 1) {
switch (state->open_encoding_) {
case CJK: {
// do nothing at the end of child documents
@ -1631,7 +1632,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
if (oldEnc.package() == Encoding::none || newEnc.package() == Encoding::none)
return make_pair(false, 0);
// change encoding (not required for CJK with UTF8)
// change encoding (not required with UTF8)
if (bparams.encoding().iconvName() != "UTF-8") {
LYXERR(Debug::LATEX, "Changing LaTeX encoding from "
<< oldEnc.name() << " to " << newEnc.name());