X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Finsets%2Finsetoptarg.C;h=9c2d88c75a1761655d53a814adcbbf6753dfd78a;hb=6ae4dc23f47b751abcb418094b1bdf31331d239c;hp=94da626e58d9e55a3f50c3b5ee8d930d38e69255;hpb=44cd0fc9a1687cc63911c7f98d978594458e7813;p=lyx.git diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index 94da626e58..9c2d88c75a 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -17,14 +17,16 @@ #include "LColor.h" #include "paragraph.h" +#include using std::string; using std::auto_ptr; using std::ostream; +using std::ostringstream; InsetOptArg::InsetOptArg(BufferParams const & ins) - : InsetCollapsable(ins, true) + : InsetCollapsable(ins, Collapsed) { LyXFont font(LyXFont::ALL_SANE); font.setColor(LColor::collapsable); @@ -63,17 +65,20 @@ void InsetOptArg::write(Buffer const & buf, ostream & os) const int InsetOptArg::latex(Buffer const &, ostream &, - LatexRunParams const &) const + OutputParams const &) const { return 0; } int InsetOptArg::latexOptional(Buffer const & buf, ostream & os, - LatexRunParams const & runparams) const + OutputParams const & runparams) const { - os << '['; - int const i = inset.latex(buf, os, runparams); - os << ']'; - return i + 2; + ostringstream ss; + int ret = InsetText::latex(buf, ss, runparams); + string str = ss.str(); + if (str.find(']') != string::npos) + str = '{' + str + '}'; + os << '[' << str << ']'; + return ret; }