+//FIXME See the header for the issue.
+string const default_cite_command(biblio::CiteEngine engine)
+{
+ string str;
+ switch (engine) {
+ case biblio::ENGINE_BASIC:
+ str = "cite";
+ break;
+ case biblio::ENGINE_NATBIB_AUTHORYEAR:
+ str = "citet";
+ break;
+ case biblio::ENGINE_NATBIB_NUMERICAL:
+ str = "citep";
+ break;
+ case biblio::ENGINE_JURABIB:
+ str = "cite";
+ break;
+ }
+ return str;
+}
+
+
+string const
+ asValidLatexCommand(string const & input, biblio::CiteEngine const engine)
+{
+ string const default_str = default_cite_command(engine);
+ if (!InsetCitation::isCompatibleCommand(input))
+ return default_str;
+
+ string output;
+ switch (engine) {
+ case biblio::ENGINE_BASIC:
+ output = input;
+ break;
+
+ case biblio::ENGINE_NATBIB_AUTHORYEAR:
+ case biblio::ENGINE_NATBIB_NUMERICAL:
+ if (input == "cite" || input == "citefield" ||
+ input == "citetitle" || input == "cite*")
+ output = default_str;
+ else if (prefixIs(input, "foot"))
+ output = input.substr(4);
+ else
+ output = input;
+ break;
+
+ case biblio::ENGINE_JURABIB: {
+ // Jurabib does not support the 'uppercase' natbib style.
+ if (input[0] == 'C')
+ output = string(1, 'c') + input.substr(1);
+ else
+ output = input;
+
+ // Jurabib does not support the 'full' natbib style.
+ string::size_type const n = output.size() - 1;
+ if (output != "cite*" && output[n] == '*')
+ output = output.substr(0, n);
+
+ break;
+ }
+ }
+
+ return output;
+}
+
+
+docstring const getComplexLabel(Buffer const & buffer,
+ string const & citeType, docstring const & keyList,