]> git.lyx.org Git - features.git/commitdiff
support to load the mathdots package via the document settings; fixes #5373; fileform...
authorUwe Stöhr <uwestoehr@web.de>
Tue, 31 Aug 2010 02:04:46 +0000 (02:04 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Tue, 31 Aug 2010 02:04:46 +0000 (02:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35241 a592a061-630c-0410-9148-cb99ea01b6c8

development/FORMAT
lib/lyx2lyx/lyx_2_0.py
src/Buffer.cpp
src/BufferParams.cpp
src/BufferParams.h
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/ui/MathsUi.ui

index 2843ddf61be324d53de4f2df5292d6ad07723e89..31df747f1486932a1c7d7bec588952c8d7ddb521 100644 (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
index 05903ed33b3cc5a6b74198aca724a1eae0717fc4..e9a3b8ecbfa4e8fe825b68a17b254c317b74fbae 100644 (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]],
index 32e97b6840cee48f38993df6fe38296144f04e68..3a17d014aa2cc553d964928f2c9ecc8f9099521d 100644 (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;
index b5327053de2c7977f5cd830d223e310702293484..bc559b84e675eaff80949079fa33fc4cc67f8f8d 100644 (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())
index e19e8178414f7a9f6d07b0f7907ca1754c991185..991dd081625235714c1313808c41f374cb7123e4 100644 (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?
index d51f8e6f0709d1a3f3e92e4e6a9a259c46b96839..176670d4b82bb83dc0d4deefacc81e4631ccb674 100644 (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;
index 22c943830cee1f07813d50b92873a8202ef66e4c..66bebcb5e4d23926df5fd4c77a7c2f67c7b430c7 100644 (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">
     </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>