From 4b77821d9629c8a07f6f608db73f0b37e2661e74 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Tue, 28 Feb 2012 20:46:20 +0000 Subject: [PATCH] backport r40804 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40806 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/syntax.default | 5 +++-- src/tex2lyx/Preamble.cpp | 2 ++ src/tex2lyx/test/test-insets.tex | 5 +++-- src/tex2lyx/text.cpp | 10 +++++++--- status.20x | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/syntax.default b/lib/syntax.default index 9bfed3faba..0d235f1dbf 100644 --- a/lib/syntax.default +++ b/lib/syntax.default @@ -479,7 +479,7 @@ $$ \ifthenelse \includegraphics*[,][,]{} % LyX 1.0 doesn't support clipping figures \indent -\index{} +\index{translate} \indexentry{}{} % only in .idx files (JMarc) \indexname \indexspace @@ -572,7 +572,7 @@ $$ \pdfstringdef{}{} % from the hyperref package \poptabs \prefacename -\printindex +\printindex[]{} \protect \providecommand{}[][]{} \providecommand*{}[][]{} @@ -633,6 +633,7 @@ $$ \shortstack[]{translate} \showhyphens{} \signature{} +\sindex[]{translate} %splitidx.sty \sldefault \sloppy \stepcounter{} diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 1e17463204..faa7667ad5 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -733,6 +733,8 @@ void Preamble::handle_package(Parser &p, string const & name, name == "multirow" || name == "nomencl" || name == "setspace" || name == "splitidx" || name == "subscript" || name == "ulem" || name == "url") { + if (name == "splitidx") + h_use_indices = "true"; if (!in_lyx_preamble) h_preamble << package_beg_sep << name << package_mid_sep << "\\usepackage{" diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 8e086e7ec7..ce9477ce22 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -20,6 +20,7 @@ \usepackage{varioref} \usepackage{prettyref} \usepackage{makeidx} +\usepackage{splitidx} \makeindex \usepackage{graphicx} @@ -439,7 +440,7 @@ test\phantom{\textcolor{green}{W}\mathbf{ow}\textsuperscript{Wow}}test $test\vphantom{Wow\&\%}test$ -\subsection{Line breaks} +\subsection{Line breaks\sindex[breaks]{Line breaks}} They can also or be broken by a newline\\ or by a starred newline \\* @@ -454,7 +455,7 @@ There are even newlines with weird arguments, but these are not handled by LyX\\*[1cm] so we try to use ERT in this case. -\subsection{Page breaks} +\subsection{Page breaks\sindex[breaks]{Page breaks}} They can also or be broken by a newpage \newpage or by a page break \pagebreak diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 2c8adca33c..bdfc59624e 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -3148,12 +3148,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, btprint = key; } - else if (t.cs() == "index") { + else if (t.cs() == "index" || + (t.cs() == "sindex" && preamble.use_indices() == "true")) { context.check_layout(os); - begin_inset(os, "Index idx\n"); - os << "status collapsed\n"; + string const kind = (t.cs() == "index") ? "idx" : p.getArg('[', ']'); + begin_inset(os, "Index "); + os << kind << "\nstatus collapsed\n"; parse_text_in_inset(p, os, FLAG_ITEM, false, context, "Index"); end_inset(os); + if (t.cs() == "sindex") + preamble.registerAutomaticallyLoadedPackage("splitidx"); } else if (t.cs() == "nomenclature") { diff --git a/status.20x b/status.20x index 5b1b20691e..a2651710b3 100644 --- a/status.20x +++ b/status.20x @@ -57,7 +57,7 @@ What's new * TEX2LYX -- +- Translate \sindex to index inset instead of using ERT. * USER INTERFACE -- 2.39.5