mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
First step towards a more generic package off/auto/on handling:
Internal machinery, no file format change and no UI change yet git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40562 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9154bc99e3
commit
6be6d9a947
@ -361,11 +361,6 @@ BufferParams::BufferParams()
|
||||
papersize = PAPER_DEFAULT;
|
||||
orientation = ORIENTATION_PORTRAIT;
|
||||
use_geometry = false;
|
||||
use_amsmath = package_auto;
|
||||
use_esint = package_auto;
|
||||
use_mhchem = package_auto;
|
||||
use_mathdots = package_auto;
|
||||
use_undertilde = package_auto;
|
||||
cite_engine_ = ENGINE_BASIC;
|
||||
biblio_style = "plain";
|
||||
use_bibtopic = false;
|
||||
@ -432,6 +427,36 @@ docstring BufferParams::B_(string const & l10n) const
|
||||
}
|
||||
|
||||
|
||||
BufferParams::Package BufferParams::use_package(std::string const & p) const
|
||||
{
|
||||
PackageMap::const_iterator it = use_packages.find(p);
|
||||
if (it == use_packages.end())
|
||||
return package_auto;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
void BufferParams::use_package(std::string const & p, BufferParams::Package u)
|
||||
{
|
||||
use_packages[p] = u;
|
||||
}
|
||||
|
||||
|
||||
vector<string> const & BufferParams::auto_packages()
|
||||
{
|
||||
static vector<string> packages;
|
||||
if (packages.empty()) {
|
||||
// adding a package here implies a file format change!
|
||||
packages.push_back("amsmath");
|
||||
packages.push_back("esint");
|
||||
packages.push_back("mathdots");
|
||||
packages.push_back("mhchem");
|
||||
packages.push_back("undertilde");
|
||||
}
|
||||
return packages;
|
||||
}
|
||||
|
||||
|
||||
AuthorList & BufferParams::authors()
|
||||
{
|
||||
return pimpl_->authorlist;
|
||||
@ -678,23 +703,23 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
} else if (token == "\\use_amsmath") {
|
||||
int use_ams;
|
||||
lex >> use_ams;
|
||||
use_amsmath = packagetranslator().find(use_ams);
|
||||
use_package("amsmath", packagetranslator().find(use_ams));
|
||||
} else if (token == "\\use_esint") {
|
||||
int useesint;
|
||||
lex >> useesint;
|
||||
use_esint = packagetranslator().find(useesint);
|
||||
use_package("esint", packagetranslator().find(useesint));
|
||||
} else if (token == "\\use_mhchem") {
|
||||
int usemhchem;
|
||||
lex >> usemhchem;
|
||||
use_mhchem = packagetranslator().find(usemhchem);
|
||||
use_package("mhchem", packagetranslator().find(usemhchem));
|
||||
} else if (token == "\\use_mathdots") {
|
||||
int usemathdots;
|
||||
lex >> usemathdots;
|
||||
use_mathdots = packagetranslator().find(usemathdots);
|
||||
use_package("mathdots", packagetranslator().find(usemathdots));
|
||||
} else if (token == "\\use_undertilde") {
|
||||
int useundertilde;
|
||||
lex >> useundertilde;
|
||||
use_undertilde = packagetranslator().find(useundertilde);
|
||||
use_package("undertilde", packagetranslator().find(useundertilde));
|
||||
} else if (token == "\\cite_engine") {
|
||||
string engine;
|
||||
lex >> engine;
|
||||
@ -999,11 +1024,11 @@ void BufferParams::writeFile(ostream & os) const
|
||||
|
||||
os << "\\papersize " << string_papersize[papersize]
|
||||
<< "\n\\use_geometry " << convert<string>(use_geometry)
|
||||
<< "\n\\use_amsmath " << use_amsmath
|
||||
<< "\n\\use_esint " << use_esint
|
||||
<< "\n\\use_mhchem " << use_mhchem
|
||||
<< "\n\\use_mathdots " << use_mathdots
|
||||
<< "\n\\use_undertilde " << use_undertilde
|
||||
<< "\n\\use_amsmath " << use_package("amsmath")
|
||||
<< "\n\\use_esint " << use_package("esint")
|
||||
<< "\n\\use_mhchem " << use_package("mhchem")
|
||||
<< "\n\\use_mathdots " << use_package("mathdots")
|
||||
<< "\n\\use_undertilde " << use_package("undertilde")
|
||||
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
|
||||
<< "\n\\biblio_style " << biblio_style
|
||||
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
|
||||
@ -1168,18 +1193,16 @@ void BufferParams::validate(LaTeXFeatures & features) const
|
||||
if (float_placement.find('H') != string::npos)
|
||||
features.require("float");
|
||||
|
||||
for (PackageMap::const_iterator it = use_packages.begin();
|
||||
it != use_packages.end(); ++it) {
|
||||
if (it->first == "amsmath") {
|
||||
// AMS Style is at document level
|
||||
if (use_amsmath == package_on
|
||||
|| documentClass().provides("amsmath"))
|
||||
features.require("amsmath");
|
||||
if (use_esint == package_on)
|
||||
features.require("esint");
|
||||
if (use_mhchem == package_on)
|
||||
features.require("mhchem");
|
||||
if (use_mathdots == package_on)
|
||||
features.require("mathdots");
|
||||
if (use_undertilde == package_on)
|
||||
features.require("undertilde");
|
||||
if (it->second == package_on ||
|
||||
documentClass().provides("amsmath"))
|
||||
features.require(it->first);
|
||||
} else if (it->second == package_on)
|
||||
features.require(it->first);
|
||||
}
|
||||
|
||||
// Document-level line spacing
|
||||
if (spacing().getSpace() != Spacing::Single && !spacing().isDefault())
|
||||
|
@ -343,16 +343,12 @@ public:
|
||||
/// some ERT that needs the package)
|
||||
package_on = 2
|
||||
};
|
||||
/// Whether and how to load amsmath
|
||||
Package use_amsmath;
|
||||
/// Whether and how to load esint
|
||||
Package use_esint;
|
||||
/// Whether and how to load mhchem
|
||||
Package use_mhchem;
|
||||
/// Whether and how to load mathdots
|
||||
Package use_mathdots;
|
||||
/// Whether and how to load undertilde
|
||||
Package use_undertilde;
|
||||
/// Whether to load a package such as amsmath or esint.
|
||||
Package use_package(std::string const & p) const;
|
||||
/// Set whether to load a package such as amsmath or esint.
|
||||
void use_package(std::string const & p, Package u);
|
||||
/// All packages that can be switched on or off
|
||||
static std::vector<std::string> const & auto_packages();
|
||||
/// Split bibliography?
|
||||
bool use_bibtopic;
|
||||
/// Split the index?
|
||||
@ -487,6 +483,12 @@ private:
|
||||
/// the list of included children (for includeonly)
|
||||
std::list<std::string> included_children_;
|
||||
|
||||
typedef std::map<std::string, Package> PackageMap;
|
||||
/** Whether and how to load packages like amsmath, esint, mhchem,
|
||||
* mathdots and undertilde.
|
||||
*/
|
||||
PackageMap use_packages;
|
||||
|
||||
/** Use the Pimpl idiom to hide those member variables that would otherwise
|
||||
* drag in other header files.
|
||||
*/
|
||||
|
@ -691,7 +691,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
packages << amsPackages;
|
||||
|
||||
// fixltx2e must be loaded after amsthm, since amsthm produces an error with
|
||||
// the redefined \[ command (bug 7233). Load is as early as possible, since
|
||||
// the redefined \[ command (bug 7233). Load it as early as possible, since
|
||||
// other packages might profit from it.
|
||||
if (mustProvide("fixltx2e"))
|
||||
packages << "\\usepackage{fixltx2e}\n";
|
||||
@ -705,24 +705,27 @@ string const LaTeXFeatures::getPackages() const
|
||||
// integral symbols from wasysym and amsmath.
|
||||
// See http://www.lyx.org/trac/ticket/1942
|
||||
if (mustProvide("wasysym") &&
|
||||
(params_.use_esint != BufferParams::package_off || !isRequired("esint")))
|
||||
params_.use_package("wasysym") != BufferParams::package_off &&
|
||||
(params_.use_package("esint") != BufferParams::package_off || !isRequired("esint")))
|
||||
packages << "\\usepackage{wasysym}\n";
|
||||
|
||||
// accents must be loaded after amsmath
|
||||
if (mustProvide("accents"))
|
||||
if (mustProvide("accents") &&
|
||||
params_.use_package("accents") != BufferParams::package_off)
|
||||
packages << "\\usepackage{accents}\n";
|
||||
|
||||
// mathdots must be loaded after amsmath
|
||||
if (mustProvide("mathdots") &&
|
||||
params_.use_mathdots != BufferParams::package_off)
|
||||
params_.use_package("mathdots") != BufferParams::package_off)
|
||||
packages << "\\usepackage{mathdots}\n";
|
||||
|
||||
// yhmath must be loaded after amsmath
|
||||
if (mustProvide("yhmath"))
|
||||
if (mustProvide("yhmath") &&
|
||||
params_.use_package("yhmath") != BufferParams::package_off)
|
||||
packages << "\\usepackage{yhmath}\n";
|
||||
|
||||
if (mustProvide("undertilde") &&
|
||||
params_.use_undertilde != BufferParams::package_off)
|
||||
params_.use_package("undertilde") != BufferParams::package_off)
|
||||
packages << "\\usepackage{undertilde}\n";
|
||||
|
||||
// [x]color and pdfcolmk are handled in getColorOptions() above
|
||||
@ -757,7 +760,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
// esint must be after amsmath and wasysym, since it will redeclare
|
||||
// inconsistent integral symbols
|
||||
if (mustProvide("esint") &&
|
||||
params_.use_esint != BufferParams::package_off)
|
||||
params_.use_package("esint") != BufferParams::package_off)
|
||||
packages << "\\usepackage{esint}\n";
|
||||
|
||||
// natbib.sty
|
||||
@ -796,9 +799,9 @@ string const LaTeXFeatures::getPackages() const
|
||||
packages << "\\PassOptionsToPackage{normalem}{ulem}\n"
|
||||
"\\usepackage{ulem}\n";
|
||||
|
||||
if (params_.use_mhchem == BufferParams::package_on ||
|
||||
if (params_.use_package("mhchem") == BufferParams::package_on ||
|
||||
(mustProvide("mhchem") &&
|
||||
params_.use_mhchem != BufferParams::package_off))
|
||||
params_.use_package("mhchem") != BufferParams::package_off))
|
||||
packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
|
||||
"\\usepackage{mhchem}\n";
|
||||
|
||||
@ -1051,7 +1054,7 @@ string const LaTeXFeatures::loadAMSPackages() const
|
||||
tmp << "\\usepackage{amsthm}\n";
|
||||
|
||||
if (mustProvide("amsmath")
|
||||
&& params_.use_amsmath != BufferParams::package_off) {
|
||||
&& params_.use_package("amsmath") != BufferParams::package_off) {
|
||||
tmp << "\\usepackage{amsmath}\n";
|
||||
} else {
|
||||
// amsbsy and amstext are already provided by amsmath
|
||||
@ -1062,7 +1065,7 @@ string const LaTeXFeatures::loadAMSPackages() const
|
||||
}
|
||||
|
||||
if (mustProvide("amssymb")
|
||||
|| params_.use_amsmath == BufferParams::package_on)
|
||||
|| params_.use_package("amsmath") == BufferParams::package_on)
|
||||
tmp << "\\usepackage{amssymb}\n";
|
||||
|
||||
return tmp.str();
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
@ -171,6 +172,32 @@ char const * backref_opts_gui[] =
|
||||
};
|
||||
|
||||
|
||||
char const * packages_gui[][4] =
|
||||
{
|
||||
{"amsmath",
|
||||
N_("&Use AMS math package automatically"),
|
||||
N_("Use AMS &math package"),
|
||||
N_("The AMS LaTeX packages are only used if symbols from the AMS math toolbars are inserted into formulas")},
|
||||
{"esint",
|
||||
N_("Use esint package &automatically"),
|
||||
N_("Use &esint package"),
|
||||
N_("The LaTeX package esint is only used if special integral symbols are inserted into formulas")},
|
||||
{"mathdots",
|
||||
N_("Use math&dots package automatically"),
|
||||
N_("Use mathdo&ts package"),
|
||||
N_("The LaTeX package mathdots is only used if the command \\iddots is inserted into formulas")},
|
||||
{"mhchem",
|
||||
N_("Use mhchem &package automatically"),
|
||||
N_("Use mh&chem package"),
|
||||
N_("The LaTeX package mhchem is only used if either the command \\ce or \\cf is inserted into formulas")},
|
||||
{"undertilde",
|
||||
N_("Use u&ndertilde package automatically"),
|
||||
N_("Use undertilde pac&kage"),
|
||||
N_("The LaTeX package undertilde is only used if you use the math frame decoration 'utilde'")},
|
||||
{"", "", "", ""}
|
||||
};
|
||||
|
||||
|
||||
vector<pair<string, QString> > pagestyles;
|
||||
|
||||
|
||||
@ -1148,38 +1175,49 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
|
||||
|
||||
// maths
|
||||
// FIXME This UI has problems:
|
||||
// 1) It is not generic, packages_gui needs to be changed for each new package
|
||||
// 2) Two checkboxes have 4 states, but one is invalid (both pressed)
|
||||
// 3) The auto cb is not disabled if the use cb is checked
|
||||
mathsModule = new UiWidget<Ui::MathsUi>;
|
||||
connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->amsCB, SLOT(setDisabled(bool)));
|
||||
connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->esintCB, SLOT(setDisabled(bool)));
|
||||
connect(mathsModule->mhchemautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->mhchemCB, SLOT(setDisabled(bool)));
|
||||
connect(mathsModule->mathdotsautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->mathdotsCB, SLOT(setDisabled(bool)));
|
||||
connect(mathsModule->undertildeautoCB, SIGNAL(toggled(bool)),
|
||||
mathsModule->undertildeCB, SLOT(setDisabled(bool)));
|
||||
|
||||
connect(mathsModule->amsCB, SIGNAL(clicked()),
|
||||
vector<string> const & packages = BufferParams::auto_packages();
|
||||
for (size_t i = 0; i < packages.size(); ++i) {
|
||||
// Use the order of BufferParams::auto_packages() for easier
|
||||
// access in applyView() and paramsToDialog()
|
||||
int n = 0;
|
||||
for (n = 0; packages_gui[n][0][0]; n++)
|
||||
if (packages_gui[n][0] == packages[i])
|
||||
break;
|
||||
// If this fires somebody changed
|
||||
// BufferParams::auto_packages() without adjusting packages_gui
|
||||
LASSERT(packages_gui[n][0][0], /**/);
|
||||
QString autoText = qt_(packages_gui[n][1]);
|
||||
QString alwaysText = qt_(packages_gui[n][2]);
|
||||
QString autoTooltip = qt_(packages_gui[n][3]);
|
||||
QString alwaysTooltip;
|
||||
if (packages[i] == "amsmath")
|
||||
alwaysTooltip =
|
||||
qt_("The AMS LaTeX packages are always used");
|
||||
else
|
||||
alwaysTooltip = toqstr(bformat(
|
||||
_("The LaTeX package %1$s is always used"),
|
||||
from_ascii(packages[i])));
|
||||
QCheckBox * autoCB = new QCheckBox(autoText, mathsModule);
|
||||
QCheckBox * alwaysCB = new QCheckBox(alwaysText, mathsModule);
|
||||
mathsModule->gridLayout->addWidget(autoCB, 2 * i, 0);
|
||||
mathsModule->gridLayout->addWidget(alwaysCB, 2 * i + 1, 0);
|
||||
autoCB->setToolTip(autoTooltip);
|
||||
alwaysCB->setToolTip(alwaysTooltip);
|
||||
connect(autoCB, SIGNAL(toggled(bool)),
|
||||
alwaysCB, SLOT(setDisabled(bool)));
|
||||
connect(autoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->amsautoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->esintCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->esintautoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->mhchemCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->mhchemautoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->mathdotsautoCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->undertildeCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(mathsModule->undertildeautoCB, SIGNAL(clicked()),
|
||||
connect(alwaysCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
}
|
||||
QSpacerItem * spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum,
|
||||
QSizePolicy::Expanding);
|
||||
mathsModule->gridLayout->addItem(spacer, 2 * packages.size(), 0);
|
||||
|
||||
|
||||
// latex class
|
||||
@ -2369,45 +2407,20 @@ void GuiDocument::applyView()
|
||||
modulesToParams(bp_);
|
||||
|
||||
// Math
|
||||
if (mathsModule->amsautoCB->isChecked())
|
||||
bp_.use_amsmath = BufferParams::package_auto;
|
||||
vector<string> const & packages = BufferParams::auto_packages();
|
||||
for (size_t n = 0; n < packages.size(); ++n) {
|
||||
QCheckBox * autoCB = static_cast<QCheckBox *>(
|
||||
mathsModule->gridLayout->itemAtPosition(2 * n, 0)->widget());
|
||||
if (autoCB->isChecked())
|
||||
bp_.use_package(packages[n], BufferParams::package_auto);
|
||||
else {
|
||||
if (mathsModule->amsCB->isChecked())
|
||||
bp_.use_amsmath = BufferParams::package_on;
|
||||
QCheckBox * alwaysCB = static_cast<QCheckBox *>(
|
||||
mathsModule->gridLayout->itemAtPosition(2 * n + 1, 0)->widget());
|
||||
if (alwaysCB->isChecked())
|
||||
bp_.use_package(packages[n], BufferParams::package_on);
|
||||
else
|
||||
bp_.use_amsmath = BufferParams::package_off;
|
||||
bp_.use_package(packages[n], BufferParams::package_off);
|
||||
}
|
||||
if (mathsModule->esintautoCB->isChecked())
|
||||
bp_.use_esint = BufferParams::package_auto;
|
||||
else {
|
||||
if (mathsModule->esintCB->isChecked())
|
||||
bp_.use_esint = BufferParams::package_on;
|
||||
else
|
||||
bp_.use_esint = BufferParams::package_off;
|
||||
}
|
||||
if (mathsModule->mhchemautoCB->isChecked())
|
||||
bp_.use_mhchem = BufferParams::package_auto;
|
||||
else {
|
||||
if (mathsModule->mhchemCB->isChecked())
|
||||
bp_.use_mhchem = BufferParams::package_on;
|
||||
else
|
||||
bp_.use_mhchem = BufferParams::package_off;
|
||||
}
|
||||
if (mathsModule->mathdotsautoCB->isChecked())
|
||||
bp_.use_mathdots = BufferParams::package_auto;
|
||||
else {
|
||||
if (mathsModule->mathdotsCB->isChecked())
|
||||
bp_.use_mathdots = BufferParams::package_on;
|
||||
else
|
||||
bp_.use_mathdots = BufferParams::package_off;
|
||||
}
|
||||
if (mathsModule->undertildeautoCB->isChecked())
|
||||
bp_.use_undertilde = BufferParams::package_auto;
|
||||
else {
|
||||
if (mathsModule->undertildeCB->isChecked())
|
||||
bp_.use_undertilde = BufferParams::package_on;
|
||||
else
|
||||
bp_.use_undertilde = BufferParams::package_off;
|
||||
}
|
||||
|
||||
// Page Layout
|
||||
@ -2810,30 +2823,15 @@ void GuiDocument::paramsToDialog()
|
||||
latexModule->psdriverCO->setCurrentIndex(nitem);
|
||||
updateModuleInfo();
|
||||
|
||||
mathsModule->amsCB->setChecked(
|
||||
bp_.use_amsmath == BufferParams::package_on);
|
||||
mathsModule->amsautoCB->setChecked(
|
||||
bp_.use_amsmath == BufferParams::package_auto);
|
||||
|
||||
mathsModule->esintCB->setChecked(
|
||||
bp_.use_esint == BufferParams::package_on);
|
||||
mathsModule->esintautoCB->setChecked(
|
||||
bp_.use_esint == BufferParams::package_auto);
|
||||
|
||||
mathsModule->mhchemCB->setChecked(
|
||||
bp_.use_mhchem == BufferParams::package_on);
|
||||
mathsModule->mhchemautoCB->setChecked(
|
||||
bp_.use_mhchem == BufferParams::package_auto);
|
||||
|
||||
mathsModule->mathdotsCB->setChecked(
|
||||
bp_.use_mathdots == BufferParams::package_on);
|
||||
mathsModule->mathdotsautoCB->setChecked(
|
||||
bp_.use_mathdots == BufferParams::package_auto);
|
||||
|
||||
mathsModule->undertildeCB->setChecked(
|
||||
bp_.use_undertilde == BufferParams::package_on);
|
||||
mathsModule->undertildeautoCB->setChecked(
|
||||
bp_.use_undertilde == BufferParams::package_auto);
|
||||
vector<string> const & packages = BufferParams::auto_packages();
|
||||
for (size_t n = 0; n < packages.size(); ++n) {
|
||||
QCheckBox * alwaysCB = static_cast<QCheckBox *>(
|
||||
mathsModule->gridLayout->itemAtPosition(2 * n + 1, 0)->widget());
|
||||
alwaysCB->setChecked(bp_.use_package(packages[n]) == BufferParams::package_on);
|
||||
QCheckBox * autoCB = static_cast<QCheckBox *>(
|
||||
mathsModule->gridLayout->itemAtPosition(2 * n, 0)->widget());
|
||||
autoCB->setChecked(bp_.use_package(packages[n]) == BufferParams::package_auto);
|
||||
}
|
||||
|
||||
switch (bp_.spacing().getSpace()) {
|
||||
case Spacing::Other: nitem = 3; break;
|
||||
|
@ -14,134 +14,6 @@
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="amsautoCB">
|
||||
<property name="toolTip">
|
||||
<string>The AMS LaTeX packages are only used if symbols from the AMS math toolbars are inserted into formulas</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use AMS math package automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="amsCB">
|
||||
<property name="toolTip">
|
||||
<string>The AMS LaTeX packages are always used</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use AMS &math package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="esintautoCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package esint is only used if special integral symbols are inserted into formulas</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use esint package &automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="esintCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package esint is always used</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &esint package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="mathdotsautoCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package mathdots is only used if the command \iddots is inserted into formulas</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use math&dots package automatically</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="mathdotsCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package mathdots is used</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use mathdo&ts package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="mhchemautoCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package mhchem is only used if either the command \ce or \cf is inserted into formulas</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use mhchem &package automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="mhchemCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package mhchem is always used</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use mh&chem package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="undertildeautoCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package undertilde is only used if you use the math frame decoration 'utilde'</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use u&ndertilde package automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="undertildeCB">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX package undertilde is always used</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use undertilde pac&kage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<includes>
|
||||
|
@ -1377,7 +1377,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (type_ == hullSimple || type_ == hullEquation) {
|
||||
cur.recordUndoInset();
|
||||
bool const align =
|
||||
cur.bv().buffer().params().use_amsmath == BufferParams::package_on;
|
||||
cur.bv().buffer().params().use_package("amsmath") == BufferParams::package_on;
|
||||
mutate(align ? hullAlign : hullEqnArray);
|
||||
// mutate() may change labels and such.
|
||||
cur.forceBufferUpdate();
|
||||
|
@ -322,7 +322,7 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
|
||||
{
|
||||
//lyxerr << "creating inset with name: '" << to_utf8(s) << '\'' << endl;
|
||||
if ((s == "ce" || s == "cf") && buf
|
||||
&& buf->params().use_mhchem == BufferParams::package_off)
|
||||
&& buf->params().use_package("mhchem") == BufferParams::package_off)
|
||||
return MathAtom(new MathMacro(buf, s));
|
||||
|
||||
latexkeys const * l = in_word_set(s);
|
||||
|
@ -1838,7 +1838,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
||||
else if (t.cs().size()) {
|
||||
bool const no_mhchem =
|
||||
(t.cs() == "ce" || t.cs() == "cf")
|
||||
&& buf && buf->params().use_mhchem ==
|
||||
&& buf && buf->params().use_package("mhchem") ==
|
||||
BufferParams::package_off;
|
||||
|
||||
bool const is_user_macro = no_mhchem ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user