//
if (isRequired("amsmath")
- && ! tclass.provides(LyXTextClass::amsmath)) {
+ && !tclass.provides(LyXTextClass::amsmath)
+ && params.use_amsmath != BufferParams::AMS_OFF) {
packages << "\\usepackage{amsmath}\n";
}
}
// amssymb.sty
- if (isRequired("amssymb") || params.use_amsmath)
+ if (isRequired("amssymb") || params.use_amsmath == BufferParams::AMS_ON)
packages << "\\usepackage{amssymb}\n";
// url.sty
if (isRequired("url") && ! tclass.provides(LyXTextClass::url))
#endif
} else if (token == "\\end_inset") {
- lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n"
+ lyxerr << "Solitary \\end_inset in line " << lex.getLineNo() << "\n"
+ << "Missing \\begin_inset?.\n"
<< "Last inset read was: " << last_inset_read
<< endl;
// Simply ignore this. The insets do not have
params.use_geometry = lex.getInteger();
} else if (token == "\\use_amsmath") {
lex.nextToken();
- params.use_amsmath = lex.getInteger();
+ params.use_amsmath = static_cast<BufferParams::AMS>(
+ lex.getInteger());
} else if (token == "\\use_natbib") {
lex.nextToken();
params.use_natbib = lex.getInteger();
}
// AMS Style is at document level
- if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath))
+ if (params.use_amsmath == BufferParams::AMS_ON
+ || tclass.provides(LyXTextClass::amsmath))
features.require("amsmath");
for_each(paragraphs.begin(), paragraphs.end(),
paperpackage = PACKAGE_NONE;
orientation = ORIENTATION_PORTRAIT;
use_geometry = false;
- use_amsmath = false;
+ use_amsmath = AMS_AUTO;
use_natbib = false;
use_numerical_citations = false;
tracking_changes = false;
void readLanguage(LyXLex &);
///
void readGraphicsDriver(LyXLex &);
- ///
- bool use_amsmath;
+
+ /// use AMS package, not, or auto
+ enum AMS {
+ AMS_OFF,
+ AMS_AUTO,
+ AMS_ON
+ };
+ AMS use_amsmath;
///
bool use_natbib;
///
params.graphicsDriver =
fromqstr(dialog_->packagesModule->psdriverCO->currentText());
- params.use_amsmath =
- dialog_->packagesModule->amsCB->isChecked();
+ if (dialog_->packagesModule->amsautoCB->isChecked()) {
+ params.use_amsmath = BufferParams::AMS_AUTO;
+ } else {
+ params.use_amsmath =
+ dialog_->packagesModule->amsCB->isChecked();
+ }
// layout
params.textclass =
dialog_->packagesModule->amsCB->setChecked(
- params.use_amsmath);
+ params.use_amsmath == BufferParams::AMS_YES);
+ dialog_->packagesModule->amsautoCB->setChecked(
+ params.use_amsmath == BufferParams::AMS_AUTO);
switch (params.spacing.getSpace()) {
case Spacing::Other: nitem = 3; break;
<rect>
<x>0</x>
<y>0</y>
- <width>357</width>
+ <width>353</width>
<height>231</height>
</rect>
</property>
</property>
<property stdset="1">
<name>title</name>
- <string>Packages</string>
+ <string>AMS</string>
</property>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
<name>spacing</name>
<number>6</number>
</property>
- <widget row="2" column="0" >
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>amsautoCB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Use AMS math package automatically</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
</property>
<property stdset="1">
<name>text</name>
- <string>Use AMS &math</string>
+ <string>Use AMS &math package</string>
</property>
</widget>
- </grid>
+ </vbox>
</widget>
<widget>
<class>QGroupBox</class>
</widget>
</vbox>
</widget>
+<connections>
+ <connection>
+ <sender>amsautoCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>amsCB</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
<tabstops>
- <tabstop>amsCB</tabstop>
+ <tabstop>amsautoCB</tabstop>
<tabstop>psdriverCO</tabstop>
</tabstops>
</UI>
// disable for read-only documents
bc().addReadOnly(options_->counter_secnumdepth);
bc().addReadOnly(options_->counter_tocdepth);
- bc().addReadOnly(options_->check_use_amsmath);
+ bc().addReadOnly(options_->choice_ams_math);
bc().addReadOnly(options_->check_use_natbib);
bc().addReadOnly(options_->choice_citation_format);
bc().addReadOnly(options_->input_float_placement);
fl_set_input_return(options_->input_float_placement, FL_RETURN_CHANGED);
+ fl_addto_choice(options_->choice_ams_math,
+ _("Never | Automatically | Yes "));
+
for (int n = 0; tex_graphics[n][0]; ++n) {
fl_addto_choice(options_->choice_postscript_driver,
tex_graphics[n]);
bool redo = false;
params.graphicsDriver = getString(options_->choice_postscript_driver);
- params.use_amsmath = fl_get_button(options_->check_use_amsmath);
+ params.use_amsmath = static_cast<BufferParams::AMS>(
+ fl_get_choice(options_->choice_ams_math) - 1);
params.use_natbib = fl_get_button(options_->check_use_natbib);
params.use_numerical_citations =
fl_get_choice(options_->choice_citation_format) - 1;
fl_set_choice_text(options_->choice_postscript_driver,
params.graphicsDriver.c_str());
- fl_set_button(options_->check_use_amsmath, params.use_amsmath);
+ fl_set_choice(options_->choice_ams_math, params.use_amsmath + 1);
fl_set_button(options_->check_use_natbib, params.use_natbib);
fl_set_choice(options_->choice_citation_format,
int(params.use_numerical_citations)+1);
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 185 185 25 25
+box: 185 225 25 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Use AMS Math|#M
+label: Use Natbib|#N
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: check_use_amsmath
+name: check_use_natbib
callback: C_FormBaseInputCB
argument: 0
--------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 185 225 25 25
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 185 265 140 25
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Use Natbib|#N
+label: Citation style:|#i
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: check_use_natbib
+name: choice_citation_format
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 185 265 140 25
+box: 185 185 140 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Citation style:|#i
+label: Use AMS Math:|#M
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
-name: choice_citation_format
+name: choice_ams_math
callback: C_FormBaseInputCB
argument: 0