Add support for the jurabib package (www.jurabib.org), a package for elegant BibTeX references, as requested in bug 408.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2004-03-07 14:33:17 +00:00
parent 891bb08e37
commit b1fa5cd0d0
26 changed files with 386 additions and 141 deletions

View 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.

View 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>

View 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

View 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

View 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.

View 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;

View File

@ -191,7 +191,8 @@ char const * simplefeatures[] = {
"wasy",
"dvipost",
"fancybox",
"calc"
"calc",
"jurabib"
};
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);

View 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;
}

View 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

View 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

View 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);

View 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_;
}

View 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;

View 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.

View 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:

View 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();

View 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_,

View 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()));

View 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>
@ -30,28 +30,77 @@
<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>
@ -61,100 +110,47 @@
<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>
@ -175,17 +171,17 @@
</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>

View 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.

View 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);

View 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())

View 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

View 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.

View 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");
}

View File

@ -48,7 +48,9 @@ private:
///
NATBIB_AY,
///
NATBIB_NUM
NATBIB_NUM,
///
JURABIB
};
///
Cache() : style(BASIC) {}