只能在序言中使用,\makeglossaries 命令

只能在序言中使用,\makeglossaries 命令

我遇到了以下错误

! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.3 (Remove \makeglossaries
                            if you don't want any glossaries.)
? 

当然我需要一个词汇表,我知道我必须提前\makeglossaries打电话\begin{document}

这是我的主要乳胶文档:

\documentclass[12pt]{report}
\usepackage{morewrites}

\usepackage{libertine}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{eurosym}

\usepackage[linktocpage,pdfpagelabels]{hyperref}

\usepackage{graphicx}
\usepackage{caption}
\usepackage{wrapfig}
\usepackage[export]{adjustbox}
\usepackage{float}
\usepackage[clean,pdf,svgpath=../GraphiquesUML/]{svg}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}

\usepackage{array}
\usepackage{longtable}

\usepackage{authoraftertitle}

\usepackage{glossaries}
\makeglossaries
\loadglsentries{glossaires}

\usepackage{listings}
\lstset{
    language=C,
    breaklines=true,
    basicstyle=\ttfamily\small
}

\usepackage{geometry}
\geometry{
    %showframe,
    a4paper,
    body={160mm,245mm},
    left=25mm,top=25mm,
    headheight=10mm,headsep=5mm,
    footskip=10mm,
    marginparsep=0mm,
    marginparwidth=0mm
}

% Numérotation des paragraphes
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

% Début du document
\begin{document}

\clearpage

% Table des matières
\tableofcontents{}

\printglossaries

\listoffigures

\end{document}

chapter_introduction.tex我在文件内的\printglossaries某处找到了该命令。

我的glossaires.tex文件包含这个命令:

\newglossaryentry{SaE}{
    name=SaE,
    description={Système à l'étude}
}

我不明白为什么 pdflatex 会抱怨该\makeglossaries命令。我应该移动它吗,或者是否存在包冲突?

感谢您的帮助

-- 编辑 -- 词汇表包在日志中生成此警告:

/home/.../specification.lof:
    1  
    2: Package glossaries Warning: No \printglossary or \printglossaries found.
    3: (Remove \makeglossaries if you don't want any glossaries.)
    4  This document will not have a glossary.
    5  

答案1

缺失glossary是由于缺少\gls{...}\glsaddall语句。因此,glossaries不会打印任何内容。

\documentclass[12pt]{report}
\usepackage{morewrites}

\usepackage{libertine}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{eurosym}


\usepackage{graphicx}
\usepackage{caption}
\usepackage{wrapfig}
\usepackage[export]{adjustbox}
\usepackage{float}
\usepackage[clean,pdf,svgpath=../GraphiquesUML/]{svg}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}

\usepackage{array}
\usepackage{longtable}

\usepackage{authoraftertitle}

\usepackage[linktocpage,pdfpagelabels]{hyperref}

\usepackage{glossaries}
\makeglossaries
\loadglsentries{glossaires}

\usepackage{listings}
\lstset{
    language=C,
    breaklines=true,
    basicstyle=\ttfamily\small
}

\usepackage{geometry}
\geometry{
    %showframe,
    a4paper,
    body={160mm,245mm},
    left=25mm,top=25mm,
    headheight=10mm,headsep=5mm,
    footskip=10mm,
    marginparsep=0mm,
    marginparwidth=0mm
}

% Numérotation des paragraphes
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

% Début du document
\begin{document}

\clearpage

\gls{SaE}

% Table des matières
\tableofcontents{}

\printglossaries

\listoffigures

\end{document}

相关内容