status collapsed
\begin_layout Plain Layout
-#
-\end_layout
-
-\begin_layout Plain Layout
- Example listing float
+# Example listing float
\end_layout
\begin_layout Plain Layout
status collapsed
\begin_layout Plain Layout
-d
-\end_layout
-
-\begin_layout Plain Layout
-ef func(param):
+def func(param):
\end_layout
\begin_layout Plain Layout
status collapsed
\begin_layout Plain Layout
-h
-\end_layout
-
-\begin_layout Plain Layout
-ello
+hello
\end_layout
\end_inset
\begin_layout Standard
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+addcontentsline{toc}{section}{test}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset bibtex
+LatexCommand bibtex
+bibfiles "IEEEexample"
+options "bibtotoc,test"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset bibtex
+LatexCommand bibtex
+bibfiles "IEEEexample"
+options "test"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+bibliographystyle{test}
+\end_layout
+
+\end_inset
+
+
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+addcontentsline{toc}{section}{test}
+\end_layout
+
+\end_inset
+
+
+\begin_inset CommandInset bibtex
+LatexCommand bibtex
+bibfiles "IEEEexample"
+options "test"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
\begin_inset CommandInset index_print
LatexCommand printindex
type "idx"
Layout const * newlayout = 0;
InsetLayout const * newinsetlayout = 0;
char const * const * where = 0;
- // Store the latest bibliographystyle and nocite{*} option
- // (needed for bibtex inset)
+ // Store the latest bibliographystyle, addcontentslineContent and
+ // nocite{*} option (needed for bibtex inset)
string btprint;
+ string contentslineContent;
string bibliographystyle = "default";
bool const use_natbib = isProvided("natbib");
bool const use_jurabib = isProvided("jurabib");
else if (t.cs() == "bibliographystyle") {
// store new bibliographystyle
bibliographystyle = p.verbatim_item();
- // If any other command than \bibliography and
- // \nocite{*} follows, we need to output the style
+ // If any other command than \bibliography, \addcontentsline
+ // and \nocite{*} follows, we need to output the style
// (because it might be used by that command).
// Otherwise, it will automatically be output by LyX.
p.pushPosition();
continue;
} else if (t2.cs() == "bibliography")
output = false;
+ else if (t2.cs() == "addcontentsline") {
+ // get the 3 arguments of \addcontentsline
+ p.getArg('{', '}');
+ p.getArg('{', '}');
+ contentslineContent = p.getArg('{', '}');
+ // if the last argument is not \refname we must output
+ if (contentslineContent == "\\refname")
+ output = false;
+ }
break;
}
p.popPosition();
}
}
+ else if (t.cs() == "addcontentsline") {
+ context.check_layout(os);
+ // get the 3 arguments of \addcontentsline
+ string const one = p.getArg('{', '}');
+ string const two = p.getArg('{', '}');
+ string const three = p.getArg('{', '}');
+ // only if it is a \refname, we support if for the bibtex inset
+ if (contentslineContent != "\\refname") {
+ output_ert_inset(os,
+ "\\addcontentsline{" + one + "}{" + two + "}{"+ three + '}',
+ context);
+ }
+ }
+
else if (t.cs() == "bibliography") {
context.check_layout(os);
+ string BibOpts;
begin_command_inset(os, "bibtex", "bibtex");
if (!btprint.empty()) {
os << "btprint " << '"' << "btPrintAll" << '"' << "\n";
btprint.clear();
}
os << "bibfiles " << '"' << p.verbatim_item() << '"' << "\n";
+ // Do we have addcontentsline?
+ if (contentslineContent == "\\refname") {
+ BibOpts = "bibtotoc";
+ // clear string because next BibTeX inset can be without addcontentsline
+ contentslineContent.clear();
+ }
// Do we have a bibliographystyle set?
- if (!bibliographystyle.empty())
- os << "options " << '"' << bibliographystyle << '"' << "\n";
+ if (!bibliographystyle.empty()) {
+ if (BibOpts.empty())
+ BibOpts = bibliographystyle;
+ else
+ BibOpts = BibOpts + ',' + bibliographystyle;
+ }
+ os << "options " << '"' << BibOpts << '"' << "\n";
end_inset(os);
}