2 * \file InsetBibtex.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
7 * \author Richard Heck (BibTeX parser improvements)
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
15 #include "InsetBibtex.h"
17 #include "BiblioInfo.h"
19 #include "BufferParams.h"
20 #include "CiteEnginesList.h"
22 #include "DispatchResult.h"
26 #include "FuncRequest.h"
27 #include "FuncStatus.h"
28 #include "LaTeXFeatures.h"
29 #include "output_xhtml.h"
30 #include "OutputParams.h"
31 #include "PDFOptions.h"
32 #include "texstream.h"
33 #include "TextClass.h"
35 #include "frontends/alert.h"
37 #include "support/convert.h"
38 #include "support/debug.h"
39 #include "support/docstream.h"
40 #include "support/ExceptionMessage.h"
41 #include "support/FileNameList.h"
42 #include "support/filetools.h"
43 #include "support/gettext.h"
44 #include "support/lstrings.h"
45 #include "support/os.h"
46 #include "support/PathChanger.h"
47 #include "support/textutils.h"
52 using namespace lyx::support;
56 namespace Alert = frontend::Alert;
57 namespace os = support::os;
60 InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p)
61 : InsetCommand(buf, p)
63 buffer().invalidateBibfileCache();
64 buffer().removeBiblioTempFiles();
68 InsetBibtex::~InsetBibtex()
70 if (isBufferLoaded()) {
71 /* Coverity believs that this may throw an exception, but
72 * actually this code path is not taken when buffer_ == 0 */
73 // coverity[exn_spec_violation]
74 buffer().invalidateBibfileCache();
75 // coverity[exn_spec_violation]
76 buffer().removeBiblioTempFiles();
81 ParamInfo const & InsetBibtex::findInfo(string const & /* cmdName */)
83 static ParamInfo param_info_;
84 if (param_info_.empty()) {
85 param_info_.add("btprint", ParamInfo::LATEX_OPTIONAL);
86 param_info_.add("bibfiles", ParamInfo::LATEX_REQUIRED);
87 param_info_.add("options", ParamInfo::LYX_INTERNAL);
88 param_info_.add("biblatexopts", ParamInfo::LATEX_OPTIONAL);
94 void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
96 switch (cmd.action()) {
102 case LFUN_INSET_MODIFY: {
103 InsetCommandParams p(BIBTEX_CODE);
105 if (!InsetCommand::string2params(to_utf8(cmd.argument()), p)) {
106 cur.noScreenUpdate();
109 } catch (ExceptionMessage const & message) {
110 if (message.type_ == WarningException) {
111 Alert::warning(message.title_, message.details_);
112 cur.noScreenUpdate();
120 buffer().invalidateBibfileCache();
121 buffer().removeBiblioTempFiles();
122 cur.forceBufferUpdate();
127 InsetCommand::doDispatch(cur, cmd);
133 bool InsetBibtex::getStatus(Cursor & cur, FuncRequest const & cmd,
134 FuncStatus & flag) const
136 switch (cmd.action()) {
137 case LFUN_INSET_EDIT:
138 flag.setEnabled(true);
142 return InsetCommand::getStatus(cur, cmd, flag);
147 void InsetBibtex::editDatabases() const
149 vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
151 if (bibfilelist.empty())
154 int nr_databases = bibfilelist.size();
155 if (nr_databases > 1) {
156 docstring const engine = usingBiblatex() ? _("Biblatex") : _("BibTeX");
157 docstring message = bformat(_("The %1$s[[BibTeX/Biblatex]] inset includes %2$s databases.\n"
158 "If you proceed, all of them will be opened."),
159 engine, convert<docstring>(nr_databases));
160 int const ret = Alert::prompt(_("Open Databases?"),
161 message, 0, 1, _("&Cancel"), _("&Proceed"));
167 vector<docstring>::const_iterator it = bibfilelist.begin();
168 vector<docstring>::const_iterator en = bibfilelist.end();
169 for (; it != en; ++it) {
170 FileName const bibfile = getBibTeXPath(*it, buffer());
171 theFormats().edit(buffer(), bibfile,
172 theFormats().getFormatFromFile(bibfile));
177 bool InsetBibtex::usingBiblatex() const
179 return buffer().masterParams().useBiblatex();
183 docstring InsetBibtex::screenLabel() const
185 return usingBiblatex() ? _("Biblatex Generated Bibliography")
186 : _("BibTeX Generated Bibliography");
190 docstring InsetBibtex::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/) const
192 docstring tip = _("Databases:");
193 vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
196 if (bibfilelist.empty())
197 tip += "<li>" + _("none") + "</li>";
199 for (docstring const & bibfile : bibfilelist)
200 tip += "<li>" + bibfile + "</li>";
205 docstring style = getParam("options"); // maybe empty! and with bibtotoc
206 docstring bibtotoc = from_ascii("bibtotoc");
207 if (prefixIs(style, bibtotoc)) {
209 if (contains(style, char_type(',')))
210 style = split(style, bibtotoc, char_type(','));
213 docstring const btprint = getParam("btprint");
214 if (!usingBiblatex()) {
215 tip += _("Style File:");
216 tip += "<ul><li>" + (style.empty() ? _("none") : style) + "</li></ul>";
218 tip += _("Lists:") + " ";
219 if (btprint == "btPrintAll")
220 tip += _("all references");
221 else if (btprint == "btPrintNotCited")
222 tip += _("all uncited references");
224 tip += _("all cited references");
227 tip += _("included in TOC");
229 if (!buffer().parent()
230 && buffer().params().multibib == "child") {
232 tip += _("Note: This bibliography is not output, since bibliographies in the master file "
233 "are not allowed with the setting 'Multiple bibliographies per child document'");
236 tip += _("Lists:") + " ";
237 if (btprint == "bibbysection")
238 tip += _("all reference units");
239 else if (btprint == "btPrintAll")
240 tip += _("all references");
242 tip += _("all cited references");
245 tip += _("included in TOC");
247 if (!getParam("biblatexopts").empty()) {
250 tip += _("Options: ") + getParam("biblatexopts");
258 void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
260 // The sequence of the commands:
261 // With normal BibTeX:
262 // 1. \bibliographystyle{style}
263 // 2. \addcontentsline{...} - if option bibtotoc set
264 // 3. \bibliography{database}
266 // 1. \bibliographystyle{style}
267 // 2. \begin{btSect}{database}
268 // 3. \btPrint{Cited|NotCited|All}
271 // \printbibliography[biblatexopts]
273 // \bibbysection[biblatexopts] - if btprint is "bibbysection"
275 // chapterbib does not allow bibliographies in the master
276 if (!usingBiblatex() && !runparams.is_child
277 && buffer().params().multibib == "child")
280 string style = to_utf8(getParam("options")); // maybe empty! and with bibtotoc
282 if (prefixIs(style, "bibtotoc")) {
283 bibtotoc = "bibtotoc";
284 if (contains(style, ','))
285 style = split(style, bibtotoc, ',');
288 if (usingBiblatex()) {
290 string opts = to_utf8(getParam("biblatexopts"));
292 if (!bibtotoc.empty())
293 opts = opts.empty() ? "heading=bibintoc" : "heading=bibintoc," + opts;
294 // The bibliography command
295 docstring btprint = getParam("btprint");
296 if (btprint == "btPrintAll")
297 os << "\\nocite{*}\n";
298 if (btprint == "bibbysection" && !buffer().masterParams().multibib.empty())
299 os << "\\bibbysection";
301 os << "\\printbibliography";
303 os << "[" << opts << "]";
305 } else {// using BibTeX
307 vector<docstring> const db_out =
308 buffer().prepareBibFilePaths(runparams, getBibFiles(), false);
310 if (style == "default")
311 style = buffer().masterParams().defaultBiblioStyle();
312 if (!style.empty() && !buffer().masterParams().useBibtopic()) {
313 string base = buffer().masterBuffer()->prepareFileNameForLaTeX(style, ".bst", runparams.nice);
314 FileName const try_in_file =
315 makeAbsPath(base + ".bst", buffer().filePath());
316 bool const not_from_texmf = try_in_file.isReadableFile();
317 // If this style does not come from texmf and we are not
318 // exporting to .tex copy it to the tmp directory.
319 // This prevents problems with spaces and 8bit characters
321 if (!runparams.inComment && !runparams.dryrun && !runparams.nice &&
323 // use new style name
324 DocFileName const in_file = DocFileName(try_in_file);
325 base = removeExtension(in_file.mangledFileName());
326 FileName const out_file = makeAbsPath(base + ".bst",
327 buffer().masterBuffer()->temppath());
328 bool const success = in_file.copyTo(out_file);
330 LYXERR0("Failed to copy '" << in_file
331 << "' to '" << out_file << "'");
335 os << "\\bibliographystyle{"
336 << from_utf8(latex_path(buffer().prepareFileNameForLaTeX(base, ".bst", runparams.nice)))
339 // Warn about spaces in bst path. Warn only once.
340 static bool warned_about_bst_spaces = false;
341 if (!warned_about_bst_spaces && runparams.nice && contains(style, ' ')) {
342 warned_about_bst_spaces = true;
343 Alert::warning(_("Export Warning!"),
344 _("There are spaces in the path to your BibTeX style file.\n"
345 "BibTeX will be unable to find it."));
347 // Handle the bibtopic case
348 if (!db_out.empty() && buffer().masterParams().useBibtopic()) {
349 os << "\\begin{btSect}";
351 os << "[" << style << "]";
352 os << "{" << getStringFromVector(db_out) << "}\n";
353 docstring btprint = getParam("btprint");
356 btprint = from_ascii("btPrintCited");
357 os << "\\" << btprint << "\n"
358 << "\\end{btSect}\n";
361 if (!bibtotoc.empty() && !buffer().masterParams().useBibtopic()) {
362 // set label for hyperref, see http://www.lyx.org/trac/ticket/6470
363 if (buffer().masterParams().pdfoptions().use_hyperref)
364 os << "\\phantomsection";
365 if (buffer().masterParams().documentClass().hasLaTeXLayout("chapter"))
366 os << "\\addcontentsline{toc}{chapter}{\\bibname}";
367 else if (buffer().masterParams().documentClass().hasLaTeXLayout("section"))
368 os << "\\addcontentsline{toc}{section}{\\refname}";
370 // The bibliography command
371 if (!db_out.empty() && !buffer().masterParams().useBibtopic()) {
372 docstring btprint = getParam("btprint");
373 if (btprint == "btPrintAll") {
374 os << "\\nocite{*}\n";
376 os << "\\bibliography{" << getStringFromVector(db_out) << "}\n";
382 support::FileNamePairList InsetBibtex::getBibFiles() const
384 FileName path(buffer().filePath());
385 support::PathChanger p(path);
387 // We need to store both the real FileName and the way it is entered
388 // (with full path, rel path or as a single file name).
389 // The latter is needed for biblatex's central bibfile macro.
390 support::FileNamePairList vec;
392 vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
393 vector<docstring>::const_iterator it = bibfilelist.begin();
394 vector<docstring>::const_iterator en = bibfilelist.end();
395 for (; it != en; ++it) {
396 FileName const file = getBibTeXPath(*it, buffer());
399 vec.push_back(make_pair(*it, file));
401 LYXERR0("Couldn't find " + to_utf8(*it) + " in InsetBibtex::getBibFiles()!");
410 // methods for parsing bibtex files
412 typedef map<docstring, docstring> VarMap;
414 /// remove whitespace characters, optionally a single comma,
415 /// and further whitespace characters from the stream.
416 /// @return true if a comma was found, false otherwise
418 bool removeWSAndComma(ifdocstream & ifs) {
427 } while (ifs && isSpace(ch));
440 } while (ifs && isSpace(ch));
455 /// remove whitespace characters, read characer sequence
456 /// not containing whitespace characters or characters in
457 /// delimChars, and remove further whitespace characters.
459 /// @return true if a string of length > 0 could be read.
461 bool readTypeOrKey(docstring & val, ifdocstream & ifs,
462 docstring const & delimChars, docstring const & illegalChars,
475 } while (ifs && isSpace(ch));
481 bool legalChar = true;
482 while (ifs && !isSpace(ch) &&
483 delimChars.find(ch) == docstring::npos &&
484 (legalChar = (illegalChars.find(ch) == docstring::npos))
487 if (chCase == makeLowerCase)
488 val += lowercase(ch);
500 while (ifs && isSpace(ch)) {
508 return val.length() > 0;
511 /// read subsequent bibtex values that are delimited with a #-character.
512 /// Concatenate all parts and replace names with the associated string in
513 /// the variable strings.
514 /// @return true if reading was successfull (all single parts were delimited
516 bool readValue(docstring & val, ifdocstream & ifs, const VarMap & strings) {
529 } while (ifs && isSpace(ch));
534 // check for field type
535 if (isDigitASCII(ch)) {
537 // read integer value
541 } while (ifs && isDigitASCII(ch));
546 } else if (ch == '"' || ch == '{') {
548 char_type delim = ch == '"' ? '"': '}';
553 } while (ifs && isSpace(ch));
558 // We now have the first non-whitespace character
559 // We'll collapse adjacent whitespace.
560 bool lastWasWhiteSpace = false;
562 // inside this delimited text braces must match.
563 // Thus we can have a closing delimiter only
564 // when nestLevel == 0
567 while (ifs && (nestLevel > 0 || ch != delim)) {
569 lastWasWhiteSpace = true;
573 // We output the space only after we stop getting
574 // whitespace so as not to output any whitespace
575 // at the end of the value.
576 if (lastWasWhiteSpace) {
577 lastWasWhiteSpace = false;
583 // update nesting level
602 // FIXME Why is this here?
610 // reading a string name
613 while (ifs && !isSpace(ch) && ch != '#' && ch != ',' && ch != '}' && ch != ')') {
614 strName += lowercase(ch);
621 // replace the string with its assigned value or
622 // discard it if it's not assigned
623 if (strName.length()) {
624 VarMap::const_iterator pos = strings.find(strName);
625 if (pos != strings.end()) {
632 while (ifs && isSpace(ch)) {
639 // continue reading next value on concatenate with '#'
649 void InsetBibtex::collectBibKeys(InsetIterator const & /*di*/) const
655 void InsetBibtex::parseBibTeXFiles() const
657 // This bibtex parser is a first step to parse bibtex files
660 // - it reads the whole bibtex entry and does a syntax check
661 // (matching delimiters, missing commas,...
662 // - it recovers from errors starting with the next @-character
663 // - it reads @string definitions and replaces them in the
665 // - it accepts more characters in keys or value names than
668 // Officially bibtex does only support ASCII, but in practice
669 // you can use the encoding of the main document as long as
670 // some elements like keys and names are pure ASCII. Therefore
671 // we convert the file from the buffer encoding.
672 // We don't restrict keys to ASCII in LyX, since our own
673 // InsetBibitem can generate non-ASCII keys, and nonstandard
674 // 8bit clean bibtex forks exist.
678 support::FileNamePairList const files = getBibFiles();
679 support::FileNamePairList::const_iterator it = files.begin();
680 support::FileNamePairList::const_iterator en = files.end();
681 for (; it != en; ++ it) {
682 ifdocstream ifs(it->second.toFilesystemEncoding().c_str(),
683 ios_base::in, buffer().masterParams().encoding().iconvName());
699 if (!readTypeOrKey(entryType, ifs, from_ascii("{("), docstring(), makeLowerCase)) {
700 lyxerr << "BibTeX Parser: Error reading entry type." << std::endl;
705 lyxerr << "BibTeX Parser: Unexpected end of file." << std::endl;
709 if (entryType == from_ascii("comment")) {
710 ifs.ignore(numeric_limits<int>::max(), '\n');
716 lyxerr << "BibTeX Parser: Unexpected end of file." << std::endl;
720 if ((ch != '(') && (ch != '{')) {
721 lyxerr << "BibTeX Parser: Invalid entry delimiter." << std::endl;
727 if (entryType == from_ascii("string")) {
729 // read string and add it to the strings map
730 // (or replace it's old value)
734 if (!readTypeOrKey(name, ifs, from_ascii("="), from_ascii("#{}(),"), makeLowerCase)) {
735 lyxerr << "BibTeX Parser: Error reading string name." << std::endl;
740 lyxerr << "BibTeX Parser: Unexpected end of file." << std::endl;
744 // next char must be an equal sign
746 if (!ifs || ch != '=') {
747 lyxerr << "BibTeX Parser: No `=' after string name: " <<
748 name << "." << std::endl;
752 if (!readValue(value, ifs, strings)) {
753 lyxerr << "BibTeX Parser: Unable to read value for string: " <<
754 name << "." << std::endl;
758 strings[name] = value;
760 } else if (entryType == from_ascii("preamble")) {
762 // preamble definitions are discarded.
763 // can they be of any use in lyx?
766 if (!readValue(value, ifs, strings)) {
767 lyxerr << "BibTeX Parser: Unable to read preamble value." << std::endl;
773 // Citation entry. Try to read the key.
776 if (!readTypeOrKey(key, ifs, from_ascii(","), from_ascii("}"), keepCase)) {
777 lyxerr << "BibTeX Parser: Unable to read key for entry type:" <<
778 entryType << "." << std::endl;
783 lyxerr << "BibTeX Parser: Unexpected end of file." << std::endl;
787 /////////////////////////////////////////////
788 // now we have a key, so we will add an entry
789 // (even if it's empty, as bibtex does)
791 // we now read the field = value pairs.
792 // all items must be separated by a comma. If
793 // it is missing the scanning of this entry is
794 // stopped and the next is searched.
798 BibTeXInfo keyvalmap(key, entryType);
800 bool readNext = removeWSAndComma(ifs);
802 while (ifs && readNext) {
805 if (!readTypeOrKey(name, ifs, from_ascii("="),
806 from_ascii("{}(),"), makeLowerCase) || !ifs)
809 // next char must be an equal sign
810 // FIXME Whitespace??
813 lyxerr << "BibTeX Parser: Unexpected end of file." << std::endl;
817 lyxerr << "BibTeX Parser: Missing `=' after field name: " <<
818 name << ", for key: " << key << "." << std::endl;
824 if (!readValue(value, ifs, strings)) {
825 lyxerr << "BibTeX Parser: Unable to read value for field: " <<
826 name << ", for key: " << key << "." << std::endl;
830 keyvalmap[name] = value;
831 data += "\n\n" + value;
832 keylist.addFieldName(name);
833 readNext = removeWSAndComma(ifs);
837 keylist.addEntryType(entryType);
838 keyvalmap.setAllData(data);
839 keylist[key] = keyvalmap;
840 } //< else (citation entry)
842 } //< for loop over files
844 buffer().addBiblioInfo(keylist);
848 FileName InsetBibtex::getBibTeXPath(docstring const & filename, Buffer const & buf)
850 string texfile = changeExtension(to_utf8(filename), "bib");
851 // note that, if the filename can be found directly from the path,
852 // findtexfile will just return a FileName object for that path.
853 FileName file(findtexfile(texfile, "bib"));
855 file = FileName(makeAbsPath(texfile, buf.filePath()));
860 bool InsetBibtex::addDatabase(docstring const & db)
862 docstring bibfiles = getParam("bibfiles");
863 if (tokenPos(bibfiles, ',', db) != -1)
865 if (!bibfiles.empty())
867 setParam("bibfiles", bibfiles + db);
872 bool InsetBibtex::delDatabase(docstring const & db)
874 docstring bibfiles = getParam("bibfiles");
875 if (contains(bibfiles, db)) {
876 int const n = tokenPos(bibfiles, ',', db);
879 // this is not the first database
880 docstring tmp = ',' + bd;
881 setParam("bibfiles", subst(bibfiles, tmp, docstring()));
883 // this is the first (or only) database
884 setParam("bibfiles", split(bibfiles, bd, ','));
892 void InsetBibtex::validate(LaTeXFeatures & features) const
894 BufferParams const & mparams = features.buffer().masterParams();
895 if (mparams.useBibtopic())
896 features.require("bibtopic");
897 else if (!mparams.useBiblatex() && mparams.multibib == "child")
898 features.require("chapterbib");
900 // It'd be better to be able to get this from an InsetLayout, but at present
901 // InsetLayouts do not seem really to work for things that aren't InsetTexts.
902 if (features.runparams().flavor == OutputParams::HTML)
903 features.addCSSSnippet("div.bibtexentry { margin-left: 2em; text-indent: -2em; }\n"
904 "span.bibtexlabel:before{ content: \"[\"; }\n"
905 "span.bibtexlabel:after{ content: \"] \"; }");
909 int InsetBibtex::plaintext(odocstringstream & os,
910 OutputParams const & op, size_t max_length) const
912 docstring const reflabel = buffer().B_("References");
914 // We could output more information here, e.g., what databases are included
915 // and information about options. But I don't necessarily see any reason to
916 // do this right now.
917 if (op.for_tooltip || op.for_toc || op.for_search) {
918 os << '[' << reflabel << ']' << '\n';
919 return PLAINTEXT_NEWLINE;
922 BiblioInfo bibinfo = buffer().masterBibInfo();
923 bibinfo.makeCitationLabels(buffer());
924 vector<docstring> const & cites = bibinfo.citedEntries();
926 size_t start_size = os.str().size();
928 refoutput += reflabel + "\n\n";
930 // Tell BiblioInfo our purpose
932 ci.context = CiteItem::Export;
934 // Now we loop over the entries
935 vector<docstring>::const_iterator vit = cites.begin();
936 vector<docstring>::const_iterator const ven = cites.end();
937 for (; vit != ven; ++vit) {
938 if (start_size + refoutput.size() >= max_length)
940 BiblioInfo::const_iterator const biit = bibinfo.find(*vit);
941 if (biit == bibinfo.end())
943 BibTeXInfo const & entry = biit->second;
944 refoutput += "[" + entry.label() + "] ";
945 // FIXME Right now, we are calling BibInfo::getInfo on the key,
946 // which will give us all the cross-referenced info. But for every
947 // entry, so there's a lot of repitition. This should be fixed.
948 refoutput += bibinfo.getInfo(entry.key(), buffer(), ci) + "\n\n";
951 return refoutput.size();
956 // docstring InsetBibtex::entriesAsXHTML(vector<docstring> const & entries)
957 // And then here just: entriesAsXHTML(buffer().masterBibInfo().citedEntries())
958 docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
960 BiblioInfo const & bibinfo = buffer().masterBibInfo();
961 bool const all_entries = getParam("btprint") == "btPrintAll";
962 vector<docstring> const & cites =
963 all_entries ? bibinfo.getKeys() : bibinfo.citedEntries();
965 docstring const reflabel = buffer().B_("References");
967 // tell BiblioInfo our purpose
969 ci.context = CiteItem::Export;
971 ci.max_key_size = UINT_MAX;
973 xs << html::StartTag("h2", "class='bibtex'")
975 << html::EndTag("h2")
976 << html::StartTag("div", "class='bibtex'");
978 // Now we loop over the entries
979 vector<docstring>::const_iterator vit = cites.begin();
980 vector<docstring>::const_iterator const ven = cites.end();
981 for (; vit != ven; ++vit) {
982 BiblioInfo::const_iterator const biit = bibinfo.find(*vit);
983 if (biit == bibinfo.end())
986 BibTeXInfo const & entry = biit->second;
987 string const attr = "class='bibtexentry' id='LyXCite-"
988 + to_utf8(html::cleanAttr(entry.key())) + "'";
989 xs << html::StartTag("div", attr);
991 // don't print labels if we're outputting all entries
993 xs << html::StartTag("span", "class='bibtexlabel'")
995 << html::EndTag("span");
998 // FIXME Right now, we are calling BibInfo::getInfo on the key,
999 // which will give us all the cross-referenced info. But for every
1000 // entry, so there's a lot of repitition. This should be fixed.
1001 xs << html::StartTag("span", "class='bibtexinfo'")
1002 << XHTMLStream::ESCAPE_AND
1003 << bibinfo.getInfo(entry.key(), buffer(), ci)
1004 << html::EndTag("span")
1005 << html::EndTag("div")
1008 xs << html::EndTag("div");
1013 void InsetBibtex::write(ostream & os) const
1015 params().Write(os, &buffer());
1019 string InsetBibtex::contextMenuName() const
1021 return "context-bibtex";