]> git.lyx.org Git - features.git/commitdiff
Add support for the jurabib package (www.jurabib.org), a package for elegant BibTeX...
authorJürgen Spitzmüller <spitz@lyx.org>
Sun, 7 Mar 2004 14:33:17 +0000 (14:33 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sun, 7 Mar 2004 14:33:17 +0000 (14:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8480 a592a061-630c-0410-9148-cb99ea01b6c8

26 files changed:
development/ChangeLog
development/FORMAT
lib/ChangeLog
lib/doc/LaTeXConfig.lyx.in
src/ChangeLog
src/LaTeX.C
src/LaTeXFeatures.C
src/bufferparams.C
src/bufferparams.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlCitation.C
src/frontends/controllers/ControlCitation.h
src/frontends/controllers/biblio.C
src/frontends/controllers/biblio.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/QCitation.C
src/frontends/qt2/QDocument.C
src/frontends/qt2/QDocumentDialog.C
src/frontends/qt2/ui/BiblioModuleBase.ui
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/forms/form_document.fd
src/insets/ChangeLog
src/insets/insetcite.C
src/insets/insetcite.h

index dc3426906858fb84b3f2458e61eb3251aacdc702..1d2ddf86c08b4a7edfc2d6341bf510b1039b6b0c 100644 (file)
@@ -1,3 +1,11 @@
+2003-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FORMAT: document jurabib.
+
+2003-02-23  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FORMAT: document change to format 230.
+
 2003-12-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * FORMAT: document change to format 229.
index 9e55641877de884f9b28bc73fb05519bb7694ce5..6918c28d875fd55a84888ba41239448ae70b7cab 100644 (file)
@@ -4,11 +4,18 @@ LyX file-format changes
 2004-02-23  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * format incremented to 230.
+       
        * Support for a second optional argument in insetcommand.
        currently, citation uses this to support natbibs second
        optional argument \cite[before][after]{key}.
        I think there's nothing to convert upwards. Downwards, the 
-       commands need to be converted to ERT I suppose. 
+       commands with 2 optional args need to be converted to ERT.
+       
+       * Support for jurabib (param \use_jurabib [1|0], default is 0).
+       When converting downwards, \usepackage{jurabib} has to be added
+       to the preamble and, if babel is used, \usepackage{babel} before
+       (jurabib fails if babel is called afterwards). If the natbib commands
+       are used together with jurabib, they have to be converted to ERT too.
 
 2003-12-29  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
index 6fca4bc9dda3aceb6977443767e0118d8d9ecd3c..cd0ad4977c5712eb35daa850e71d82f37c5751ec 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * dco/LaTeXConfig.lyx.in: document jurabib.
+
 2004-02-23  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * examples/ro_splash.lyx: move this file from the docs (where it
index 74a1f24db328d53194c2fa26923e2d891d04bca1..fce72936210bd40df0b23432d08f558e2e4c7ab6 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
-\lyxformat 229
+\lyxformat 230
 \textclass article
 \language english
 \inputencoding default
@@ -13,6 +13,7 @@
 \use_amsmath 0
 \use_natbib 0
 \use_numerical_citations 0
+\use_jurabib 0
 \paperorientation portrait
 \secnumdepth 2
 \tocdepth 3
@@ -2483,6 +2484,50 @@ Layout->Paragraph->ExtraOpt
 
 \begin_layout Subsection
 
+jurabib
+\end_layout
+
+\begin_layout Description
+
+Found: @chk_jurabib@
+\end_layout
+
+\begin_layout Description
+
+CTAN: 
+\family typewriter 
+macros/latex/contrib/jurabib/
+\end_layout
+
+\begin_layout Description
+
+Notes: The package 
+\family typewriter 
+jura
+\family sans 
+bib
+\family default 
+\color None
+(
+\begin_inset LatexCommand \url{http://www.jurabib.org}
+
+\end_inset 
+
+)
+\color default
+ can be used as an alternative to 
+\family sans 
+natbib
+\family default 
+, to get flexible bibliographic styles with LyX.
+ It supports cite styles which are common in human sciences and law studies,
+ footcites, ibidems, and more.
+ You'll need to have jurabib version 0.6 at least.
+\end_layout
+
+\begin_layout Subsection
+
 natbib
 \end_layout
 
@@ -2505,7 +2550,15 @@ Notes: The package
 natbib
 \family default 
  is needed by LyX to produce a flexible interface to most of the available
- bibliographic styles.
+ bibliographic styles
+\family typewriter 
+\family default 
+(you can also use 
+\family sans 
+jurabib
+\family default 
+ instead).
 \end_layout
 
 \begin_layout Subsection
index 8945585c89440ded8f6660c5752da00d5a65a6b3..5ef35da4c6bdc25387cb570b19b40f032581b55b 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * LaTeXFeatures.C:
+       * bufferparams.[Ch]: add jurabib support and param.
+
+       * LaTeX.C: add FIXME/comment.
+
 2004-03-05  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * buffer.C: increment file format to 230.
index 9fd1f9dbdf6a6618d3323fd3f86e9aa417d52c1e..6640b7fb7d0eb3b91f1cf2dfbbbb243d272f7de5 100644 (file)
@@ -528,6 +528,10 @@ bool LaTeX::runBibTeX(vector<Aux_Info> const & bibtex_info)
                        continue;
                result = true;
 
+               // FIXME: the bibtex call should not be hardcoded. bibtex has 
+               // options (--min-crossrefs is useful) and there are also 
+               // alternatives (bibtex8, bibulus, mlbibtex, clbibtex etc.). 
+               // Move to converters? (JSpitzm)
                string tmp = "bibtex ";
                tmp += OnlyFilename(ChangeExtension(it->aux_file, string()));
                Systemcall one;
index aced52e5c3fda3dda8f7558a524e4ac8c8991797..f01df1577ae1bceb3c118a38665582e4dfa24081 100644 (file)
@@ -191,7 +191,8 @@ char const * simplefeatures[] = {
        "wasy",
        "dvipost",
        "fancybox",
-       "calc"
+       "calc",
+       "jurabib"
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
index 0f119fe5731b17ae4706c195b7e08afb92146062..a081842fbfc602c759ee1a99a9092d68dee20eb4 100644 (file)
@@ -115,6 +115,7 @@ BufferParams::BufferParams()
        use_amsmath = AMS_AUTO;
        use_natbib = false;
        use_numerical_citations = false;
+       use_jurabib = false;
        tracking_changes = false;
        secnumdepth = 3;
        tocdepth = 3;
@@ -321,6 +322,9 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
        } else if (token == "\\use_numerical_citations") {
                lex.nextToken();
                use_numerical_citations = lex.getInteger();
+       } else if (token == "\\use_jurabib") {
+               lex.nextToken();
+               use_jurabib = lex.getInteger();
        } else if (token == "\\tracking_changes") {
                lex.nextToken();
                tracking_changes = lex.getInteger();
@@ -537,6 +541,7 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\use_amsmath " << use_amsmath
           << "\n\\use_natbib " << use_natbib
           << "\n\\use_numerical_citations " << use_numerical_citations
+          << "\n\\use_jurabib " << use_jurabib
           << "\n\\paperorientation " << string_orientation[orientation]
           << '\n';
 
@@ -919,6 +924,14 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                texrow.newline();
        }
 
+       // If we use jurabib, we have to call babel here.
+       if (use_babel && features.isRequired("jurabib")) {
+               os << babelCall(language_options.str())
+                  << '\n'
+                  << features.getBabelOptions();
+               texrow.newline();
+       }
+       
        // Now insert the LyX specific LaTeX commands...
 
        // The optional packages;
@@ -987,15 +1000,10 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                lyxpreamble += bullets_def + "}\n\n";
 
        // We try to load babel late, in case it interferes
-       // with other packages.
-       if (use_babel) {
-               string tmp = lyxrc.language_package;
-               if (!lyxrc.language_global_options
-                   && tmp == "\\usepackage{babel}")
-                       tmp = string("\\usepackage[") +
-                               language_options.str() +
-                               "]{babel}";
-               lyxpreamble += tmp + "\n";
+       // with other packages. 
+       // Jurabib has to be called after babel, though.
+       if (use_babel && !features.isRequired("jurabib")) {
+               lyxpreamble += babelCall(language_options.str()) + '\n';
                lyxpreamble += features.getBabelOptions();
        }
 
@@ -1187,3 +1195,12 @@ string const BufferParams::dvips_options() const
                result += ' ' + lyxrc.print_landscape_flag;
        return result;
 }
+
+
+string const BufferParams::babelCall(string const & lang_opts) const
+{
+       string tmp = lyxrc.language_package;
+       if (!lyxrc.language_global_options && tmp == "\\usepackage{babel}")
+               tmp = string("\\usepackage[") + lang_opts + "]{babel}";
+       return tmp;
+}
index c28025658afd2d0b496e73e6d969996b1d95d3e2..1c414881a3a339c83a26b0ea4bdcea0fe302ad2b 100644 (file)
@@ -182,6 +182,8 @@ public:
        bool use_natbib;
        ///
        bool use_numerical_citations;
+       ///
+       bool use_jurabib;
        /// revision tracking for this buffer ?
        bool tracking_changes;
        /// Time ago we agreed that this was a buffer property [ale990407]
@@ -199,6 +201,8 @@ public:
        std::string const dvips_options() const;
        ///
        std::string const paperSizeName() const;
+       ///
+       std::string const babelCall(std::string const & lang_opts) const;
 
 private:
        /** Use the Pimpl idiom to hide those member variables that would otherwise
index 8f6a66fdd46a2750460b27f470bb52e11525f4f4..1c3da24e2161944d17e60e9660ce9cebb45b6b1a 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * biblio.[Ch]:
+       * ControlCitation.[Ch]: add jurabib support.
+
 2004-02-21  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * ControlPrint.C, ControlSendto.C: use always a temp dir
index 93910d35a48929cd54efa318a83437ed0059a408..d5e37aee7236a664289c7df7fa22be29ff89eb84 100644 (file)
@@ -36,8 +36,10 @@ bool ControlCitation::initialiseParams(string const & data)
        vector<pair<string, string> > blist;
        kernel().buffer().fillWithBibKeys(blist);
 
+       bool use_styles = (usingNatbib() || usingJurabib());
+       
        typedef std::map<string, string>::value_type InfoMapValue;
-
+       
        for (vector<pair<string,string> >::size_type i = 0;
             i < blist.size(); ++i) {
                bibkeysInfo_.insert(InfoMapValue(blist[i].first,
@@ -45,11 +47,12 @@ bool ControlCitation::initialiseParams(string const & data)
        }
 
        if (citeStyles_.empty())
-               citeStyles_ = biblio::getCiteStyles(usingNatbib());
+               citeStyles_ = biblio::getCiteStyles(usingNatbib(), usingJurabib());
        else {
-               if ((usingNatbib() && citeStyles_.size() == 1) ||
-                   (!usingNatbib() && citeStyles_.size() != 1))
-                       citeStyles_ = biblio::getCiteStyles(usingNatbib());
+               if ((use_styles && citeStyles_.size() == 1) ||
+                   (!use_styles && citeStyles_.size() != 1))
+                       citeStyles_ = biblio::getCiteStyles(usingNatbib(), 
+                               usingJurabib());
        }
 
        return true;
@@ -76,12 +79,18 @@ bool ControlCitation::usingNatbib() const
 }
 
 
+bool ControlCitation::usingJurabib() const
+{
+    return kernel().buffer().params().use_jurabib;
+}
+
+
 vector<string> const ControlCitation::getCiteStrings(string const & key) const
 {
        vector<string> styles;
 
        vector<biblio::CiteStyle> const cs =
-               biblio::getCiteStyles(usingNatbib());
+               biblio::getCiteStyles(usingNatbib(), usingJurabib());
 
        if (kernel().buffer().params().use_numerical_citations)
                styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
index a01facad25687335492323607ccb72897e0bc597..65b3aa299af9dc3a229c2df1207171a5297da28f 100644 (file)
@@ -38,10 +38,12 @@ public:
 
        ///
        bool usingNatbib() const;
+       ///
+       bool usingJurabib() const;
        /// Possible citations based on this key
        std::vector<std::string> const getCiteStrings(std::string const & key) const;
 
-       /// available CiteStyle-s (depends on availability of Natbib
+       /// available CiteStyle-s (depends on availability of Natbib/Jurabib)
        static std::vector<biblio::CiteStyle> const & getCiteStyles() {
                return citeStyles_;
        }
index a6c0a4ad1bdbcdc2f0c30b904e07df26d09453dc..2ba7e9c7bb84bed733e37765f14609a1d3910c54 100644 (file)
@@ -560,7 +560,7 @@ string const getCiteCommand(CiteStyle command, bool full, bool forceUCase)
 }
 
 
-vector<CiteStyle> const getCiteStyles(bool usingNatbib)
+vector<CiteStyle> const getCiteStyles(bool usingNatbib, bool usingJurabib)
 {
        unsigned int nStyles = 1;
        unsigned int start = 0;
@@ -568,6 +568,8 @@ vector<CiteStyle> const getCiteStyles(bool usingNatbib)
                nStyles = nCiteStyles - 1;
                start = 1;
        }
+       if (usingJurabib)
+               nStyles = nCiteStyles;
 
        vector<CiteStyle> styles(nStyles);
 
@@ -655,6 +657,11 @@ getAuthorYearStrings(string const & key,
 
                switch (styles[i]) {
                case CITE:
+                       // jurabib only: Author/Annotator
+                       // (i.e. the "before" field, 2nd opt arg)
+                       str = author + "/<" + _("before") + '>';
+                       break;
+
                case CITET:
                        str = author + " (" + year + ')';
                        break;
index 0c37e8dce9d41c4a5f09293d2e3cad60af56e8bd..ed59be052bfd194175b2621146adff674fd875e8 100644 (file)
@@ -116,7 +116,7 @@ a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
 std::string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
 
 /// Returns a vector of available Citation styles.
-std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
+std::vector<CiteStyle> const getCiteStyles(bool usingNatbib, bool usingJurabib);
 
 /**
    "Translates" the available Citation Styles into strings for this key.
index 50e2c0e71aeca79df4c10234f3eb1ee6f530f98a..f8ba471690d2f9122cc4ede8a1bd9cf7fc74df04 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QCitation.C:
+       * QDocument.C:
+       * QDocumentDialog.C:
+       * ui/BiblioModuleBase.ui: support jurabib.
+
 2004-03-05  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * QCitation.C:
index 4c73aecee500e244a250a8a3137059bc12fe9e0d..7160e2f48cbc2e837e8f36368f77af789b01fcd4 100644 (file)
@@ -125,9 +125,10 @@ void QCitation::fillStyles()
 
        vector<string> const & sty = controller().getCiteStrings(key);
 
-       bool const natbib = controller().usingNatbib();
-       dialog_->citationStyleCO->setEnabled(!sty.empty() && natbib);
-       dialog_->citationStyleLA->setEnabled(!sty.empty() && natbib);
+       bool const use_styles = (controller().usingNatbib() || 
+               controller().usingJurabib());
+       dialog_->citationStyleCO->setEnabled(!sty.empty() && use_styles);
+       dialog_->citationStyleLA->setEnabled(!sty.empty() && use_styles);
 
        for (vector<string>::const_iterator it = sty.begin();
                it != sty.end(); ++it) {
@@ -145,7 +146,8 @@ void QCitation::updateStyle()
 
        dialog_->fulllistCB->setEnabled(natbib);
        dialog_->forceuppercaseCB->setEnabled(natbib);
-       dialog_->textBeforeED->setEnabled(natbib);
+       dialog_->textBeforeED->setEnabled(natbib || 
+               controller().usingJurabib());
 
        string const & command = controller().params().getCmdName();
 
index ac2669f5402d387bba2561b45d4d6cd4b2202bf8..1fb8b1d65dba10006f8db9429f58ea7a833bb9cd 100644 (file)
@@ -189,9 +189,11 @@ void QDocument::apply()
 
        // biblio
        params.use_natbib =
-               dialog_->biblioModule->natbibCB->isChecked();
+               dialog_->biblioModule->citeNatbibRB->isChecked();
        params.use_numerical_citations  =
                dialog_->biblioModule->citeStyleCO->currentItem();
+       params.use_jurabib =
+               dialog_->biblioModule->citeJurabibRB->isChecked();
 
        // language & quotes
        if (dialog_->langModule->defaultencodingCB->isChecked()) {
@@ -438,10 +440,14 @@ void QDocument::update_contents()
        dialog_->preambleModule->preambleMLE->setText(preamble);
 
        // biblio
-       dialog_->biblioModule->natbibCB->setChecked(
+       dialog_->biblioModule->citeNatbibRB->setChecked(
+               !params.use_natbib && !params.use_jurabib);
+       dialog_->biblioModule->citeNatbibRB->setChecked(
                params.use_natbib);
        dialog_->biblioModule->citeStyleCO->setCurrentItem(
                params.use_numerical_citations ? 1 : 0);
+       dialog_->biblioModule->citeJurabibRB->setChecked(
+               params.use_jurabib);
 
        // language & quotes
        int const pos = int(findPos(lang_,
index 873371fa0c8811dcc0f2115039b5ff617f96f50b..7c6a649f4a6bb19a81efde8cc238fbcf5248818e 100644 (file)
@@ -85,8 +85,10 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
        // preamble
        connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
        // biblio
-       connect(biblioModule->natbibCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
+       connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
+       connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
        connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
+       connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
        // language & quote
        connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
        connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
index 7bf60817d48493eafae0bbd04aa6c2ef392571dd..483a076e876eea4ed6ccf8864a54dedc812219cc 100644 (file)
@@ -13,7 +13,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>450</width>
+            <width>426</width>
             <height>376</height>
         </rect>
     </property>
@@ -21,7 +21,7 @@
         <name>caption</name>
         <string>Form1</string>
     </property>
-    <vbox>
+    <grid>
         <property stdset="1">
             <name>margin</name>
             <number>11</number>
             <name>spacing</name>
             <number>6</number>
         </property>
-        <widget>
-            <class>QLayoutWidget</class>
+        <widget row="0"  column="0" >
+            <class>QButtonGroup</class>
             <property stdset="1">
                 <name>name</name>
-                <cstring>Layout4</cstring>
+                <cstring>CiteStyleBG</cstring>
             </property>
-            <hbox>
+            <property stdset="1">
+                <name>title</name>
+                <string>Cite Style</string>
+            </property>
+            <grid>
                 <property stdset="1">
                     <name>margin</name>
-                    <number>0</number>
+                    <number>11</number>
                 </property>
                 <property stdset="1">
                     <name>spacing</name>
                     <number>6</number>
                 </property>
-                <widget>
+                <widget row="2"  column="0" >
+                    <class>QRadioButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>citeJurabibRB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Jurabib</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Use the jurabib styles for law and humanities</string>
+                    </property>
+                </widget>
+                <widget row="1"  column="0" >
+                    <class>QRadioButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>citeNatbibRB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Natbib</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Use the natbib styles for natural sciences and arts</string>
+                    </property>
+                </widget>
+                <widget row="0"  column="0" >
+                    <class>QRadioButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>citeDefaultRB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Default (numerical)</string>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>Use BibTeX's default numerical styles</string>
+                    </property>
+                </widget>
+                <widget row="1"  column="1" >
                     <class>QLayoutWidget</class>
                     <property stdset="1">
                         <name>name</name>
-                        <cstring>Layout3</cstring>
+                        <cstring>Layout2</cstring>
                     </property>
-                    <vbox>
+                    <hbox>
                         <property stdset="1">
                             <name>margin</name>
                             <number>0</number>
                             <number>6</number>
                         </property>
                         <widget>
-                            <class>QCheckBox</class>
+                            <class>QLabel</class>
                             <property stdset="1">
                                 <name>name</name>
-                                <cstring>natbibCB</cstring>
+                                <cstring>citationStyleL</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>enabled</name>
+                                <bool>false</bool>
                             </property>
                             <property stdset="1">
                                 <name>text</name>
-                                <string>Use &amp;NatBib</string>
+                                <string>Natbib &amp;style:</string>
                             </property>
                             <property>
-                                <name>toolTip</name>
-                                <string>Use the LaTeX natbib package</string>
+                                <name>buddy</name>
+                                <cstring>citeStyleCO</cstring>
                             </property>
                         </widget>
                         <widget>
-                            <class>QLayoutWidget</class>
+                            <class>QComboBox</class>
                             <property stdset="1">
                                 <name>name</name>
-                                <cstring>Layout2</cstring>
+                                <cstring>citeStyleCO</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>enabled</name>
+                                <bool>false</bool>
+                            </property>
+                            <property stdset="1">
+                                <name>sizePolicy</name>
+                                <sizepolicy>
+                                    <hsizetype>5</hsizetype>
+                                    <vsizetype>0</vsizetype>
+                                </sizepolicy>
                             </property>
-                            <hbox>
-                                <property stdset="1">
-                                    <name>margin</name>
-                                    <number>0</number>
-                                </property>
-                                <property stdset="1">
-                                    <name>spacing</name>
-                                    <number>6</number>
-                                </property>
-                                <widget>
-                                    <class>QLabel</class>
-                                    <property stdset="1">
-                                        <name>name</name>
-                                        <cstring>citationStyleL</cstring>
-                                    </property>
-                                    <property stdset="1">
-                                        <name>enabled</name>
-                                        <bool>false</bool>
-                                    </property>
-                                    <property stdset="1">
-                                        <name>text</name>
-                                        <string>Cite &amp;style:</string>
-                                    </property>
-                                    <property>
-                                        <name>buddy</name>
-                                        <cstring>citeStyleCO</cstring>
-                                    </property>
-                                </widget>
-                                <widget>
-                                    <class>QComboBox</class>
-                                    <property stdset="1">
-                                        <name>name</name>
-                                        <cstring>citeStyleCO</cstring>
-                                    </property>
-                                    <property stdset="1">
-                                        <name>enabled</name>
-                                        <bool>false</bool>
-                                    </property>
-                                    <property stdset="1">
-                                        <name>sizePolicy</name>
-                                        <sizepolicy>
-                                            <hsizetype>5</hsizetype>
-                                            <vsizetype>0</vsizetype>
-                                        </sizepolicy>
-                                    </property>
-                                </widget>
-                            </hbox>
                         </widget>
-                    </vbox>
+                    </hbox>
                 </widget>
-                <spacer>
-                    <property>
-                        <name>name</name>
-                        <cstring>Spacer1</cstring>
-                    </property>
-                    <property stdset="1">
-                        <name>orientation</name>
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property stdset="1">
-                        <name>sizeType</name>
-                        <enum>Minimum</enum>
-                    </property>
-                    <property>
-                        <name>sizeHint</name>
-                        <size>
-                            <width>20</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
-            </hbox>
+            </grid>
         </widget>
-        <spacer>
+        <spacer row="1"  column="0" >
             <property>
                 <name>name</name>
                 <cstring>Spacer2</cstring>
                 </size>
             </property>
         </spacer>
-    </vbox>
+    </grid>
 </widget>
 <connections>
     <connection>
-        <sender>natbibCB</sender>
+        <sender>citeNatbibRB</sender>
         <signal>toggled(bool)</signal>
         <receiver>citationStyleL</receiver>
         <slot>setEnabled(bool)</slot>
     </connection>
     <connection>
-        <sender>natbibCB</sender>
+        <sender>citeNatbibRB</sender>
         <signal>toggled(bool)</signal>
         <receiver>citeStyleCO</receiver>
         <slot>setEnabled(bool)</slot>
index bbd95b11edd515d89d38a4d26c94c920a8faf431..d6c3d49c0ad62e5703dd0b5242601723c2d09748 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * FormCitation.C:
+       * FormDocument.C:
+       * forms/form_document.fd: support jurabib.
+
 2004-03-05  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * FormCitation.C: Support second \cite option.
index 7e59ae279c0bc33f61ffaa20243c40046964c33a..ffa4567d73021d658117884fb5f2b8065905731c 100644 (file)
@@ -452,8 +452,8 @@ void FormCitation::update()
        bool const natbib = controller().usingNatbib();
        setEnabled(dialog_->check_full_author_list, natbib);
        setEnabled(dialog_->check_force_uppercase, natbib);
-       setEnabled(dialog_->choice_style, natbib);
-       setEnabled(dialog_->input_before, natbib);
+       setEnabled(dialog_->choice_style, natbib || controller().usingJurabib());
+       setEnabled(dialog_->input_before, natbib || controller().usingJurabib());
 
        // No keys have been selected yet, so...
        fl_clear_browser(dialog_->browser_info);
index 72caa85e9abe18ab1f4f3f80bc2c7e1c4bbc1af7..7b5a55d7de5583f7b4b6a7ea173780bb9638513c 100644 (file)
@@ -299,9 +299,16 @@ void FormDocument::build()
        bcview().addReadOnly(options_->counter_tocdepth);
        bcview().addReadOnly(options_->choice_ams_math);
        bcview().addReadOnly(options_->check_use_natbib);
+       bcview().addReadOnly(options_->check_use_jurabib);
        bcview().addReadOnly(options_->choice_citation_format);
        bcview().addReadOnly(options_->input_float_placement);
        bcview().addReadOnly(options_->choice_postscript_driver);
+       
+       // set up the tooltips for optionss form
+       string str = _("Use the natbib styles for natural sciences and arts");
+       tooltips().init(options_->check_use_natbib, str);
+       str = _("Use the jurabib styles for law and humanities");
+       tooltips().init(options_->check_use_jurabib, str);
 
        // trigger an input event for cut&paste with middle mouse button.
        setPrehandler(options_->input_float_placement);
@@ -370,7 +377,7 @@ void FormDocument::build()
        bcview().addReadOnly(branch_->browser_all_branches);
 
        // set up the tooltips for branches form
-       string str = _("Enter the name of a new branch.");
+       str = _("Enter the name of a new branch.");
        tooltips().init(branch_->input_all_branches, str);
        str = _("Add a new branch to the document.");
        tooltips().init(branch_->button_add_branch, str);
@@ -510,6 +517,14 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
        } else if (ob == options_->check_use_natbib) {
                setEnabled(options_->choice_citation_format,
                           fl_get_button(options_->check_use_natbib));
+               if (fl_get_button(options_->check_use_natbib))
+                       fl_set_button(options_->check_use_jurabib, 0);
+                          
+       } else if (ob == options_->check_use_jurabib) {
+               if (fl_get_button(options_->check_use_jurabib))
+                       fl_set_button(options_->check_use_natbib, 0);
+               setEnabled(options_->choice_citation_format,
+                          fl_get_button(options_->check_use_natbib));
 
        } else if (ob == branch_->browser_all_branches ||
                        ob == branch_->browser_selection ||
@@ -1001,6 +1016,7 @@ bool FormDocument::options_apply(BufferParams & params)
        params.use_natbib  = fl_get_button(options_->check_use_natbib);
        params.use_numerical_citations  =
                fl_get_choice(options_->choice_citation_format) - 1;
+       params.use_jurabib  = fl_get_button(options_->check_use_jurabib);
 
        int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
        if (params.secnumdepth != tmpchar)
@@ -1170,6 +1186,7 @@ void FormDocument::options_update(BufferParams const & params)
        fl_set_choice(options_->choice_citation_format,
                      int(params.use_numerical_citations)+1);
        setEnabled(options_->choice_citation_format, params.use_natbib);
+       fl_set_button(options_->check_use_jurabib,  params.use_jurabib);
        fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
        fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
        if (!params.float_placement.empty())
index 01fe060b95a0b3fec281badd57e2993dbd912a2d..b10f87be349c3ec9ee84b039232646d9cfb02a05 100644 (file)
@@ -1259,13 +1259,13 @@ argument: 0
 =============== FORM ===============
 Name: form_document_options
 Width: 395
-Height: 325
-Number of Objects: 8
+Height: 315
+Number of Objects: 10
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 395 325
+box: 0 0 395 315
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -1345,7 +1345,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 185 130 140 25
+box: 185 125 140 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1363,7 +1363,7 @@ argument: 0
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 185 220 140 25
+box: 35 205 140 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -1381,14 +1381,14 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 185 260 140 25
+box: 185 235 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: Natbib style:|#i
 shortcut: 
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
@@ -1399,7 +1399,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 185 170 140 25
+box: 185 155 140 25
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -1414,6 +1414,42 @@ name: choice_ams_math
 callback: C_FormBaseInputCB
 argument: 0
 
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 15 190 370 110
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Cite Styles
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 35 265 140 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Use Jurabib|#J
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_use_jurabib
+callback: C_FormBaseInputCB
+argument: 0
+
 =============== FORM ===============
 Name: form_document_bullet
 Width: 395
index 4012f6883a62144b9df7201a0bcd51c8f61621df..0e41f9c9e7337f6a7ced449074f7156819dbcb0b 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-07  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * insetcite.[Ch]: support jurabib.
+
 2004-03-05  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * insetcite.C: Support second \cite option.
index 3d755fccbe1b11bd8cbff62b614d91c3c1ea8a5c..48c717b96f47d71ae96c3290a5ee37892b8a2492 100644 (file)
@@ -42,7 +42,7 @@ namespace {
 string const getNatbibLabel(Buffer const & buffer,
                            string const & citeType, string const & keyList,
                            string const & before, string const & after,
-                           bool numerical)
+                           bool numerical, bool jura)
 {
        // Only start the process off after the buffer is loaded from file.
        if (!buffer.fully_loaded())
@@ -76,6 +76,8 @@ string const getNatbibLabel(Buffer const & buffer,
        // CITEAUTHOR:  author
        // CITEYEAR:    year
        // CITEYEARPAR: (year)
+       // jurabib supports these plus
+       // CITE:        author/<before field>
 
        // We don't currently use the full or forceUCase fields.
        // bool const forceUCase = citeType[0] == 'C';
@@ -98,6 +100,11 @@ string const getNatbibLabel(Buffer const & buffer,
                    cite_type == "citealp" ||
                    cite_type == "citeyearpar")
                        before_str = before + ' ';
+               // In CITE (jurabib), the "before" string is used to attach
+               // the annotator (of legal texts) to the author(s) of the 
+               // first reference. 
+               else if (cite_type == "cite")
+                       before_str = '/' + before;
        }
 
        string after_str;
@@ -129,11 +136,23 @@ string const getNatbibLabel(Buffer const & buffer,
                if (author.empty() || year.empty())
                        return string();
 
+               // authors1/<before>;  ... ;
+               //  authors_last, <after>
+               if (cite_type == "cite" && jura) {
+                       if (it == keys.begin())
+                               label += author + before_str + sep_str;
+                       else
+                               label += author + sep_str;
+               
                // (authors1 (<before> year);  ... ;
                //  authors_last (<before> year, <after>)
-               if (cite_type == "citet") {
+               } else if (cite_type == "citet") {
                        string const tmp = numerical ? '#' + *it : year;
-                       label += author + op_str + before_str + tmp +
+                       if (!jura)
+                               label += author + op_str + before_str + tmp +
+                               cp + sep_str;
+                       else
+                               label += before_str + author + op_str + tmp +
                                cp + sep_str;
 
                // author, year; author, year; ...
@@ -149,7 +168,10 @@ string const getNatbibLabel(Buffer const & buffer,
                //  authors_last <before> year, <after>)
                } else if (cite_type == "citealt") {
                        string const tmp = numerical ? '#' + *it : year;
-                       label += author + ' ' + before_str + tmp + sep_str;
+                       if (!jura)
+                               label += author + ' ' + before_str + tmp + sep_str;
+                       else
+                               label += before_str + author + ' ' + tmp + sep_str;
 
                // author; author; ...
                } else if (cite_type == "citeauthor") {
@@ -225,9 +247,9 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
        string const after  = getOptions();
 
        string label;
-       if (buffer.params().use_natbib) {
+       if (buffer.params().use_natbib || buffer.params().use_jurabib) {
                string cmd = getCmdName();
-               if (cmd == "cite") {
+               if (buffer.params().use_natbib && cmd == "cite") {
                        // We may be "upgrading" from an older LyX version.
                        // If, however, we use "cite" because the necessary
                        // author/year info is not present in the biblio
@@ -240,7 +262,8 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
                }
                label = getNatbibLabel(buffer, cmd, getContents(),
                                       before, after,
-                                      buffer.params().use_numerical_citations);
+                                      buffer.params().use_numerical_citations,
+                                      buffer.params().use_jurabib);
        }
 
        // Fallback to fail-safe
@@ -263,6 +286,9 @@ InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const & buffer) const
                        style = Cache::NATBIB_AY;
                }
        }
+       
+       if (buffer.params().use_jurabib)
+               style = Cache::JURABIB;
 
        return style;
 }
@@ -317,12 +343,23 @@ int InsetCitation::latex(Buffer const & buffer, ostream & os,
        os << "\\";
        if (buffer.params().use_natbib)
                os << getCmdName();
-       else
+       else if (buffer.params().use_jurabib) {
+               // jurabib does not (yet) support "force upper case" 
+               // and "full author name". Fallback.
+               string cmd = getCmdName();
+               if (cmd[0] == 'C')
+                       cmd[0] = 'c';
+               size_t n = cmd.size() - 1;
+               if (cmd[n] == '*')
+                       cmd = cmd.substr(0,n);
+               os << cmd;
+       } else
                os << "cite";
 
        string const before = getSecOptions();
        string const after  = getOptions();
-       if (!before.empty() && buffer.params().use_natbib)
+       if (!before.empty() 
+               && (buffer.params().use_natbib || buffer.params().use_jurabib))
                os << '[' << before << "][" << after << ']';
        else if (!after.empty())
                os << '[' << after << ']';
@@ -349,4 +386,6 @@ void InsetCitation::validate(LaTeXFeatures & features) const
 {
        if (features.bufferParams().use_natbib)
                features.require("natbib");
+       else if (features.bufferParams().use_jurabib)
+               features.require("jurabib");
 }
index 7e28c061b8f13d9d3b955253afff44fe9588b5e8..f5b2a3c940f088e774ee629121b68162828ed32d 100644 (file)
@@ -48,7 +48,9 @@ private:
                        ///
                        NATBIB_AY,
                        ///
-                       NATBIB_NUM
+                       NATBIB_NUM,
+                       ///
+                       JURABIB
                };
                ///
                Cache() : style(BASIC) {}