mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
New \cite_engine_type default.
The default citation capability of LaTeX is not a true numerical citation engine, rather it uses a mixture of labels/numbers. Thus we now distinguish them: "numerical" always increments the bibitem counter and uses its value as a numerical citation label, while "default" only uses the bibitem counter when no label is provided. LyX file format incremented to 471.
This commit is contained in:
parent
9da74fe207
commit
cde541d785
@ -11,6 +11,12 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
||||
|
||||
-----------------------
|
||||
|
||||
2013-05-16 Julien Rioux <jrioux@lyx.org>
|
||||
* Format incremented to 471
|
||||
New \cite_engine_type default. The default citation
|
||||
capability of LaTeX is not a pure numerical engine,
|
||||
rather it uses a mixture of labels/numbers.
|
||||
|
||||
2013-05-15 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
* Format incremented to 470
|
||||
forced local layouts for future layout backward compatibility:
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
Format 45
|
||||
|
||||
CiteEngineType numerical
|
||||
CiteEngineType default
|
||||
DefaultBiblio plain
|
||||
|
||||
CiteEngine default
|
||||
|
@ -515,6 +515,31 @@ def revert_cite_engine_type(document):
|
||||
document.header[i] = "\\cite_engine natbib_" + engine_type
|
||||
|
||||
|
||||
def convert_cite_engine_type_default(document):
|
||||
"Convert \\cite_engine_type to default for the basic citation engine."
|
||||
i = find_token(document.header, "\\cite_engine basic", 0)
|
||||
if i == -1:
|
||||
return
|
||||
i = find_token(document.header, "\\cite_engine_type" , 0)
|
||||
if i == -1:
|
||||
return
|
||||
document.header[i] = "\\cite_engine_type default"
|
||||
|
||||
|
||||
def revert_cite_engine_type_default(document):
|
||||
"""Revert \\cite_engine_type default.
|
||||
|
||||
Revert to numerical for the basic cite engine, otherwise to authoryear."""
|
||||
engine_type = "authoryear"
|
||||
i = find_token(document.header, "\\cite_engine_type default" , 0)
|
||||
if i == -1:
|
||||
return
|
||||
j = find_token(document.header, "\\cite_engine basic", 0)
|
||||
if j != -1:
|
||||
engine_type = "numerical"
|
||||
document.header[i] = "\\cite_engine_type " + engine_type
|
||||
|
||||
|
||||
# this is the same, as revert_use_cancel() except for the default
|
||||
def revert_cancel(document):
|
||||
"add cancel to the preamble if necessary"
|
||||
@ -4189,10 +4214,12 @@ convert = [
|
||||
[467, []],
|
||||
[468, []],
|
||||
[469, []],
|
||||
[470, []]
|
||||
[470, []],
|
||||
[471, [convert_cite_engine_type_default]],
|
||||
]
|
||||
|
||||
revert = [
|
||||
[470, [revert_cite_engine_type_default]],
|
||||
[469, [revert_forced_local_layout]],
|
||||
[468, [revert_starred_caption]],
|
||||
[467, [revert_mbox_fbox]],
|
||||
|
@ -985,7 +985,7 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
|
||||
{
|
||||
collectCitedEntries(buf);
|
||||
CiteEngineType const engine_type = buf.params().citeEngineType();
|
||||
bool const numbers = (engine_type == ENGINE_TYPE_NUMERICAL);
|
||||
bool const numbers = (engine_type & ENGINE_TYPE_NUMERICAL);
|
||||
|
||||
int keynumber = 0;
|
||||
char modifier = 0;
|
||||
|
@ -267,6 +267,7 @@ CiteEngineTypeTranslator const init_citeenginetypetranslator()
|
||||
{
|
||||
CiteEngineTypeTranslator translator("authoryear", ENGINE_TYPE_AUTHORYEAR);
|
||||
translator.addPair("numerical", ENGINE_TYPE_NUMERICAL);
|
||||
translator.addPair("default", ENGINE_TYPE_DEFAULT);
|
||||
return translator;
|
||||
}
|
||||
|
||||
@ -360,7 +361,7 @@ BufferParams::BufferParams()
|
||||
orientation = ORIENTATION_PORTRAIT;
|
||||
use_geometry = false;
|
||||
cite_engine_.push_back("basic");
|
||||
cite_engine_type_ = ENGINE_TYPE_NUMERICAL;
|
||||
cite_engine_type_ = ENGINE_TYPE_DEFAULT;
|
||||
biblio_style = "plain";
|
||||
use_bibtopic = false;
|
||||
use_indices = false;
|
||||
|
@ -22,6 +22,7 @@ class Buffer;
|
||||
enum CiteEngineType {
|
||||
ENGINE_TYPE_AUTHORYEAR = 1,
|
||||
ENGINE_TYPE_NUMERICAL = 2,
|
||||
ENGINE_TYPE_DEFAULT = 3,
|
||||
};
|
||||
|
||||
|
||||
|
@ -962,6 +962,8 @@ bool TextClass::readCiteEngine(Lexer & lexrc)
|
||||
cite_styles_[ENGINE_TYPE_AUTHORYEAR].clear();
|
||||
if (type & ENGINE_TYPE_NUMERICAL)
|
||||
cite_styles_[ENGINE_TYPE_NUMERICAL].clear();
|
||||
if (type & ENGINE_TYPE_DEFAULT)
|
||||
cite_styles_[ENGINE_TYPE_DEFAULT].clear();
|
||||
string def;
|
||||
bool getout = false;
|
||||
while (!getout && lexrc.isOK()) {
|
||||
@ -1001,6 +1003,8 @@ bool TextClass::readCiteEngine(Lexer & lexrc)
|
||||
cite_styles_[ENGINE_TYPE_AUTHORYEAR].push_back(cs);
|
||||
if (type & ENGINE_TYPE_NUMERICAL)
|
||||
cite_styles_[ENGINE_TYPE_NUMERICAL].push_back(cs);
|
||||
if (type & ENGINE_TYPE_DEFAULT)
|
||||
cite_styles_[ENGINE_TYPE_DEFAULT].push_back(cs);
|
||||
}
|
||||
return getout;
|
||||
}
|
||||
@ -1008,8 +1012,8 @@ bool TextClass::readCiteEngine(Lexer & lexrc)
|
||||
|
||||
int TextClass::readCiteEngineType(Lexer & lexrc) const
|
||||
{
|
||||
int const ENGINE_TYPE_DEFAULT =
|
||||
ENGINE_TYPE_AUTHORYEAR | ENGINE_TYPE_NUMERICAL;
|
||||
LATTEST(ENGINE_TYPE_DEFAULT ==
|
||||
(ENGINE_TYPE_AUTHORYEAR | ENGINE_TYPE_NUMERICAL));
|
||||
if (!lexrc.next()) {
|
||||
lexrc.printError("No cite engine type given for token: `$$Token'.");
|
||||
return ENGINE_TYPE_DEFAULT;
|
||||
@ -1050,11 +1054,15 @@ bool TextClass::readCiteFormat(Lexer & lexrc)
|
||||
cite_macros_[ENGINE_TYPE_AUTHORYEAR][etype] = definition;
|
||||
if (type & ENGINE_TYPE_NUMERICAL)
|
||||
cite_macros_[ENGINE_TYPE_NUMERICAL][etype] = definition;
|
||||
if (type & ENGINE_TYPE_DEFAULT)
|
||||
cite_macros_[ENGINE_TYPE_DEFAULT][etype] = definition;
|
||||
} else {
|
||||
if (type & ENGINE_TYPE_AUTHORYEAR)
|
||||
cite_formats_[ENGINE_TYPE_AUTHORYEAR][etype] = definition;
|
||||
if (type & ENGINE_TYPE_NUMERICAL)
|
||||
cite_formats_[ENGINE_TYPE_NUMERICAL][etype] = definition;
|
||||
if (type & ENGINE_TYPE_DEFAULT)
|
||||
cite_formats_[ENGINE_TYPE_DEFAULT][etype] = definition;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -2251,6 +2251,7 @@ void GuiDocument::updateEngineType(string const & items, CiteEngineType const &
|
||||
biblioModule->citeStyleCO->setCurrentIndex(0);
|
||||
break;
|
||||
case ENGINE_TYPE_NUMERICAL:
|
||||
case ENGINE_TYPE_DEFAULT:
|
||||
biblioModule->citeStyleCO->setCurrentIndex(1);
|
||||
break;
|
||||
}
|
||||
@ -2514,9 +2515,11 @@ void GuiDocument::applyView()
|
||||
bp_.setCiteEngine("natbib");
|
||||
else if (biblioModule->citeJurabibRB->isChecked())
|
||||
bp_.setCiteEngine("jurabib");
|
||||
else
|
||||
if (biblioModule->citeDefaultRB->isChecked()) {
|
||||
bp_.setCiteEngine("basic");
|
||||
|
||||
bp_.setCiteEngineType(ENGINE_TYPE_DEFAULT);
|
||||
}
|
||||
else
|
||||
if (biblioModule->citeStyleCO->currentIndex())
|
||||
bp_.setCiteEngineType(ENGINE_TYPE_NUMERICAL);
|
||||
else
|
||||
@ -2923,7 +2926,7 @@ void GuiDocument::paramsToDialog()
|
||||
cite_engine == "natbib");
|
||||
|
||||
biblioModule->citeStyleCO->setCurrentIndex(
|
||||
bp_.citeEngineType() == ENGINE_TYPE_NUMERICAL);
|
||||
bp_.citeEngineType() & ENGINE_TYPE_NUMERICAL);
|
||||
|
||||
updateEngineType(documentClass().opt_enginetype(),
|
||||
bp_.citeEngineType());
|
||||
|
@ -451,7 +451,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
|
||||
h_biblio_style = "plain";
|
||||
h_bibtex_command = "default";
|
||||
h_cite_engine = "basic";
|
||||
h_cite_engine_type = "numerical";
|
||||
h_cite_engine_type = "default";
|
||||
h_color = "#008000";
|
||||
h_defskip = "medskip";
|
||||
//h_float_placement;
|
||||
|
@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
|
||||
|
||||
// Do not remove the comment below, so we get merge conflict in
|
||||
// independent branches. Instead add your own.
|
||||
#define LYX_FORMAT_LYX 470 // gb: new tag begin_forced_local_layout/end_forced_local_layout
|
||||
#define LYX_FORMAT_TEX2LYX 470 // gb: new tag begin_forced_local_layout/end_forced_local_layout
|
||||
#define LYX_FORMAT_LYX 471 // jrioux: new \cite_engine_type default
|
||||
#define LYX_FORMAT_TEX2LYX 471 // jrioux: new \cite_engine_type default
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user