mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix bug #6853 (Short titles ignored when InPreamble is set to 1 in layout file)
The fix includes required arguments and LaTeXParam, too. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36552 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b5097b13cf
commit
e2309ca098
@ -1332,16 +1332,27 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
|
|||||||
BufferParams const & bp = buf.params();
|
BufferParams const & bp = buf.params();
|
||||||
Font f;
|
Font f;
|
||||||
TexRow tr;
|
TexRow tr;
|
||||||
|
// 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.
|
||||||
odocstringstream ods;
|
odocstringstream ods;
|
||||||
|
ods << '\\' << from_ascii(layout_->latexname());
|
||||||
// we have to provide all the optional arguments here, even though
|
// we have to provide all the optional arguments here, even though
|
||||||
// the last one is the only one we care about.
|
// the last one is the only one we care about.
|
||||||
|
// Separate handling of optional argument inset.
|
||||||
|
if (layout_->optargs != 0 || layout_->reqargs != 0)
|
||||||
|
latexArgInsets(*owner_, ods, features.runparams(),
|
||||||
|
layout_->reqargs, layout_->optargs);
|
||||||
|
else
|
||||||
|
ods << from_ascii(layout_->latexparam());
|
||||||
|
docstring::size_type const length = ods.str().length();
|
||||||
|
// this will output "{" at the beginning, but not at the end
|
||||||
owner_->latex(bp, f, ods, tr, features.runparams(), 0, -1, true);
|
owner_->latex(bp, f, ods, tr, features.runparams(), 0, -1, true);
|
||||||
docstring const d = ods.str();
|
if (ods.str().length() > length) {
|
||||||
if (!d.empty()) {
|
ods << '}';
|
||||||
// this will have "{" at the beginning, but not at the end
|
string const snippet = to_utf8(ods.str());
|
||||||
string const content = to_utf8(d);
|
features.addPreambleSnippet(snippet);
|
||||||
string const cmd = layout_->latexname();
|
|
||||||
features.addPreambleSnippet("\\" + cmd + content + "}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user