tex2lyx: refsection and bibbysection support (biblatex)

(cherry picked from commit 1a3dbbf07a)
This commit is contained in:
Juergen Spitzmueller 2018-03-04 17:29:59 +01:00
parent 50b78507b9
commit 8ab9b8e0b6
4 changed files with 43 additions and 5 deletions

View File

@ -1073,6 +1073,16 @@ void Preamble::handle_package(Parser &p, string const & name,
if (!opt.empty())
h_biblatex_bibstyle = opt;
}
opt = process_keyval_opt(options, "refsection");
if (!opt.empty()) {
if (opt == "none" || opt == "part"
|| opt == "chapter" || opt == "section"
|| opt == "subsection")
h_multibib = opt;
else
cerr << "Ignoring unkown refesection value '"
<< opt << "'.";
}
if (!options.empty()) {
h_biblio_options = join(options, ",");
options.clear();
@ -1312,6 +1322,8 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
os << "\\biblatex_bibstyle " << h_biblatex_bibstyle << "\n";
if (!h_biblatex_citestyle.empty())
os << "\\biblatex_citestyle " << h_biblatex_citestyle << "\n";
if (!h_multibib.empty())
os << "\\multibib " << h_multibib << "\n";
os << "\\use_indices " << h_use_indices << "\n"
<< "\\paperorientation " << h_paperorientation << '\n'
<< "\\suppress_date " << h_suppress_date << '\n'

View File

@ -133,6 +133,7 @@ private:
std::ostringstream h_preamble;
std::string h_backgroundcolor;
std::string h_multibib;
std::string h_biblio_style;
std::string h_biblio_options;
std::string h_biblatex_bibstyle;

View File

@ -114,13 +114,9 @@ Format LaTeX feature LyX feature
Same for:
\Cites, \textcites, \Textcites, \parencites, \Parencites, \smartcites, \Smartcites, \autocites, Autocites
533 Multibib support
\begin{btUnit}...\end{btUnit} \multibib {none|part|chapter|section|subsetion}
\begin{btUnit}...\end{btUnit} \multibib {none|part|chapter|section|subsection}
(if a part, chapter, section etc.
follows the \begin...)
\usepackage[refsection=<val> \multibib <val>
\bibbysection[<opts>] \begin_inset CommandInset bibtex
biblatexopts "<opts>"
btprint "bibbysection"
534 Chapterbib support
\usepackage{chapterbib} \multibib child

View File

@ -4665,6 +4665,35 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
need_commentbib = false;
}
else if (t.cs() == "bibbysection") {
context.check_layout(os);
string BibOpts;
string bbloptions = p.hasOpt() ? p.getArg('[', ']') : string();
vector<string> opts = getVectorFromString(bbloptions);
vector<string>::iterator it =
find(opts.begin(), opts.end(), "heading=bibintoc");
if (it != opts.end()) {
opts.erase(it);
BibOpts = "bibtotoc";
}
bbloptions = getStringFromVector(opts);
begin_command_inset(os, "bibtex", "bibtex");
os << "btprint " << '"' << "bibbysection" << '"' << "\n";
string bibfiles;
for (auto const & bf : preamble.biblatex_bibliographies) {
if (!bibfiles.empty())
bibfiles += ",";
bibfiles += normalize_filename(bf);
}
if (!bibfiles.empty())
os << "bibfiles " << '"' << bibfiles << '"' << "\n";
os << "options " << '"' << BibOpts << '"' << "\n";
if (!bbloptions.empty())
os << "biblatexopts " << '"' << bbloptions << '"' << "\n";
end_inset(os);
need_commentbib = false;
}
else if (t.cs() == "parbox") {
// Test whether this is an outer box of a shaded box
p.pushPosition();