* the GNU General Public Licence version 2 or later.
*/
-#ifdef __GNUG__
-#pragma implementation
-#endif
#include <config.h>
void InsetFormula::write(Buffer const *, ostream & os) const
{
WriteStream wi(os, false, false);
- os << par_->fileInsetLabel() << " ";
+ os << par_->fileInsetLabel() << ' ';
par_->write(wi);
}
int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
- if (display()) {
+ if (0 && display()) {
TextMetricsInfo mi;
par()->metricsT(mi);
TextPainter tpain(par()->width(), par()->height());
MathPainterInfo pi(bv->painter());
if (use_preview) {
- pi.pain.image(x, y - a, w, h,
+ pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front
*(preview_->pimage()->image(*this, *bv)));
} else {
pi.base.style = LM_ST_TEXT;
{
metrics(bv, font);
return preview_->previewReady() ?
- preview_->pimage()->width() : par_->width();
+ 1 + preview_->pimage()->width() : par_->width();
+ // insert a one pixel gap in front of the formula
}
ostringstream ls;
WriteStream wi(ls, false, false);
parent().par_->write(wi);
- string str = ls.str().c_str();
-
- // If we are in displaymode, the preview will include the margins
- // on either side of the previewed equation.
- // We can create an image with a tight bounding box by replacing the
- // "\[ ... \]" delimiters with "$ \displaystyle ... $".
- // Note that we have to get rid of any trailing '\n's for the fix
- // to work.
- if (prefixIs(str, "\\[")) {
- std::cerr << "before\n" << str << std::endl;
- str = rtrim(rtrim(ltrim(str, "\\["), "\n"), "\\]");
- str = "$ \\displaystyle " + str + " $";
- std::cerr << "after\n" << str << std::endl;
- }
-
- return str;
+ return STRCONV(ls.str());
}