While working on the new insetcommandparams I noticed that we have no less 
than 4 places where valid citation commands are defined:


1) function init_possible_cite_commands in 
src/frontends/controllers/biblio.C:

"cite",
"citet", "citep", "citealt", "citealp",
"citeauthor", "citeyear", "citeyearpar",
"citet*", "citep*", "citealt*", "citealp*", "citeauthor*",
"Citet",  "Citep",  "Citealt",  "Citealp",  "Citeauthor",
"Citet*", "Citep*", "Citealt*", "Citealp*", "Citeauthor*",
"fullcite",
"footcite", "footcitet", "footcitep", "footcitealt",
"footcitealp", "footciteauthor", "footciteyear",
"footciteyearpar",
"citefield",
"citetitle",
"cite*"

This is used for internal validation.


2) in array citeCommands in src/frontends/controllers/biblio.C:

"cite", "citet", "citep", "citealt", "citealp", "citeauthor",
"citeyear", "citeyearpar"

The code that is using this ensures that also the starred and uppercase-C 
variants are handled. This is used for communicating with the dialog.


3) in function readInset in src/factory.C:

// This strange command allows LyX to recognize "natbib" style
// citations: citet, citep, Citet etc.
if (compare_ascii_no_case(cmdName.substr(0,4), "cite") == 0) {

That means that all commands starting with Cite or cite (and invalid ones 
like CITE_FOOBAR%&§$%) can be read from .lyx files


4) In  src/tex2lyx/text.C in arrays

known_natbib_commands:
"cite", "citet", "citep",
"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar",
"citefullauthor", "Citet", "Citep", "Citealt", "Citealp", "Citeauthor"

known_jurabib_commands:
"cite", "citet", "citep",
"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar"
"fullcite", "citefield", "citetitle", "cite*"

"citefullauthor" is translated to "citeauthor*", and from all other natbib 
commands except "citeyear" and "citeyearpar" the starred forms are also 
known.


So all the footcite commands + "fullcite" can neither be read in nor can 
they be changed/created in the dialog.
"citefield" and "citetitle" can be read in, but not be changed/created in 
the dialog. The attached document contains all valid citation commands 
that can be read by LyX.


I am going to commit the attached patch. The tex2lyx part should also go in 
1.4. Then I propose to do the command params change. After that we can do 
another file format change and support the other cite commands. Maybe 
somebody (Jürgen?) can have a look at the dialog? The internal machinery 
is easy to extend for handling footcite et al.


Georg

Attachment: cite-test.lyx
Description: application/lyx

Index: src/factory.C
===================================================================
--- src/factory.C	(Revision 15334)
+++ src/factory.C	(Arbeitskopie)
@@ -351,6 +351,12 @@ InsetBase * readInset(LyXLex & lex, Buff
 
 		// This strange command allows LyX to recognize "natbib" style
 		// citations: citet, citep, Citet etc.
+		// FIXME: We already have partial support for \\fullcite and
+		// the various \\footcite commands. We should increase the
+		// file format number and read these commands here, too.
+		// Then we should use is_possible_cite_command() in
+		// src/frontends/controllers/biblio.C to test for valid cite
+		// commands.
 		if (compare_ascii_no_case(cmdName.substr(0,4), "cite") == 0) {
 			inset.reset(new InsetCitation(inscmd));
 		} else if (cmdName == "bibitem") {
Index: src/tex2lyx/text.C
===================================================================
--- src/tex2lyx/text.C	(Revision 15334)
+++ src/tex2lyx/text.C	(Arbeitskopie)
@@ -120,8 +120,9 @@ char const * const known_natbib_commands
  * No starred form other than "cite*" known.
  */
 char const * const known_jurabib_commands[] = { "cite", "citet", "citep",
-"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar", "fullcite",
+"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar",
 // jurabib commands not (yet) supported by LyX:
+// "fullcite",
 // "footcite", "footcitet", "footcitep", "footcitealt", "footcitealp",
 // "footciteauthor", "footciteyear", "footciteyearpar",
 "citefield", "citetitle", "cite*", 0 };

Reply via email to