Provides makeidx 1
Provides framed 1
Provides subscript 1
+# Memoir has its own implementation
+Provides memoir-idx 1
# Geometry is supported, but the package options and paper sizes
# are ignored
Provides geometry-light 1
runparams.use_hyperref = features.isRequired("hyperref")
|| features.isProvided("hyperref");
runparams.use_CJK = features.mustProvide("CJK");
+ runparams.use_memindex = features.isProvided("memoir-idx");
}
LYXERR(Debug::OUTFILE, " Buffer validation done.");
runparams.use_babel = features.useBabel();
runparams.use_hyperref = features.isRequired("hyperref")
|| features.isProvided("hyperref");
+ runparams.use_memindex = features.isProvided("memoir-idx");
// latex or literate
otexstream ots(os);
// output above
// Additional Indices
if (features.isRequired("splitidx")) {
for (auto const & idx : indiceslist()) {
- os << "\\newindex{";
+ if (features.isProvided("memoir-idx")) {
+ if (idx.shortcut() == "idx")
+ continue;
+ os << "\\makeindex[";
+ } else
+ os << "\\newindex{";
os << escape(idx.shortcut());
- os << "}\n";
+ if (features.isProvided("memoir-idx"))
+ os << "]\n";
+ else
+ os << "}\n";
}
}
#include "Format.h"
#include "InsetList.h"
#include "Language.h"
+#include "LaTeXFeatures.h"
#include "LaTeX.h"
#include "LyXRC.h"
#include "Mover.h"
"tmpfile.out"));
}
+ if (buffer && buffer->params().use_indices && conv.latex()) {
+ // We need to validate the buffer to get access to features.
+ // FIXME Not nice that we need to do this here.
+ LYXERR(Debug::OUTFILE, " Validating buffer...");
+ LaTeXFeatures features(*buffer, buffer->params(), runparams);
+ buffer->validate(features);
+ runparams.use_memindex = features.isProvided("memoir-idx");
+ }
+
if (buffer && buffer->params().use_minted
&& lyxrc.pygmentize_command.empty() && conv.latex()) {
bool dowarn = false;
#include "Buffer.h"
#include "BufferList.h"
#include "BufferParams.h"
+#include "IndicesList.h"
#include "LyXRC.h"
#include "LyX.h"
#include "DepTable.h"
iscanres = scanIlgFile(terr);
rerun = true;
}
+ // This is Memoir's multi-index idiosyncracy
+ if (runparams.use_indices && runparams.use_memindex) {
+ Buffer const * buf = theBufferList().getBufferFromTmp(file.absFileName());
+ if (buf) {
+ IndicesList const & indiceslist = buf->params().indiceslist();
+ if (!indiceslist.empty()) {
+ IndicesList::const_iterator it = indiceslist.begin();
+ IndicesList::const_iterator const end = indiceslist.end();
+ for (; it != end; ++it) {
+ docstring const & ci = it->shortcut();
+ if (ci == "idx")
+ continue;
+ FileName const aidxfile(to_utf8(ci + ".idx"));
+ LYXERR(Debug::OUTFILE, "Running Index Processor for " << ci);
+ message(_("Running Index Processor."));
+ // onlyFileName() is needed for cygwin
+ int const ret =
+ runMakeIndex(onlyFileName(aidxfile.absFileName()), runparams);
+ if (ret == Systemcall::KILLED || ret == Systemcall::TIMEOUT)
+ return ret;
+ else if (ret != Systemcall::OK) {
+ iscanres |= INDEX_ERROR;
+ terr.insertError(0,
+ _("Index Processor Error"),
+ _("The index processor did not run successfully. "
+ "Please check the output of View > Messages Pane!"));
+ }
+ FileName const ailgfile(changeExtension(aidxfile.absFileName(), ".ilg"));
+ if (ailgfile.exists())
+ iscanres = scanIlgFile(terr, ailgfile);
+ rerun = true;
+ }
+ }
+ }
+ }
if (run_nomencl) {
int const ret = runMakeIndexNomencl(file, ".nlo", ".nls");
if (ret == Systemcall::KILLED || ret == Systemcall::TIMEOUT)
tmp = subst(tmp, "$$lang", doc_lang->babel());
tmp = subst(tmp, "$$lcode", doc_lang->code());
}
- if (rp.use_indices) {
+ if (rp.use_indices && !rp.use_memindex) {
tmp = lyxrc.splitindex_command + " -m " + quoteName(tmp);
LYXERR(Debug::OUTFILE,
"Multiple indices. Using splitindex command: " << tmp);
}
-int LaTeX::scanIlgFile(TeXErrors & terr)
+int LaTeX::scanIlgFile(TeXErrors & terr, FileName const fn)
{
- FileName const ilg_file(changeExtension(file.absFileName(), "ilg"));
+ FileName const ilg_file = fn.empty()
+ ? FileName(changeExtension(file.absFileName(), "ilg"))
+ : fn;
LYXERR(Debug::OUTFILE, "Scanning ilg file: " << ilg_file);
ifstream ifs(ilg_file.toFilesystemEncoding().c_str());
int scanBlgFile(DepTable & head, TeXErrors & terr);
///
- int scanIlgFile(TeXErrors & terr);
+ int scanIlgFile(TeXErrors & terr, support::FileName const fn = support::FileName());
///
bool runBibTeX(std::vector<AuxInfo> const &,
if (isRequired("makeidx") || isRequired("splitidx")) {
if (!isProvided("makeidx") && !isRequired("splitidx"))
packages << "\\usepackage{makeidx}\n";
- if (mustProvide("splitidx"))
+ if (mustProvide("splitidx") && !isProvided("memoir-idx"))
packages << "\\usepackage{splitidx}\n";
packages << "\\makeindex\n";
}
*/
bool use_indices = false;
+ /** Are we using the memoir way to
+ * to multiple indices?
+ */
+ bool use_memindex = false;
+
/** Are we using japanese (pLaTeX)?
*/
bool use_japanese = false;
if (buffer().masterBuffer()->params().use_indices && !params_.index.empty()
&& params_.index != "idx") {
- os << "\\sindex[";
+ if (runparams.use_memindex)
+ os << "\\index[";
+ else
+ os << "\\sindex[";
os << escape(params_.index);
os << "]{";
} else {
return;
}
OutputParams runparams = runparams_in;
- os << getCommand(runparams);
+ if (runparams.use_memindex) {
+ if (getParam("type") == from_ascii("idx"))
+ os << "\\printindex" << termcmd;
+ else {
+ os << "\\begingroup" << breakln;
+ os << "\\renewcommand{\\indexname}{" << getParam("name") << "}" << breakln;
+ os << "\\printindex[" << getParam("type") << "]" << breakln;
+ os << "\\endgroup" << breakln;
+ }
+ } else
+ os << getCommand(runparams);
}