mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 12:25:11 +00:00
Fix bug #3325: Labels with special characters in equations do not work
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33325 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
63cb2b52aa
commit
271d53fdd0
@ -491,6 +491,8 @@ public:
|
||||
virtual mode_type currentMode() const { return UNDECIDED_MODE; }
|
||||
/// returns whether changing mode during latex export is forbidden
|
||||
virtual bool lockedMode() const { return false; }
|
||||
/// returns whether only ascii chars are allowed during latex export
|
||||
virtual bool asciiOnly() const { return false; }
|
||||
/// returns whether this inset is allowed in other insets of given mode
|
||||
virtual bool allowedIn(mode_type) const { return true; }
|
||||
/**
|
||||
|
@ -65,11 +65,15 @@ void CommandInset::draw(PainterInfo & pi, int x, int y) const
|
||||
|
||||
void CommandInset::write(WriteStream & os) const
|
||||
{
|
||||
ModeSpecifier specifier(os, currentMode(), lockedMode());
|
||||
MathEnsurer ensurer(os, needs_math_mode_);
|
||||
os << '\\' << name_.c_str();
|
||||
bool const ascii = os.asciiOnly();
|
||||
os.asciiOnly(asciiOnly());
|
||||
os << '\\' << name_;
|
||||
if (cell(1).size())
|
||||
os << '[' << cell(1) << ']';
|
||||
os << '{' << cell(0) << '}';
|
||||
os.asciiOnly(ascii);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1069,7 +1069,8 @@ docstring InsetMathHull::eolString(row_type row, bool fragile) const
|
||||
docstring res;
|
||||
if (numberedType()) {
|
||||
if (label_[row] && !nonum_[row])
|
||||
res += "\\label{" + label_[row]->getParam("name") + '}';
|
||||
res += "\\label{" +
|
||||
escape(label_[row]->getParam("name")) + '}';
|
||||
if (nonum_[row] && (type_ != hullMultline))
|
||||
res += "\\nonumber ";
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ public:
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
bool lockedMode() const { return true; }
|
||||
///
|
||||
bool asciiOnly() const { return true; }
|
||||
///
|
||||
docstring const screenLabel() const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
|
||||
using lyx::support::escape;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -99,7 +101,7 @@ void InsetMathString::mathmlize(MathStream & /*os*/) const
|
||||
void InsetMathString::write(WriteStream & os) const
|
||||
{
|
||||
if (!os.latex() || os.lockedMode()) {
|
||||
os << str_;
|
||||
os << (os.asciiOnly() ? escape(str_) : str_);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -113,14 +113,14 @@ WriteStream::WriteStream(odocstream & os, bool fragile, bool latex, OutputType o
|
||||
Encoding const * encoding)
|
||||
: os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
|
||||
output_(output), pendingspace_(false), pendingbrace_(false),
|
||||
textmode_(false), locked_(0), line_(0), encoding_(encoding)
|
||||
textmode_(false), locked_(0), ascii_(0), line_(0), encoding_(encoding)
|
||||
{}
|
||||
|
||||
|
||||
WriteStream::WriteStream(odocstream & os)
|
||||
: os_(os), fragile_(false), firstitem_(false), latex_(false),
|
||||
output_(wsDefault), pendingspace_(false), pendingbrace_(false),
|
||||
textmode_(false), locked_(0), line_(0), encoding_(0)
|
||||
textmode_(false), locked_(0), ascii_(0), line_(0), encoding_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -163,6 +163,12 @@ void WriteStream::lockedMode(bool locked)
|
||||
}
|
||||
|
||||
|
||||
void WriteStream::asciiOnly(bool ascii)
|
||||
{
|
||||
ascii_ = ascii;
|
||||
}
|
||||
|
||||
|
||||
WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
|
||||
{
|
||||
at->write(ws);
|
||||
|
@ -75,6 +75,10 @@ public:
|
||||
void lockedMode(bool locked);
|
||||
/// tell whether we are allowed to switch mode when producing latex code
|
||||
bool lockedMode() const { return locked_; }
|
||||
/// tell whether to use only ascii chars when producing latex code
|
||||
void asciiOnly(bool ascii);
|
||||
/// tell whether to use only ascii chars when producing latex code
|
||||
bool asciiOnly() const { return ascii_; }
|
||||
/// LaTeX encoding
|
||||
Encoding const * encoding() const { return encoding_; }
|
||||
private:
|
||||
@ -96,6 +100,8 @@ private:
|
||||
bool textmode_;
|
||||
/// are we allowed to switch mode when producing latex code?
|
||||
bool locked_;
|
||||
/// should we use only ascii chars when producing latex code?
|
||||
bool ascii_;
|
||||
///
|
||||
int line_;
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user