mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-31 15:46:16 +00:00
Introduce the InsetMathHull::outerDisplay method and use it
This commit is contained in:
parent
4065f596ad
commit
ab3e1ddc34
@ -2405,18 +2405,9 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
if (d->text_[i] == META_INSET
|
if (d->text_[i] == META_INSET
|
||||||
&& i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
&& i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
||||||
InsetMath const * im = getInset(i)->asInsetMath();
|
InsetMath const * im = getInset(i)->asInsetMath();
|
||||||
if (im && im->asHullInset()) {
|
if (im && im->asHullInset()
|
||||||
switch (im->asHullInset()->getType()) {
|
&& im->asHullInset()->outerDisplay())
|
||||||
case hullEquation:
|
|
||||||
case hullEqnArray:
|
|
||||||
case hullAlign:
|
|
||||||
case hullFlAlign:
|
|
||||||
case hullGather:
|
|
||||||
case hullMultline:
|
|
||||||
runparams.inDisplayMath = true;
|
runparams.inDisplayMath = true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
column += Changes::latexMarkChange(os, bparams, runningChange,
|
column += Changes::latexMarkChange(os, bparams, runningChange,
|
||||||
|
@ -898,6 +898,29 @@ bool InsetMathHull::ams() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool InsetMathHull::outerDisplay() const
|
||||||
|
{
|
||||||
|
switch (type_) {
|
||||||
|
case hullEquation:
|
||||||
|
case hullEqnArray:
|
||||||
|
case hullAlign:
|
||||||
|
case hullFlAlign:
|
||||||
|
case hullGather:
|
||||||
|
case hullMultline:
|
||||||
|
return true;
|
||||||
|
case hullNone:
|
||||||
|
case hullSimple:
|
||||||
|
case hullAlignAt:
|
||||||
|
case hullXAlignAt:
|
||||||
|
case hullXXAlignAt:
|
||||||
|
case hullUnknown:
|
||||||
|
case hullRegexp:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset::DisplayType InsetMathHull::display() const
|
Inset::DisplayType InsetMathHull::display() const
|
||||||
{
|
{
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
@ -953,26 +976,7 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
|||||||
if (ams())
|
if (ams())
|
||||||
features.require("amsmath");
|
features.require("amsmath");
|
||||||
|
|
||||||
switch(type_) {
|
if (type_ == hullRegexp) {
|
||||||
case hullNone:
|
|
||||||
case hullSimple:
|
|
||||||
case hullAlignAt:
|
|
||||||
case hullXAlignAt:
|
|
||||||
case hullXXAlignAt:
|
|
||||||
case hullUnknown:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case hullEquation:
|
|
||||||
case hullEqnArray:
|
|
||||||
case hullAlign:
|
|
||||||
case hullFlAlign:
|
|
||||||
case hullGather:
|
|
||||||
case hullMultline:
|
|
||||||
if (features.inDeletedInset() && !features.mustProvide("ct-dvipost"))
|
|
||||||
features.require("ct-tikz-math-sout");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case hullRegexp:
|
|
||||||
features.require("color");
|
features.require("color");
|
||||||
docstring frcol = from_utf8(lcolor.getLaTeXName(Color_regexpframe));
|
docstring frcol = from_utf8(lcolor.getLaTeXName(Color_regexpframe));
|
||||||
docstring bgcol = from_ascii("white");
|
docstring bgcol = from_ascii("white");
|
||||||
@ -982,7 +986,9 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
|||||||
+ bgcol + "}{\\ensuremath{\\mathtt{#1}}}}");
|
+ bgcol + "}{\\ensuremath{\\mathtt{#1}}}}");
|
||||||
features.addPreambleSnippet(
|
features.addPreambleSnippet(
|
||||||
from_ascii("\\newcommand{\\endregexp}{}"));
|
from_ascii("\\newcommand{\\endregexp}{}"));
|
||||||
break;
|
} else if (outerDisplay() && features.inDeletedInset()
|
||||||
|
&& !features.mustProvide("ct-dvipost")) {
|
||||||
|
features.require("ct-tikz-math-sout");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation is necessary only if not using AMS math.
|
// Validation is necessary only if not using AMS math.
|
||||||
|
@ -86,6 +86,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool ams() const;
|
bool ams() const;
|
||||||
///
|
///
|
||||||
|
bool outerDisplay() const;
|
||||||
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
/// identifies HullInset
|
/// identifies HullInset
|
||||||
InsetMathHull const * asHullInset() const { return this; }
|
InsetMathHull const * asHullInset() const { return this; }
|
||||||
|
Loading…
Reference in New Issue
Block a user