mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
John's AMS patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6365 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7941e6e7c4
commit
a0c3878e31
@ -197,7 +197,8 @@ string const LaTeXFeatures::getPackages() const
|
||||
//
|
||||
|
||||
if (isRequired("amsmath")
|
||||
&& ! tclass.provides(LyXTextClass::amsmath)) {
|
||||
&& !tclass.provides(LyXTextClass::amsmath)
|
||||
&& params.use_amsmath != BufferParams::AMS_OFF) {
|
||||
packages << "\\usepackage{amsmath}\n";
|
||||
}
|
||||
|
||||
@ -263,7 +264,7 @@ string const LaTeXFeatures::getPackages() const
|
||||
}
|
||||
|
||||
// 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))
|
||||
|
@ -516,7 +516,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#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
|
||||
@ -754,7 +755,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
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();
|
||||
@ -2809,7 +2811,8 @@ void Buffer::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
// 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(),
|
||||
|
@ -55,7 +55,7 @@ BufferParams::BufferParams()
|
||||
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;
|
||||
|
@ -211,8 +211,14 @@ public:
|
||||
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;
|
||||
///
|
||||
|
@ -238,8 +238,12 @@ void QDocument::apply()
|
||||
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 =
|
||||
@ -477,7 +481,9 @@ void QDocument::update_contents()
|
||||
|
||||
|
||||
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;
|
||||
|
@ -13,7 +13,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>357</width>
|
||||
<width>353</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -38,9 +38,9 @@
|
||||
</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>
|
||||
@ -49,7 +49,22 @@
|
||||
<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>
|
||||
@ -57,10 +72,10 @@
|
||||
</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>
|
||||
@ -118,8 +133,16 @@
|
||||
</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>
|
||||
|
@ -281,7 +281,7 @@ void FormDocument::build()
|
||||
// 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);
|
||||
@ -292,6 +292,9 @@ void FormDocument::build()
|
||||
|
||||
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]);
|
||||
@ -794,7 +797,8 @@ bool FormDocument::options_apply(BufferParams & params)
|
||||
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;
|
||||
@ -963,7 +967,7 @@ void FormDocument::options_update(BufferParams const & params)
|
||||
|
||||
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);
|
||||
|
@ -1450,24 +1450,6 @@ name: choice_postscript_driver
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 185 185 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
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_use_amsmath
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
@ -1504,6 +1486,24 @@ name: choice_citation_format
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
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: Use AMS Math:|#M
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_ams_math
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_document_bullet
|
||||
Width: 395
|
||||
|
Loading…
Reference in New Issue
Block a user