better support for the mathdots package:

technically this package is the same as esint, only for dots instead of integrals -> therefore we can and should handle it the same as esint

-> add "use automatically" checkbox
-> load mathdots if \iddots is inserted

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35251 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-08-31 23:34:54 +00:00
parent ac52f09058
commit a2c6c06908
6 changed files with 52 additions and 31 deletions

View File

@ -43,10 +43,7 @@ dotsc dots none amsmath
dotsi dots none amsmath
dotsm dots none amsmath
dotso dots none amsmath
#Do not load automatically, since we don't have a possibility to turn
#automatic loading off like for ams
#iddots dots none mathdots
iddots dots none
iddots dots none mathdots
ldots dots none
vdots dots none

View File

@ -363,7 +363,7 @@ BufferParams::BufferParams()
use_amsmath = package_auto;
use_esint = package_auto;
use_mhchem = package_auto;
use_mathdots = false;
use_mathdots = package_auto;
cite_engine_ = ENGINE_BASIC;
use_bibtopic = false;
use_indices = false;
@ -672,7 +672,9 @@ string BufferParams::readToken(Lexer & lex, string const & token,
lex >> usemhchem;
use_mhchem = packagetranslator().find(usemhchem);
} else if (token == "\\use_mathdots") {
lex >> use_mathdots;
int usemathdots;
lex >> usemathdots;
use_mathdots = packagetranslator().find(usemathdots);
} else if (token == "\\cite_engine") {
string engine;
lex >> engine;
@ -972,7 +974,7 @@ void BufferParams::writeFile(ostream & os) const
<< "\n\\use_amsmath " << use_amsmath
<< "\n\\use_esint " << use_esint
<< "\n\\use_mhchem " << use_mhchem
<< "\n\\use_mathdots " << convert<string>(use_mathdots)
<< "\n\\use_mathdots " << use_mathdots
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\use_indices " << convert<string>(use_indices)
@ -1139,7 +1141,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
features.require("esint");
if (use_mhchem == package_on)
features.require("mhchem");
if (use_mathdots)
if (use_mathdots == package_on)
features.require("mathdots");
// Document-level line spacing

View File

@ -319,8 +319,8 @@ public:
Package use_esint;
/// Whether and how to load mhchem
Package use_mhchem;
/// Whether to load mathdots
bool use_mathdots;
/// Whether and how to load mathdots
Package use_mathdots;
/// Split bibliography?
bool use_bibtopic;
/// Split the index?

View File

@ -674,7 +674,8 @@ string const LaTeXFeatures::getPackages() const
packages << "\\usepackage{accents}\n";
// mathdots must be loaded after amsmath
if (mustProvide("mathdots"))
if (mustProvide("mathdots") &&
params_.use_mathdots != BufferParams::package_off)
packages << "\\usepackage{mathdots}\n";
// yhmath must be loaded after amsmath

View File

@ -1070,6 +1070,8 @@ GuiDocument::GuiDocument(GuiView & lv)
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->amsCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
@ -1085,7 +1087,9 @@ GuiDocument::GuiDocument(GuiView & lv)
this, SLOT(change_adaptor()));
connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(mathsModule->mathdotsautoCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
// latex class
latexModule = new UiWidget<Ui::LaTeXUi>;
@ -2244,11 +2248,15 @@ void GuiDocument::applyView()
else
bp_.use_mhchem = BufferParams::package_off;
}
if (mathsModule->mathdotsCB->isChecked())
bp_.use_mathdots = true;
else
bp_.use_mathdots = false;
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;
}
// Page Layout
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
bp_.pagestyle = "default";
@ -2659,7 +2667,10 @@ void GuiDocument::paramsToDialog()
mathsModule->mhchemautoCB->setChecked(
bp_.use_mhchem == BufferParams::package_auto);
mathsModule->mathdotsCB->setChecked(bp_.use_mathdots);
mathsModule->mathdotsCB->setChecked(
bp_.use_mathdots == BufferParams::package_on);
mathsModule->mathdotsautoCB->setChecked(
bp_.use_mathdots == BufferParams::package_auto);
switch (bp_.spacing().getSpace()) {
case Spacing::Other: nitem = 3; break;

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>351</width>
<height>201</height>
<height>224</height>
</rect>
</property>
<property name="windowTitle">
@ -60,6 +60,26 @@
</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&amp;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 math&amp;dots 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>
@ -72,7 +92,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="mhchemCB">
<property name="toolTip">
<string>The LaTeX package mhchem is always used</string>
@ -82,17 +102,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="mathdotsCB">
<property name="toolTip">
<string>The LaTeX package mathdots is used</string>
</property>
<property name="text">
<string>Use math&amp;dots package</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>