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
|
392 new beamer format InsetLayout
|
||||||
396 nameref.sty InsetRef
|
396 nameref.sty InsetRef
|
||||||
399 automatic mathdots loading \use_mathdots
|
399 automatic mathdots loading \use_mathdots
|
||||||
402 \addcontentsline InsetBibtex bibtotoc option
|
|
||||||
407 vertical offset for multirows InsetTabular
|
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)
|
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
|
415 automatic undertilde loading \use_package undertilde
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#LyX file created by tex2lyx 2.1.0dev
|
#LyX file created by tex2lyx 2.1.0dev
|
||||||
\lyxformat 459
|
\lyxformat 462
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\textclass article
|
\textclass article
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#LyX file created by tex2lyx 2.1.0dev
|
#LyX file created by tex2lyx 2.1.0dev
|
||||||
\lyxformat 459
|
\lyxformat 462
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\textclass article
|
\textclass article
|
||||||
@ -63,7 +63,7 @@
|
|||||||
\secnumdepth 3
|
\secnumdepth 3
|
||||||
\tocdepth 3
|
\tocdepth 3
|
||||||
\paragraph_separation indent
|
\paragraph_separation indent
|
||||||
\paragraph_indentation default
|
\paragraph_indentation 3mm
|
||||||
\quotes_language english
|
\quotes_language english
|
||||||
\papercolumns 1
|
\papercolumns 1
|
||||||
\papersides 1
|
\papersides 1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#LyX file created by tex2lyx 2.1.0dev
|
#LyX file created by tex2lyx 2.1.0dev
|
||||||
\lyxformat 459
|
\lyxformat 462
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\textclass article
|
\textclass article
|
||||||
@ -63,7 +63,7 @@
|
|||||||
\secnumdepth 3
|
\secnumdepth 3
|
||||||
\tocdepth 3
|
\tocdepth 3
|
||||||
\paragraph_separation indent
|
\paragraph_separation indent
|
||||||
\paragraph_indentation default
|
\paragraph_indentation 3mm
|
||||||
\quotes_language english
|
\quotes_language english
|
||||||
\papercolumns 1
|
\papercolumns 1
|
||||||
\papersides 1
|
\papersides 1
|
||||||
|
@ -1019,11 +1019,7 @@ inline false
|
|||||||
status collapsed
|
status collapsed
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
#
|
# Example listing float
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
Example listing float
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
@ -1107,11 +1103,7 @@ inline false
|
|||||||
status collapsed
|
status collapsed
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
d
|
def func(param):
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
ef func(param):
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
@ -1159,11 +1151,7 @@ inline false
|
|||||||
status collapsed
|
status collapsed
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
h
|
hello
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
ello
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -6115,6 +6103,82 @@ $
|
|||||||
|
|
||||||
\begin_layout Standard
|
\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
|
\begin_inset CommandInset index_print
|
||||||
LatexCommand printindex
|
LatexCommand printindex
|
||||||
type "idx"
|
type "idx"
|
||||||
|
@ -572,6 +572,19 @@ Let $f:\left[ a,b\right] \rightarrow%
|
|||||||
%EndExpansion
|
%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{}
|
\printindex{}
|
||||||
|
|
||||||
\printnomenclature hello
|
\printnomenclature hello
|
||||||
|
@ -2162,9 +2162,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
Layout const * newlayout = 0;
|
Layout const * newlayout = 0;
|
||||||
InsetLayout const * newinsetlayout = 0;
|
InsetLayout const * newinsetlayout = 0;
|
||||||
char const * const * where = 0;
|
char const * const * where = 0;
|
||||||
// Store the latest bibliographystyle and nocite{*} option
|
// Store the latest bibliographystyle, addcontentslineContent and
|
||||||
// (needed for bibtex inset)
|
// nocite{*} option (needed for bibtex inset)
|
||||||
string btprint;
|
string btprint;
|
||||||
|
string contentslineContent;
|
||||||
string bibliographystyle = "default";
|
string bibliographystyle = "default";
|
||||||
bool const use_natbib = isProvided("natbib");
|
bool const use_natbib = isProvided("natbib");
|
||||||
bool const use_jurabib = isProvided("jurabib");
|
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") {
|
else if (t.cs() == "bibliographystyle") {
|
||||||
// store new bibliographystyle
|
// store new bibliographystyle
|
||||||
bibliographystyle = p.verbatim_item();
|
bibliographystyle = p.verbatim_item();
|
||||||
// If any other command than \bibliography and
|
// If any other command than \bibliography, \addcontentsline
|
||||||
// \nocite{*} follows, we need to output the style
|
// and \nocite{*} follows, we need to output the style
|
||||||
// (because it might be used by that command).
|
// (because it might be used by that command).
|
||||||
// Otherwise, it will automatically be output by LyX.
|
// Otherwise, it will automatically be output by LyX.
|
||||||
p.pushPosition();
|
p.pushPosition();
|
||||||
@ -3979,6 +3980,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
continue;
|
continue;
|
||||||
} else if (t2.cs() == "bibliography")
|
} else if (t2.cs() == "bibliography")
|
||||||
output = false;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
p.popPosition();
|
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") {
|
else if (t.cs() == "bibliography") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
|
string BibOpts;
|
||||||
begin_command_inset(os, "bibtex", "bibtex");
|
begin_command_inset(os, "bibtex", "bibtex");
|
||||||
if (!btprint.empty()) {
|
if (!btprint.empty()) {
|
||||||
os << "btprint " << '"' << "btPrintAll" << '"' << "\n";
|
os << "btprint " << '"' << "btPrintAll" << '"' << "\n";
|
||||||
@ -3999,9 +4024,20 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
btprint.clear();
|
btprint.clear();
|
||||||
}
|
}
|
||||||
os << "bibfiles " << '"' << p.verbatim_item() << '"' << "\n";
|
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?
|
// Do we have a bibliographystyle set?
|
||||||
if (!bibliographystyle.empty())
|
if (!bibliographystyle.empty()) {
|
||||||
os << "options " << '"' << bibliographystyle << '"' << "\n";
|
if (BibOpts.empty())
|
||||||
|
BibOpts = bibliographystyle;
|
||||||
|
else
|
||||||
|
BibOpts = BibOpts + ',' + bibliographystyle;
|
||||||
|
}
|
||||||
|
os << "options " << '"' << BibOpts << '"' << "\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user