void TeXEnvironment(Buffer const & buf, Text const & text,
- OutputParams const & runparams,
+ OutputParams const & runparams_in,
pit_type & pit, otexstream & os)
{
ParagraphList const & paragraphs = text.paragraphs();
depth_type const current_depth = ipar->params().depth();
Length const & current_left_indent = ipar->params().leftIndent();
+ OutputParams runparams = runparams_in;
+ runparams.no_cprotect = current_layout.nocprotect;
+ runparams.no_pass_thru_chars = current_layout.no_pass_thru_chars;
+
// This is for debugging purpose at the end.
pit_type const par_begin = pit;
for (; pit < runparams.par_end; ++pit) {
if (pit != runparams.par_end)
LYXERR(Debug::OUTFILE, "TeXEnvironment for paragraph " << par_begin << " done.");
+
+ // set upstream encoding
+ runparams_in.encoding = runparams.encoding;
}
-void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs,
- map<size_t, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix)
+// FIXME: pass the \c required vector by reference and add the stuff
+// from \c latexargs to a different vector. This avoids a copy and
+// (more importantly?) a coverity defect.
+void getArgInsets(otexstream & os, OutputParams const & runparams,
+ Layout::LaTeXArgMap const & latexargs,
+ map<size_t, lyx::InsetArgument const *> const & ilist,
+ vector<string> required, string const & prefix)
{
size_t const argnr = latexargs.size();
if (argnr == 0)
{
switch (style.latextype) {
case LATEX_COMMAND:
- if (par.needsCProtection(runparams.moving_arg)) {
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)) {
if (contains(runparams.active_chars, '^'))
// cprotect relies on ^ being on catcode 7
os << "\\begingroup\\catcode`\\^=7";
// the code is different (JMarc)
if (style.isCommand()) {
os << "}";
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (merged_par)
bool const is_command = style.isCommand();
+ bool const last_was_separator =
+ !par.empty() && par.isEnvSeparator(par.size() - 1);
+
// InTitle commands need to be closed after the language has been closed.
if (!intitle_command) {
if (is_command) {
+ // Signify added/deleted par break in output if show changes in output
+ if (nextpar && !os.afterParbreak() && !last_was_separator
+ && bparams.output_changes && par.parEndChange().changed()) {
+ Changes::latexMarkChange(os, bparams, Change(Change::UNCHANGED),
+ par.parEndChange(), runparams);
+ os << bparams.encoding().latexString(docstring(1, 0x00b6)).first << "}";
+ }
os << '}';
if (!style.postcommandargs().empty())
latexArgInsets(par, os, runparams, style.postcommandargs(), "post:");
os << runparams.post_macro;
runparams.post_macro.clear();
}
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (runparams.encoding != prev_encoding) {
if (localswitch_needed
|| (intitle_command && using_begin_end)
|| closing_rtl_ltr_environment
- || (((runparams.isLastPar && !runparams.inbranch) || close_lang_switch)
+ || (((runparams.isLastPar
+ && (using_begin_end
+ // Since \selectlanguage write the language to the aux file,
+ // we need to reset the language at the end of footnote or
+ // float.
+ || runparams.inFloat != OutputParams::NONFLOAT || runparams.inFootnote
+ // Same for maintext in children (see below)
+ || maintext))
+ || close_lang_switch)
&& (par_lang != outer_lang || (using_begin_end
&& style.isEnvironment()
&& par_lang != nextpar_lang)))) {
- // Since \selectlanguage write the language to the aux file,
- // we need to reset the language at the end of footnote or
- // float.
if (!localswitch && (pending_newline || close_lang_switch))
os << '\n';
os << runparams.post_macro;
runparams.post_macro.clear();
}
- if (par.needsCProtection(runparams.moving_arg)
+ if (!runparams.no_cprotect && par.needsCProtection(runparams.moving_arg)
&& contains(runparams.active_chars, '^'))
os << "\\endgroup";
if (runparams.encoding != prev_encoding) {
}
}
- bool const last_was_separator =
- !par.empty() && par.isEnvSeparator(par.size() - 1);
-
// Signify added/deleted par break in output if show changes in output
- if (nextpar && !os.afterParbreak() && !last_was_separator
+ if ((intitle_command || !is_command) && nextpar && !os.afterParbreak() && !last_was_separator
&& bparams.output_changes && par.parEndChange().changed()) {
Changes::latexMarkChange(os, bparams, Change(Change::UNCHANGED),
par.parEndChange(), runparams);