> Only copy the file if runparams.nice == false. This is consistent with > insetgraphics and insetinclude. You should probably output a warning if > runparams.nice == true and the filename contains spaces (see the .bib file > handling).
Attached. Now, export->latex does not show mangled name. Thanks. > mangledFilename() should be called on complete filenames (with extension). > Please use something like This is not what the code shows me (insetbibtex.C, line 166). Anyway, since you know the code base much better than me, feel free to modify my patch. Bo
Index: src/insets/insetbibtex.C =================================================================== --- src/insets/insetbibtex.C (revision 9619) +++ src/insets/insetbibtex.C (working copy) @@ -207,12 +207,39 @@ int nlines = 0; if (!style.empty()) { + string style_name = style; + // if style contains space, copy to the tmp directory + if (contains(style, ' ')) { + string const in_file = style + ".bst"; + if (!runparams.inComment && !runparams.nice && + IsFileReadable(in_file)) { + // use new style name + style_name = FileName(style).mangledFilename(); + string const out_file = MakeAbsPath(style_name + ".bst", + buffer.getMasterBuffer()->temppath()); + bool const success = copy(in_file, out_file); + if (!success) { + lyxerr << "Failed to copy '" << in_file + << "' to '" << out_file << "'" + << endl; + } + } + } os << "\\bibliographystyle{" - << latex_path(normalize_name(buffer, runparams, style, ".bst")) + << latex_path(normalize_name(buffer, runparams, style_name, ".bst")) << "}\n"; nlines += 1; } + // Post this warning only once. + static bool warned_about_bst_spaces = false; + if (!warned_about_bst_spaces && runparams.nice && contains(style, ' ')) { + warned_about_bst_spaces = true; + Alert::warning(_("Export Warning!"), + _("There are spaces in the paths to your BibTeX style file.\n" + "BibTeX will be unable to find them.")); + } + if (!db_out.empty() && buffer.params().use_bibtopic){ os << "\\begin{btSect}{" << db_out << "}\n"; string btprint = getSecOptions();