【问题标题】:redefine \nomencl_command in LyX在 LyX 中重新定义 \nomencl_command
【发布时间】:2014-04-08 10:03:21
【问题描述】:

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

LyX 允许您指定Nomenclature command,默认设置为:

makeindex -s nomencl.ist

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

makeglossaries

但是,nomencl 的 LyX 实现使用更新的 .nlo 作为输入文件,.nls 作为输出文件。而词汇表使用“旧”.glo.gls 不幸的是,无法指定扩展名。

我发现首选项文件只说:

\nomencl_command "makeglossaries"

但日志输出显示:

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

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

【问题讨论】:

  • 您可能想尝试在 tex.stackexchange.com 上发帖
  • 我熟悉 tex.stackexchange.com,但由于它涉及重新定义 LyX 程序命令,而不是 tex 命令,我认为 stackoverflow 会更适合

标签: lyx glossaries


【解决方案1】:

相关代码在src/LaTeX.cpp。 请注意下面的一些诊断信息被写入乳胶调试标志。如果您使用 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();

【讨论】:

  • 非常感谢,我正在运行 2.1 版本,所以这是完美的。知道应该如何重新定义吗?
  • @bquast 我没有。希望有人通过lyx-devel回复您的电子邮件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-02
  • 1970-01-01
  • 1970-01-01
  • 2011-04-06
  • 1970-01-01
相关资源
最近更新 更多