diff --git a/src/output_latex.cpp b/src/output_latex.cpp index f5d6af679f..a7af2199d6 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -319,6 +319,15 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, OutputParams runparams = runparams_in; runparams.isLastPar = nextpit == paragraphs.end(); + bool const maintext = text.isMainText(); + // we are at the beginning of an inset and CJK is already open; + // we count inheritation levels to get the inset nesting right. + if (pit == paragraphs.begin() && !maintext + && (cjk_inherited_ > 0 || open_encoding_ == CJK)) { + cjk_inherited_ += 1; + open_encoding_ = none; + } + if (runparams.verbatim) { int const dist = distance(paragraphs.begin(), pit); Font const outerfont = text.outerFont(dist); @@ -341,15 +350,6 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, runparams.moving_arg |= style.needprotect; - bool const maintext = text.isMainText(); - // we are at the beginning of an inset and CJK is already open; - // we count inheritation levels to get the inset nesting right. - if (pit == paragraphs.begin() && !maintext - && (cjk_inherited_ > 0 || open_encoding_ == CJK)) { - cjk_inherited_ += 1; - open_encoding_ = none; - } - // This paragraph's language Language const * const par_language = pit->getParLanguage(bparams); // The document's language