为什么首字母缩略词会出现在词汇表下?

为什么首字母缩略词会出现在词汇表下?

这是最小工作示例:

% arara: pdflatex: {action: nonstopmode}
% !arara: makeindex
% arara: bibtex
% arara: makeglossaries
% arara: pdflatex: {action: nonstopmode}
% arara: pdflatex: {action: nonstopmode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt]{article}
\usepackage[slovak,english]{babel}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HEADER AND FOOTER
\usepackage{fancyhdr}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% THIS SHOULD BE DEFINED BEFORE glossaries
% COMPILATION ERROR IF THOSE TWO LINES ARE SWAPPED
\usepackage[bookmarks]{hyperref}
\usepackage{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WORKING
\usepackage[acronym]{glossaries}

% DOES NOT WORKING:
% Package glossaries Error: Glossary type `acronym' has not been defined. }
% \usepackage{glossaries}

% Unknown option `intoc' for package `glossaries'. \RequirePackage
% \usepackage[intoc]{glossaries}

% Package glossaries Error: Glossary type `acronym' has not been defined. }
% \usepackage[toc]{glossaries}
\makeglossaries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USING PICTURES
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WHAT DOES THIS DO ???
\usepackage{titling}
\usepackage{makeidx}
\makeindex
\usepackage[margin=2.5cm]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SETTING HEADER AND FOOTER
\pagestyle{fancy}
\lhead{LHEAD}
\rhead{RHEAD}
\renewcommand{\footrulewidth}{0.4pt}% default is 0pt
\cfoot{\thepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{setspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[sort&compress,numbers,square,comma,numbers]{natbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TABLE OF CONTENT
\usepackage[nottoc,notlot,notlof]{tocbibind}
\settocbibname{References}
%%%%%%%%%%%%%%%%%%%%
% DOES NOT WORK: CONTENTS NAME REMAINS "Contents" INSTEAD OF "Table of Contents"
\settocname{Table of Contents}
%%%%%%%%%%%%%%%%%%%%
% DOES NOT WORK: INITIAL NUMBER BELLOW FOOTER REMAINS ALWAYS THE SAME (NUMBER OF PAGES BEFORE PARTICULAR SHEET - 1)
\setcounter{page}{10}
\setcounter{secnumdepth}{10}
%%%%%%%%%%%%%%%%%%%%
% SET MAX CONTENTS DEPTH
\setcounter{tocdepth}{5}
%%%%%%%%%%%%%%%%%%%%
\DeclareRobustCommand{\citefull}[1]{\citeauthor{#1}~(\citeyear{#1})~\cite{#1}}
\DeclareRobustCommand{\citefulle}[1]{[\citeauthor{#1}~(\citeyear{#1})~\cite{#1}]}
\DeclareRobustCommand{\citebegin}[1]{In \citeyear{#1} \citeauthor{#1}}
\DeclareRobustCommand{\citeaccord}[1]{According to \citeyear{#1} \citeauthor{#1}}
%%%%%%%%%%%%%%%%%%%%
\begin{document}
  \input{glossary.tex}
  \input{acronyms.tex}

  \thispagestyle{empty}
  \begin{titlepage}
    \centering
    {\scshape\LARGE University\\
                    Faculty\par}
    \vspace{5cm}
    {\huge\bfseries Thesis Name\par}
    \vspace{1.0cm}
    {\scshape\Large Thesis submitted for the degree of\\
                    Academic Degree\par}
    \vspace{2cm}
    {\Large\itshape Author\par}
    \vfill
    supervised by\par
    ~Supervisor
    \vfill
    {\large \today\par}
  \end{titlepage}
  \pagebreak
%%%%%%%%%%%%%%%%%%%%
  \thispagestyle{empty}
  \begin{doublespace}
    \cleardoublepage
    \phantomsection
    \addcontentsline{toc}{part}{Abstract}
    \selectlanguage{slovak}
    \input{abstract_svk.tex}
    \pagebreak
%%%%%%%%%%%%%%%%%%%%
    \thispagestyle{empty}
    \selectlanguage{english}
    \input{abstract_eng.tex}
    \pagebreak
%%%%%%%%%%%%%%%%%%%%
    \thispagestyle{empty}
    \renewcommand{\abstractname}{Acknowledgements}
    \begin{abstract}
      Graditude
    \end{abstract}
    \pagebreak
  \end{doublespace}
%%%%%%%%%%%%%%%%%%%%
% TABLE OF CONTENT
  \thispagestyle{empty}  
  \tableofcontents
  \pagebreak
%%%%%%%%%%%%%%%%%%%%
% LIST OF FIGURES
  \thispagestyle{empty}
  \listoffigures
  \pagebreak
%%%%%%%%%%%%%%%%%%%%
% ACRONYMS
  \thispagestyle{empty}
  \printglossary[type=\acronymtype]
  \newpage
% GLOSSARY
  \thispagestyle{empty}
  \printglossary[type=main]
  \newpage
%%%%%%%%%%%%%%%%%%%%
  \begin{doublespace}
    % This returns: "First use Coordinated Universal Time (UTC) subsequent UTC"
    First use \gls{utc} subsequent \gls{utc}

    % This returns: "First use Application Programming Interface (API) subsequent API"
    % In this example https://tex.stackexchange.com/questions/8946/how-to-combine-acronym-and-glossary there is also refernce from Acronyms to Glossary
    First use \gls{api} subsequent \gls{api}

    % Why this one appears in Glossary instead of Acronyms?
    % Why this one is shown in Glossary as "Intrusion detection and prevention systems" instead of "Intrusion Detection and Prevention Systems" (case difference)?
    % Why this returns: "First use IDPS subsequent IDPS" instead of "First use Intrusion Detection and Prevention Systems (IDPS) subsequent IDPS" ?
    First use \gls{idps} subsequent \gls{idps}

    \input{1.tex}
    \pagebreak

    \input{2.tex}
    \pagebreak

    \input{3.tex}
    \pagebreak

  \end{doublespace}
  \pagebreak
%%%%%%%%%%%%%%%%%%%%
  \bibliographystyle{unsrtnat}
  \bibliography{mendeley-13-01-29}
\end{document}

这是 glossary.tex:

\newglossaryentry{apig}{
        name={API},
        description={An Application Programming Interface (API) is a
                    particular set
                    of rules and specifications that a software program can
                    follow to access and make use of the services and
                    resources provided by another particular software
                    program that implements that API}
    }

这是 acronyms.tex:

\newacronym{utc}{UTC}{Coordinated Universal Time}


\newglossaryentry{api}{
        type=\acronymtype,
        name={API},
        description={Application Programming Interface},
        first={Application Programming Interface (API)\glsadd{apig}},
        see=[Glossary:]{apig}
        }

\newglossaryentry{idps}{
        type=\acronymtype,
        name={IDPS},
        description={Intrusion Detection and Prevention Systems},
        first={Intrusion Detection and Prevention Systems (IDPS)}
        }

如您所见,我正在使用 arara 进行编译。我的目标是在文档中同时包含首字母缩略词和词汇表。问题:

  1. 关于这一行:First use \gls{idps} subsequent \gls{idps} 为什么这一行出现在词汇表中而不是首字母缩略词中?为什么这一行(在词汇表中)显示为“入侵检测和预防系统”而不是“入侵检测和预防系统”(大小写不同)?为什么返回:“首先使用 IDPS 随后使用 IDPS”而不是“首先使用入侵检测和预防系统 (IDPS) 随后使用 IDPS”,就像第二和第三个问题中那样?

  2. 关于这一行:First use \gls{api} subsequent \gls{api}关于例如,从首字母缩略词到词汇表也有引用,为什么它在我的例子中不起作用?

  3. 关于这一行:First use \gls{utc} subsequent \gls{utc}我应该使用\newacronymovernewglossaryentry吗?

  4. 我怎样才能在目录中同时包含首字母缩略词和词汇表?我尝试了几种方法(请参阅代码中的注释),但都没有用。

非常感谢

答案1

这是一个最小示例,它在最小包装器中使用了您的首字母缩略词和词汇表定义。两者都添加到内容中,交叉引用似乎工作正常。

词汇表和缩略词

\documentclass{article}
\usepackage[acronym,toc]{glossaries}
\makeglossaries
\newglossaryentry{apig}{
  name={API},
  description={An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API}
}
\newacronym{utc}{UTC}{Coordinated Universal Time}
\newglossaryentry{api}{
  type=\acronymtype,
  name={API},
  description={Application Programming Interface},
  first={Application Programming Interface (API)\glsadd{apig}},
  see=[Glossary:]{apig}
}
\newglossaryentry{idps}{
  type=\acronymtype,
  name={IDPS},
  description={Intrusion Detection and Prevention Systems},
  first={Intrusion Detection and Prevention Systems (IDPS)}
}
\begin{document}

  \tableofcontents

  \section{First}

  \gls{utc}

  \gls{idps}

  \gls{api}

  \section{Subsequent}

  \gls{utc}

  \gls{idps}

  \gls{api}

\printglossary
\printacronyms

\end{document}

相关内容