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 dotsi dots none amsmath
dotsm dots none amsmath dotsm dots none amsmath
dotso dots none amsmath dotso dots none amsmath
#Do not load automatically, since we don't have a possibility to turn iddots dots none mathdots
#automatic loading off like for ams
#iddots dots none mathdots
iddots dots none
ldots dots none ldots dots none
vdots dots none vdots dots none

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>351</width> <width>351</width>
<height>201</height> <height>224</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -60,6 +60,26 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <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"> <widget class="QCheckBox" name="mhchemautoCB">
<property name="toolTip"> <property name="toolTip">
<string>The LaTeX package mhchem is only used if either the command \ce or \cf is inserted into formulas</string> <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> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="7" column="0">
<widget class="QCheckBox" name="mhchemCB"> <widget class="QCheckBox" name="mhchemCB">
<property name="toolTip"> <property name="toolTip">
<string>The LaTeX package mhchem is always used</string> <string>The LaTeX package mhchem is always used</string>
@ -82,17 +102,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="8" 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">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>