void Paragraph::Private::validate(LaTeXFeatures & features) const
{
if (layout_->inpreamble && inset_owner_) {
- bool const is_command = layout_->latextype == LATEX_COMMAND;
- Font f;
- // Using a string stream here circumvents the encoding
+ // FIXME: Using a string stream here circumvents the encoding
// switching machinery of odocstream. Therefore the
// output is wrong if this paragraph contains content
// that needs to switch encoding.
? buf.masterParams() : buf.params();
otexstringstream os;
os << layout_->preamble();
- if (is_command) {
- os << '\\' << from_ascii(layout_->latexname());
- // we have to provide all the optional arguments here, even though
- // the last one is the only one we care about.
- // Separate handling of optional argument inset.
- if (!layout_->latexargs().empty()) {
- OutputParams rp = features.runparams();
- rp.local_font = &owner_->getFirstFontSettings(bp);
- latexArgInsets(*owner_, os, rp, layout_->latexargs());
- }
- os << from_ascii(layout_->latexparam());
- }
size_t const length = os.length();
- // this will output "{" at the beginning, but not at the end
- owner_->latex(bp, f, os, features.runparams(), 0, -1, true);
- if (os.length() > length) {
- if (is_command) {
- os << '}';
- if (!layout_->postcommandargs().empty()) {
- OutputParams rp = features.runparams();
- rp.local_font = &owner_->getFirstFontSettings(bp);
- latexArgInsets(*owner_, os, rp, layout_->postcommandargs(), "post:");
- }
- }
+ TeXOnePar(buf, buf.text(), buf.getParFromID(owner_->id()).pit(), os,
+ features.runparams(), string(), 0, -1, true);
+ if (os.length() > length)
features.addPreambleSnippet(os.release(), true);
- }
}
if (features.runparams().flavor == OutputParams::HTML
if (empty()) {
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
- if (style.isCommand() && (!style.intitle || style.inpreamble)) {
+ if (style.isCommand() && !style.intitle) {
os << '{';
++column;
}
}
// For InTitle commands, we have already opened a group
// in output_latex::TeXOnePar.
- if (style.isCommand() && (!style.intitle || style.inpreamble)) {
+ if (style.isCommand() && !style.intitle) {
os << '{';
++column;
}
otexstream & os,
OutputParams const & runparams_in,
string const & everypar,
- int start_pos, int end_pos)
+ int start_pos, int end_pos,
+ bool const force)
{
BufferParams const & bparams = runparams_in.is_child
? buf.masterParams() : buf.params();
Layout const & style = text.inset().forcePlainLayout() ?
bparams.documentClass().plainLayout() : par.layout();
- if (style.inpreamble)
+ if (style.inpreamble && !force)
return;
LYXERR(Debug::LATEX, "TeXOnePar for paragraph " << pit << " ptr " << &par << " '"
os << '\n';
}
- par.latex(bparams, outerfont, os, runparams, start_pos, end_pos);
+ par.latex(bparams, outerfont, os, runparams, start_pos, end_pos, force);
return;
}
Font const outerfont = text.outerFont(pit);
parStartCommand(par, os, runparams, style);
- par.latex(bparams, outerfont, os, runparams, start_pos, end_pos);
+ par.latex(bparams, outerfont, os, runparams, start_pos, end_pos, force);
// I did not create a parEndCommand for this minuscule
// task because in the other user of parStartCommand
// FIXME UNICODE
os << from_utf8(everypar);
- par.latex(bparams, outerfont, os, runparams, start_pos, end_pos);
+ par.latex(bparams, outerfont, os, runparams, start_pos, end_pos, force);
Font const font = par.empty()
? par.getLayoutFont(bparams, outerfont)