我是 Latex 的新手,正在努力使我的首字母缩略词列表同时显示在页面和目录中。以下是代码片段:
\documentclass[a4paper,12pt,oneside]{book}
\usepackage[toc,acronym]{glossaries} % to
\makeglossaries
\newacronym{cnn}{CNN}{Convolutional Neural Network}
% .... other acronyms
%---- Document -----
\title{Thesis Title}
\author{Name Surname}
\date{Day Month Year}
\begin{document}
% hacking the header
\pagestyle{fancy}
\makeatletter
\renewcommand\chaptermark[1]{%
\markboth{\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@chapapp\ \thechapter. \ %
\fi
\fi
#1}}{}%
}
\renewcommand\@mkboth[2]{\markboth{#1}{}}
\makeatother
%% include frontispieces and chapters
\includepdf[pages={1}]{./frontispiece/frontA4.pdf}
% If you are italian, please consider to create a "frontA4ita" version of the frontispiece and add it
after the english one.
\setcounter{page}{1}
\frontmatter
\afterpage{\null\thispagestyle{empty}\clearpage}
\input{0a_abstract.tex}
\afterpage{\null\thispagestyle{empty}\clearpage}
\input{0a_sommario.tex} % italian abstract
\afterpage{\null\thispagestyle{empty}\clearpage}
\input{0b_acknowledgments.tex}
\afterpage{\null\thispagestyle{empty}\clearpage}
\tableofcontents
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures} % this command adds the "List of Figures" page to the
table of content as if it was a chapter.
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\glsaddall %after the list of tables I want to put the acronyms list
\printglossary[type=\acronymtype]
\afterpage{\null\thispagestyle{empty}\clearpage}
\input{0c_introduction.tex}
\mainmatter
\input{1_sota.tex}
\input{2_background.tex}
\input{3_methodology.tex}
\input{4_results.tex}
\input{5_conclusions.tex}
%% print the bibliography
%\nocite{*}
\bibliographystyle{ieeetr} % IEEE has its own bibliography style. Bibtex is the baseline bibliography engine, you can use also biber to gain control on the layout.
\bibliography{bibliography.bib}
\end{document}
例如,如果我在其中一个文件中写入“\gls{cnn}”,缩写会显示出来,但目录中的列表或页面却不会显示...有什么想法吗?我做错了什么?
答案1
编译两次,运行makeglossaries.exe
文件并再次编译两次。
使用 TeXstudio,您可以makeglossaries.exe
按运行[F9]
。或者从目录中的命令窗口中 main.tex
执行makeglossaries main
(不带文件扩展名)
\documentclass[a4paper,12pt,oneside]{book}
\usepackage[toc,acronym]{glossaries} % to
\makeglossaries
\newacronym{cnn}{CNN}{Convolutional Neural Network}
% .... other acronyms
%---- Document -----
\title{Thesis Title}
\author{Name Surname}
\date{Day Month Year}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures} % this command adds the "List of Figures" page to the
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\glsaddall %after the list of tables I want to put the acronyms list
\printglossary[type=\acronymtype]
\mainmatter
\chapter{1sota}
\gls{cnn}
\end{document}