关于符号列表

关于符号列表

我正在 overleaf 中输入此代码,但没有得到符号列表。

\documentclass{article}
\usepackage{bm}
\usepackage[toc,symbols]{glossaries}

\newglossaryentry{mass}{%
name={\ensuremath{m}},
description={The mass of the object},
type=symbols
}

\newglossaryentry{disp}{%
name={\ensuremath{\bm\lambda}},
description={The absolute displacement},
type=symbols
}


\makeglossaries


\begin{document}
\section{Normal section}
The \gls{mass} of the Sun can be determined by the centripetal force 
being given by the gravitional force and the orbiting period of    
the Earth. 

The \gls{disp} can not be used alone for determing the solar mass. 



\appendix
\printglossary[numberedsection,type=symbols,style=list,nogroupskip]

\end{document}

通过这篇文章我应该得到符号列表。

答案1

要工作,必须调用glossaries脚本。Overleaf 使用文件中定义的规则来检测要调用哪些脚本,并使用默认文件makeglossarieslatexmkrc给出当您的项目中没有这样的文件时。根据这些默认规则,在第一次运行 PDFLaTeX 后存在makeglossaries或文件时会调用.glo。但是,对于这种特定情况,我们希望在文件上运行以生成文件*。因此,您只需将其添加到规则中:.acnmakeglossaries.slo.sls

add_cus_dep('slo', 'sls', 0, 'makeglossaries');

编辑:*实际上,我们应该有一条规则来检测.aux文件是否包含@istfilename{...}以确定是否makeglossaries需要。然而,这不是工作方式latexmk


总结
将以下文件添加到你的 Overleaf 项目并调用它latexmkrc

# support for the glossaries package:
add_cus_dep('glo', 'gls', 0, 'makeglossaries');
add_cus_dep('acn', 'acr', 0, 'makeglossaries');
add_cus_dep('slo', 'sls', 0, 'makeglossaries');
sub makeglossaries {
  system("makeglossaries $_[0]");
}

# support for the nomencl package:
add_cus_dep('nlo', 'nls', 0, 'makenlo2nls');
sub makenlo2nls {
  system("makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"");
}

# from the documentation for V. 2.03 of asymptote:
sub asy {return system("asy \"$_[0]\"");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");

# metapost rule from http://tex.stackexchange.com/questions/37134
add_cus_dep('mp', '1', 0, 'mpost');
sub mpost {
  my $file = $_[0];
  my ($name, $path) = fileparse($file);
  pushd($path);
  my $return = system "mpost $name";
  popd();
  return $return;
}

在此处输入图片描述

相关内容