在另一个条目中使用词汇表术语

在另一个条目中使用词汇表术语

引用另一个词汇表中的条目可能对我有用,例如

\documentclass[a4paper, 11pt, oneside, brazil]{book}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% \makeglossaries
% http://en.wikibooks.org/wiki/LaTeX/Glossary#Using_defined_terms
\usepackage[xindy,toc]{glossaries}

\begin{document}

\tableofcontents

\printglossary[type=main,style=altlist]

\newglossaryentry{firstterm}{
    name={some first term},
    description={first term description in here},
    first={first version of first term},
    long={long version of first term},
    plural={plural version of first term},
    firstplural={first plural version of first term}
}

\newglossaryentry{secondterm}{
    name={some second term},
    description={second term description in here,
        which could use \gls{firstterm}},
    first={first version of second term},
    long={long version of second term},
    plural={plural version of second term},
    firstplural={first plural version of second term}
}

Then here is the text, where I can refer to my terms
normally, either by \gls{firstterm}, \gls{secondterm},
\gls*{firstterm} or \gls*{secondterm}.

\end{document}

这里的重点是当我(希望我能)做

\newglossaryentry{secondterm}{
    (...)
    description={\gls{firstterm}**},
    (...)
}

没有错误

./main.gls:<someline>: Package glossaries Error: Glossary entry `firstterm' has not been defined. [\glsXpageXglsnumberformat{}{8}}}]

有什么办法吗?

答案1

术语必须在使用前进行定义,由于它们在词汇表中使用,因此需要将定义移到 之前\printglossary。像这样:

\documentclass[a4paper, 11pt, oneside, brazil]{book}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[xindy,toc]{glossaries}

\makeglossaries

\newglossaryentry{firstterm}{
    name={some first term},
    description={first term description in here},
    first={first version of first term},
    long={long version of first term},
    plural={plural version of first term},
    firstplural={first plural version of first term}
}

\newglossaryentry{secondterm}{
    name={some second term},
    description={second term description in here,
        which could use \gls{firstterm}},
    first={first version of second term},
    long={long version of second term},
    plural={plural version of second term},
    firstplural={first plural version of second term}
}

\begin{document}

\tableofcontents

\printglossary[type=main,style=altlist]

Then here is the text, where I can refer to my terms
normally, either by \gls{firstterm}, \gls{secondterm},
\gls*{firstterm} or \gls*{secondterm}.

\end{document}

相关内容