当我用 Overleaf 处理 LaTex 文档时,我发现了这个错误:
<to be read again>
\let
l.21 ...entrycounter[]{page}\glsnumberformat{18}}}
%
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
! Missing } inserted.
<inserted text>
}
l.21 ...entrycounter[]{page}\glsnumberformat{18}}}
%
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
问题是,它说错误是{
一个名为的文件中缺少output.gls
。据我所知,这是一个由词汇表自动生成的文件,它不应该只是缺少{
。所以问题不可能出在那个文件上,而一定是出在我的代码上。我试图通过注释掉自上一个工作版本以来我编写的代码部分来解决这个问题,我确实找到了哪一行导致了它,但我不明白为什么:
\newglossaryentry{density}
{
name=\ensuremath{\kappa},
description={$ \in \mathbb{K}$. Density scalar field over $\Omega$. In practice we parameterize it in terms of \gls{density parameter}
}
}
\newglossaryentry{density parameter}
{
name=\ensuremath{\alpha},
description={$\in [0,1]^F$.% Parameter used to describe \gls{density}
}
}
问题源于In practice we parameterize it in terms of \gls{density parameter}
,如果我注释掉这句话,错误就会消失。我尝试制作一个最小工作示例,但正如下面的评论指出的那样,错误与此无关。示例是:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[nonumberlist]{glossaries}
\usepackage{amsmath,amssymb}
\title{Test}
\date{September 2021}
\makeglossaries
\newglossaryentry{density}
{
name=\ensuremath{\kappa},
description={$ \in \mathbb{K}$. Density scalar field over $\Omega$. In practice we parameterize it in terms of \gls{density parameter}
}
}
\newglossaryentry{density parameter}
{
name=\ensuremath{\alpha},
description={$\in [0,1]^F$. Parameter used to describe \gls{density}
}
}
\begin{document}
\maketitle
\section{Minimal Example}
Calling \gls{density} is causing an error.
But only calling \gls{density parameter} does not.
Commenting out the description of the $\kappa$ after ``In practice...'' fixes the error as well.
\printglossaries
\end{document}
因此,虽然我可以注释掉该部分描述,但对我来说显然我只是误解了词汇表的工作方式,并想问我犯了什么错误。