#include "LColor.h"
#include "paragraph.h"
+#include <sstream>
using std::string;
using std::auto_ptr;
using std::ostream;
+using std::ostringstream;
InsetOptArg::InsetOptArg(BufferParams const & ins)
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- os << '[';
- int const i = InsetText::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;
}