Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

附录中的术语表 (glossaries) 导致参考文献编号均为 0 #902

Open
ekaradon-Alexander opened this issue Sep 20, 2023 · 1 comment
Labels

Comments

@ekaradon-Alexander
Copy link

编译环境

编译的系统:overleaf
TeX 发行版:TeX Live 2023
模板版本:v7.4.0
模板类型:doctor(使用缺省值)

p.s. 在 macOS 13.5.2 上使用 latexmk 编译也存在此问题,并且下面的「其它尝试」对于 latexmk 也适用。

描述问题

截图:
image

image

复现上述问题的代码:

\documentclass{thuthesis}

\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\usepackage{hyperref}
\usepackage{glossaries}

\usepackage[style=thuthesis-numeric]{biblatex} 
% \usepackage[style=thuthesis-author-year]{biblatex} 


\begin{filecontents}{ref.bib}
@book{newton1687,
    author =    {Isaac Newton},
    title =     {The Mathematical Principles of Natural Philosophy},
    year =      {1687},
}
\end{filecontents}
\addbibresource{ref.bib}

\makeglossaries
\newglossaryentry{牛顿运动定律}
{
    name        = {牛顿运动定律},
    description = {Newton's laws of motion},
}

\begin{document}

\maketitle

\mainmatter
\chapter{引言}

牛顿~\cite{newton1687} 于 1687 发表了著名的\gls{牛顿运动定律}。

\printbibliography

\appendix
\printglossary

\end{document}

其它尝试

首先使用 \usepackage[style=thuthesis-author-year]{biblatex} 编译一次,再使用 \usepackage[style=thuthesis-numeric]{biblatex} 编译一次,可以得到正确的参考文献编号。

@zepinglee
Copy link
Contributor

我能复现这个问题。

主要原因是在于 defernumbers 选项,这是为了实现 #837 的功能,但目前还没搞懂为何跟 glossaries 不兼容。感觉需要分析底层命令,比较复杂。

\PassOptionsToPackage{defernumbers = true}{biblatex}

如果你的附录中没有引用的话,可以先注释掉这一行。

p.s. 在 macOS 13.5.2 上使用 latexmk 编译也存在此问题

另外提一下,在本地使用 latexmk 编译需要修改配置文件。

$makeindex = "makeindex -s gind.ist %O -o %D %S";

这里是为了编译文档(.dtx)设置的,需要替换为示例 texmf-dist/doc/support/latexmk/example_rcfiles/glossaries_latexmkrc 的配置。

add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
$clean_ext .= " acr acn alg glo gls glg";

sub makeglossaries {
    my ($base_name, $path) = fileparse( $_[0] );
    my @args = ( "-q", "-d", $path, $base_name );
    if ($silent) { unshift @args, "-q"; }
    return system "makeglossaries", "-d", $path, $base_name;
}

@zepinglee zepinglee added the bug label Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants