support to load the mathdots package via the document settings; fixes #5373; fileformat change

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35241 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-08-31 02:04:46 +00:00
parent ac33a77dac
commit 1712e4f35e
7 changed files with 51 additions and 7 deletions

View File

@ -7,6 +7,11 @@ The good example would be 2010-01-10 entry.
-----------------------
2010-08-31 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 399: support for the LaTeX-package
mathdots;
new parameter \use_mathdots
2010-07-17 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 398: support \mathscr;
no new parameter but the mathrsfs package will be loaded

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# This file is part of lyx2lyx
# -*- coding: utf-8 -*-
# Copyright (C) 2008 José Matos <jamatos@lyx.org>
# Copyright (C) 2010 The LyX team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -2057,6 +2057,17 @@ def revert_mathrsfs(document):
i += 1
def revert_mathdots(document):
" Load mathdots if used in the document "
while True:
i = find_token(document.header, "\\use_mathdots" , 0)
if i != -1:
add_to_preamble(document, ["% this command was inserted by lyx2lyx"])
add_to_preamble(document, ["\\usepackage{mathdots}"])
del document.header[i]
break
##
# Conversion hub
#
@ -2114,10 +2125,12 @@ convert = [[346, []],
[395, []],
[396, []],
[397, [remove_Nameref]],
[398, []]
[398, []],
[399, []]
]
revert = [[397, [revert_mathrsfs]],
revert = [[398, [revert_mathdots]],
[397, [revert_mathrsfs]],
[396, []],
[395, [revert_nameref]],
[394, [revert_DIN_C_pagesizes]],

View File

@ -127,7 +127,7 @@ namespace {
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
int const LYX_FORMAT = 398; // uwestoehr: support for \mathscr
int const LYX_FORMAT = 399; // uwestoehr: support for package mathdots
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;

View File

@ -363,6 +363,7 @@ BufferParams::BufferParams()
use_amsmath = package_auto;
use_esint = package_auto;
use_mhchem = package_auto;
use_mathdots = false;
cite_engine_ = ENGINE_BASIC;
use_bibtopic = false;
use_indices = false;
@ -670,6 +671,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
int usemhchem;
lex >> usemhchem;
use_mhchem = packagetranslator().find(usemhchem);
} else if (token == "\\use_mathdots") {
lex >> use_mathdots;
} else if (token == "\\cite_engine") {
string engine;
lex >> engine;
@ -969,6 +972,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\\cite_engine " << citeenginetranslator().find(cite_engine_)
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\use_indices " << convert<string>(use_indices)
@ -1135,6 +1139,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
features.require("esint");
if (use_mhchem == package_on)
features.require("mhchem");
if (use_mathdots)
features.require("mathdots");
// Document-level line spacing
if (spacing().getSpace() != Spacing::Single && !spacing().isDefault())

View File

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

View File

@ -1083,6 +1083,8 @@ GuiDocument::GuiDocument(GuiView & lv)
this, SLOT(change_adaptor()));
connect(mathsModule->mhchemautoCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
// latex class
@ -2218,9 +2220,9 @@ void GuiDocument::applyView()
modulesToParams(bp_);
// Math
if (mathsModule->amsautoCB->isChecked()) {
if (mathsModule->amsautoCB->isChecked())
bp_.use_amsmath = BufferParams::package_auto;
} else {
else {
if (mathsModule->amsCB->isChecked())
bp_.use_amsmath = BufferParams::package_on;
else
@ -2242,6 +2244,10 @@ void GuiDocument::applyView()
else
bp_.use_mhchem = BufferParams::package_off;
}
if (mathsModule->mathdotsCB->isChecked())
bp_.use_mathdots = true;
else
bp_.use_mathdots = false;
// Page Layout
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
@ -2653,6 +2659,8 @@ void GuiDocument::paramsToDialog()
mathsModule->mhchemautoCB->setChecked(
bp_.use_mhchem == BufferParams::package_auto);
mathsModule->mathdotsCB->setChecked(bp_.use_mathdots);
switch (bp_.spacing().getSpace()) {
case Spacing::Other: nitem = 3; break;
case Spacing::Double: nitem = 2; break;

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>351</width>
<height>233</height>
<height>201</height>
</rect>
</property>
<property name="windowTitle">
@ -83,6 +83,16 @@
</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">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>