重新定义LyX中的\ nomencl_command

时间:2014-04-08 10:03:22

标签: lyx glossaries

我正在尝试重新定义LyX中的\nomencl_command,以便能够使用glossaries包而不是过时的nomencl

LyX允许您指定Nomenclature command,默认设置为:{/ p>

makeindex -s nomencl.ist

对于词汇表,命令因此更改为:

makeglossaries

但是,nomencl的LyX实现使用更新的.nlo作为输入文件,.nls作为输出文件。词汇表使用的是“年龄较大”的词汇表。 .glo.gls遗憾的是,无法指定扩展名。

我发现首选项文件只说:

\nomencl_command "makeglossaries"

但日志输出显示:

makeglossaries "[filename].nlo" -o [filename].nls

所以我的问题是\nomencl_command在哪里进一步定义?

1 个答案:

答案 0 :(得分:3)

相关代码位于src/LaTeX.cpp。 请注意,某些诊断信息将写入latex调试标志。如果您使用lyx -dbg latex运行LyX,则可以在终端上看到此信息。

以下是来自即将发布(几天)LyX 2.1的文件src/LaTeX.cpp的摘录。

FileName const nlofile(changeExtension(file.absFileName(), ".nlo"));
// If all nomencl entries are removed, nomencl writes an empty nlo file.
// DepTable::hasChanged() returns false in this case, since it does not
// distinguish empty files from non-existing files. This is why we need
// the extra checks here (to trigger a rerun). Cf. discussions in #8905.
// FIXME: Sort out the real problem in DepTable.
if (head.haschanged(nlofile) || (nlofile.exists() && nlofile.isFileEmpty()))
    rerun |= runMakeIndexNomencl(file, ".nlo", ".nls");
FileName const glofile(changeExtension(file.absFileName(), ".glo"));
if (head.haschanged(glofile))
    rerun |= runMakeIndexNomencl(file, ".glo", ".gls");

bool LaTeX::runMakeIndexNomencl(FileName const & file,
        string const & nlo, string const & nls)
{
    LYXERR(Debug::LATEX, "Running MakeIndex for nomencl.");
    message(_("Running MakeIndex for nomencl."));
    string tmp = lyxrc.nomencl_command + ' ';
    // onlyFileName() is needed for cygwin
    tmp += quoteName(onlyFileName(changeExtension(file.absFileName(), nlo)));
    tmp += " -o "
        + onlyFileName(changeExtension(file.toFilesystemEncoding(), nls));
    Systemcall one;
    one.startscript(Systemcall::Wait, tmp, path);
    return true;
}

// nomencl file
FileName const nls(changeExtension(file.absFileName(), ".nls"));
nls.removeFile();

// nomencl file (old version of the package)
FileName const gls(changeExtension(file.absFileName(), ".gls"));
gls.removeFile();