"setspace", "subscript", "textcomp", "tipa", "tipx", "ulem", "url", "varioref",
"verbatim", "wrapfig", "xunicode", 0};
+// used for the handling of \newindex
+int index_number = 0;
+
// codes used to remove packages that are loaded automatically by LyX.
// Syntax: package_beg_sep<name>package_mid_sep<package loading code>package_end_sep
const char package_beg_sep = '\001';
h_html_be_strict = "false";
h_html_css_as_file = "0";
h_html_math_output = "0";
- h_index = "Index";
+ h_index[0] = "Index";
h_index_command = "default";
h_inputencoding = "auto";
h_justification = "true";
//h_pdf_quoted_options;
h_quotes_language = "english";
h_secnumdepth = "3";
- h_shortcut = "idx";
+ h_shortcut[0] = "idx";
h_spacing = "single";
h_suppress_date = "false";
h_textclass = "article";
os << "\\backgroundcolor " << h_backgroundcolor << '\n';
if (!h_boxbgcolor.empty())
os << "\\boxbgcolor " << h_boxbgcolor << '\n';
- os << "\\index " << h_index << '\n'
- << "\\shortcut " << h_shortcut << '\n'
- << "\\color " << h_color << '\n'
- << "\\end_index\n";
+ if (index_number != 0)
+ for (int i = 0; i < index_number; i++) {
+ os << "\\index " << h_index[i] << '\n'
+ << "\\shortcut " << h_shortcut[i] << '\n'
+ << "\\color " << h_color << '\n'
+ << "\\end_index\n";
+ }
+ else {
+ os << "\\index " << h_index[0] << '\n'
+ << "\\shortcut " << h_shortcut[0] << '\n'
+ << "\\color " << h_color << '\n'
+ << "\\end_index\n";
+ }
os << h_margins
<< "\\secnumdepth " << h_secnumdepth << "\n"
<< "\\tocdepth " << h_tocdepth << "\n"
p.setCatcode('@', catOther);
}
+ else if (t.cs() == "makeindex") {
+ // LyX will re-add this if a print index command is found
+ p.skip_spaces();
+ }
+
+ else if (t.cs() == "newindex") {
+ string const indexname = p.getArg('[', ']');
+ string const shortcut = p.verbatim_item();
+ if (!indexname.empty())
+ h_index[index_number] = indexname;
+ else
+ h_index[index_number] = shortcut;
+ h_shortcut[index_number] = shortcut;
+ index_number += 1;
+ p.skip_spaces();
+ }
+
else if (t.cs() == "RS@ifundefined") {
string const name = p.verbatim_item();
string const body1 = p.verbatim_item();
std::string h_html_be_strict;
std::string h_html_css_as_file;
std::string h_html_math_output;
- std::string h_index;
+ std::string h_index[99];
std::string h_index_command;
std::string h_inputencoding;
std::string h_justification;
std::string h_pdf_quoted_options;
std::string h_quotes_language;
std::string h_secnumdepth;
- std::string h_shortcut;
+ std::string h_shortcut[99];
std::string h_spacing;
std::string h_suppress_date;
std::string h_textclass;
\shortcut idx
\color #008000
\end_index
+\index new
+\shortcut new
+\color #008000
+\end_index
+\index test
+\shortcut test
+\color #008000
+\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\end_layout
\begin_layout Standard
-normal index:
+undefined index:
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset index_print
+LatexCommand printindex
+type "idx"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+index "idx":
\end_layout
\begin_layout Standard
\end_inset
+\end_layout
+
+\begin_layout Standard
+index "new":
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset index_print
+LatexCommand printindex
+type "new"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+subindex "new":
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset index_print
+LatexCommand printsubindex
+type "idx"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+index of all indices:
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset index_print
+LatexCommand printindex*
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+subindex of all indices:
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset CommandInset index_print
+LatexCommand printsubindex*
+
+\end_inset
+
+
\end_layout
\begin_layout Standard
end_inset(os);
}
- else if (t.cs() == "printindex") {
+ else if (t.cs() == "printindex" || t.cs() == "printsubindex") {
context.check_layout(os);
- begin_command_inset(os, "index_print", "printindex");
- os << "type \"idx\"\n";
+ string commandname = t.cs();
+ bool star = false;
+ if (p.next_token().asInput() == "*") {
+ commandname += "*";
+ star = true;
+ p.get_token();
+ }
+ begin_command_inset(os, "index_print", commandname);
+ string const indexname = p.getArg('[', ']');
+ if (!star) {
+ if (indexname.empty())
+ os << "type \"idx\"\n";
+ else
+ os << "type \"" << indexname << "\"\n";
+ }
end_inset(os);
skip_spaces_braces(p);
preamble.registerAutomaticallyLoadedPackage("makeidx");