* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
odocstream & os, TexRow & texrow,
OutputParams const & runparams);
-ParagraphList::const_iterator
-TeXOnePar(Buffer const & buf,
- Text const & text,
- ParagraphList::const_iterator pit,
- odocstream & os, TexRow & texrow,
- OutputParams const & runparams,
- string const & everypar = string());
-
ParagraphList::const_iterator
TeXDeeper(Buffer const & buf,
bool cjk_nested = false;
if (par_language->encoding()->package() == Encoding::CJK &&
open_encoding_ != CJK && pit->isMultiLingual(bparams)) {
- os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName())
- << "}{" << from_ascii(bparams.fontsCJK) << "}%\n";
+ if (prev_par_language->encoding()->package() == Encoding::CJK)
+ os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName())
+ << "}{" << from_ascii(bparams.fontsCJK) << "}%\n";
open_encoding_ = CJK;
cjk_nested = true;
texrow.newline();
return lines;
}
-
-namespace {
-
-ParagraphList::const_iterator
-TeXOnePar(Buffer const & buf,
+// FIXME: this should be anonymous
+ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
Text const & text,
ParagraphList::const_iterator const pit,
odocstream & os, TexRow & texrow,
OutputParams const & runparams_in,
- string const & everypar)
+ string const & everypar,
+ int start_pos, int end_pos)
{
LYXERR(Debug::LATEX, "TeXOnePar... " << &*pit << " '"
<< everypar << "'");
}
/*bool need_par = */ pit->latex(bparams, outerfont,
- os, texrow, runparams);
+ os, texrow, runparams, start_pos, end_pos);
return nextpit;
}
// With CJK, only add switch if we have CJK content at the beginning
// of the paragraph
if (encoding->package() != Encoding::CJK || i == 0) {
- OutputParams tmp_rp = runparams;
- runparams.moving_arg = false;
pair<bool, int> enc_switch = switchEncoding(os, bparams, runparams,
*encoding);
- runparams = tmp_rp;
// the following is necessary after a CJK environment in a multilingual
// context (nesting issue).
if (par_language->encoding()->package() == Encoding::CJK &&
// FIXME UNICODE
os << from_utf8(everypar);
bool need_par = pit->latex(bparams, outerfont,
- os, texrow, runparams);
+ os, texrow, runparams, start_pos, end_pos);
// Make sure that \\par is done with the font of the last
// character if this has another size as the default.
break;
}
- // fall through possible
+ // fall through possible
default:
// we don't need it for the last paragraph!!!
if (nextpit != paragraphs.end())
// also if the next paragraph is a multilingual environment (because of nesting)
if (nextpit != paragraphs.end() && open_encoding_ == CJK &&
(nextpit->getParLanguage(bparams)->encoding()->package() != Encoding::CJK ||
- nextpit->layout().isEnvironment() && nextpit->isMultiLingual(bparams))
- // in environments, CJK has to be closed later (nesting!)
- && !style.isEnvironment()) {
+ (nextpit->layout().isEnvironment() && nextpit->isMultiLingual(bparams)))
+ // inbetween environments, CJK has to be closed later (nesting!)
+ && (!style.isEnvironment() || !nextpit->layout().isEnvironment())) {
os << "\\end{CJK}\n";
open_encoding_ = none;
}
// If this is the last paragraph, and a local_font was set upon entering
// the inset, and we're using "auto" or "default" encoding, the encoding
// should be set back to that local_font's encoding.
+ // However, do not change the encoding when XeTeX is used.
if (nextpit == paragraphs.end() && runparams_in.local_font != 0
&& runparams_in.encoding != runparams_in.local_font->language()->encoding()
- && (bparams.inputenc == "auto" || bparams.inputenc == "default")) {
+ && (bparams.inputenc == "auto" || bparams.inputenc == "default")
+ && (!bparams.useXetex)) {
runparams_in.encoding = runparams_in.local_font->language()->encoding();
os << setEncoding(runparams_in.encoding->iconvName());
}
return nextpit;
}
-} // anon namespace
-
// LaTeX all paragraphs
void latexParagraphs(Buffer const & buf,
// FIXME This check should not be needed. We should
// perhaps issue an error if it is.
Layout const & layout = par->forcePlainLayout() ?
- tclass.plainLayout() :
- par->layout();
+ tclass.plainLayout() : par->layout();
if (layout.intitle) {
if (already_title) {
count += 7;
}
if (runparams.local_font != 0
- && oldEnc.package() == Encoding::CJK) {
+ && oldEnc.package() == Encoding::CJK) {
// within insets, \inputenc switches need
// to be embraced within \bgroup...\egroup;
// else CJK fails.