mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
tex2lyx: support for \addcontentsline in BibTeX inset
This commit is contained in:
parent
8e2d727e36
commit
72a44b3c75
@ -53,7 +53,6 @@ Format LaTeX feature LyX feature
|
||||
392 new beamer format InsetLayout
|
||||
396 nameref.sty InsetRef
|
||||
399 automatic mathdots loading \use_mathdots
|
||||
402 \addcontentsline InsetBibtex bibtotoc option
|
||||
407 vertical offset for multirows InsetTabular
|
||||
411 support for polyglossia \language_package (the cases of no package, of babel and of custom package is supported)
|
||||
415 automatic undertilde loading \use_package undertilde
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.1.0dev
|
||||
\lyxformat 459
|
||||
\lyxformat 462
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass article
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.1.0dev
|
||||
\lyxformat 459
|
||||
\lyxformat 462
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass article
|
||||
@ -63,7 +63,7 @@
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\paragraph_indentation 3mm
|
||||
\quotes_language english
|
||||
\papercolumns 1
|
||||
\papersides 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
#LyX file created by tex2lyx 2.1.0dev
|
||||
\lyxformat 459
|
||||
\lyxformat 462
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass article
|
||||
@ -63,7 +63,7 @@
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\paragraph_indentation 3mm
|
||||
\quotes_language english
|
||||
\papercolumns 1
|
||||
\papersides 1
|
||||
|
@ -1019,11 +1019,7 @@ inline false
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
#
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
Example listing float
|
||||
# Example listing float
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
@ -1107,11 +1103,7 @@ inline false
|
||||
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
|
||||
@ -1159,11 +1151,7 @@ inline false
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
h
|
||||
\end_layout
|
||||
|
||||
\begin_layout Plain Layout
|
||||
ello
|
||||
hello
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -6115,6 +6103,82 @@ $
|
||||
|
||||
\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"
|
||||
|
@ -572,6 +572,19 @@ Let $f:\left[ a,b\right] \rightarrow%
|
||||
%EndExpansion
|
||||
$.
|
||||
|
||||
\addcontentsline{toc}{section}{test}
|
||||
|
||||
\bibliographystyle{test}
|
||||
\addcontentsline{toc}{section}{\refname}
|
||||
\bibliography{IEEEexample}
|
||||
|
||||
\bibliographystyle{test}
|
||||
\bibliography{IEEEexample}
|
||||
|
||||
\bibliographystyle{test}
|
||||
\addcontentsline{toc}{section}{test}
|
||||
\bibliography{IEEEexample}
|
||||
|
||||
\printindex{}
|
||||
|
||||
\printnomenclature hello
|
||||
|
@ -2162,9 +2162,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
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");
|
||||
@ -3963,8 +3964,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
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();
|
||||
@ -3979,6 +3980,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
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();
|
||||
@ -3989,8 +3999,23 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
@ -3999,9 +4024,20 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user