文中未打印缩写词

文中未打印缩写词

当我使用\acrshort或类似词时,我的文本中没有首字母缩略词,而只有()。

这是我的测试代码:

\RequirePackage{filecontents}

\begin{filecontents*}{glossaries-generic.tex}
\newglossaryentry{label-glossary-realnumber}{
  name={real number},
  description={
    include both rational numbers, such as $42$ and $\frac{-23}{129}$, and
    irrational numbers, such as $\pi$ and the square root of two; or, a real
    number can be given by an infinite decimal representation, such as
    $2.4871773339\ldots$ where the digits continue in some way; or, the real
    numbers may be thought of as points on an infinitely long number line
  },
  symbol={\ensuremath{\mathbb{R}}}
}
\end{filecontents*}

\begin{filecontents*}{acronyms-generic.tex}
\newglossaryentry{label-acronym-hbci}{
  type=\acronymtype,
  name={HBCI},
  description={Cascading Style Sheets},
  first={Home Banking Computer Interfaces (HBCI)}
}
\end{filecontents*}

\documentclass[
   final,
   12pt,
   a4paper,
   oneside
]{book}

\usepackage[acronym, nopostdot, toc, xindy]{glossaries}
\makeglossaries %% Add \makeglossaries to your preamble (before you start defining your entries)
\input{glossaries-generic}
\input{acronyms-generic}
%% Glossaries End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
If you just want to print the abbreviation use : \acrshort{label-acronym-hbci}
For glossaries use {\textbackslash}gls like so: \gls{label-glossary-realnumber}

\backmatter
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 BEGIN
%% INFO IN /help/bugfix/printglossaries-bug/*
\def\findrootlanguage{%
   \def\rootlanguagename{\languagename}%
}
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 END

\printglossary[type=\acronymtype, title=Acronyms\, Terms and Abbreviations, toctitle=Acronyms\, Terms and Abbreviations]
\printglossary[style=altlist, title=Glossary, toctitle=Glossary]

\end{document}

答案1

\acrshort旨在与首字母缩略词(用 定义的\newacronym)一起使用,而不是与普通词汇表条目(用 定义的\newglossaryentry)一起使用。

所以你应该定义

\newacronym[first={Home Banking Computer Interfaces (HBCI)}]
    {label-acronym-hbci}{HBCI}{Cascading Style Sheets}

代替

\newglossaryentry{label-acronym-hbci}{
  type=\acronymtype,
  name={HBCI},
  description={Cascading Style Sheets},
  first={Home Banking Computer Interfaces (HBCI)}
}

梅威瑟:

\RequirePackage{filecontents}

\begin{filecontents*}{glossaries-generic.tex}
\newglossaryentry{label-glossary-realnumber}{
  name={real number},
  description={
    include both rational numbers, such as $42$ and $\frac{-23}{129}$, and
    irrational numbers, such as $\pi$ and the square root of two; or, a real
    number can be given by an infinite decimal representation, such as
    $2.4871773339\ldots$ where the digits continue in some way; or, the real
    numbers may be thought of as points on an infinitely long number line
  },
  symbol={\ensuremath{\mathbb{R}}}
}
\end{filecontents*}

\begin{filecontents*}{acronyms-generic.tex}
\newacronym[first={Home Banking Computer Interfaces (HBCI)}]
    {label-acronym-hbci}{HBCI}{Cascading Style Sheets}
\end{filecontents*}

\documentclass[
   final,
   12pt,
   a4paper,
   oneside
]{book}

\usepackage[acronym, nopostdot, toc, xindy]{glossaries}
\makeglossaries %% Add \makeglossaries to your preamble (before you start defining your entries)
\input{glossaries-generic}
\input{acronyms-generic}
%% Glossaries End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
If you just want to print the abbreviation use : \acrshort{label-acronym-hbci}
For glossaries use {\textbackslash}gls like so: \gls{label-glossary-realnumber}

\backmatter
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 BEGIN
%% INFO IN /help/bugfix/printglossaries-bug/*
\def\findrootlanguage{%
   \def\rootlanguagename{\languagename}%
}
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 END

\printglossary[type=\acronymtype, title=Acronyms\, Terms and Abbreviations, toctitle=Acronyms\, Terms and Abbreviations]
\printglossary[style=altlist, title=Glossary, toctitle=Glossary]

\end{document} 

输出:

在此处输入图片描述


如果您不想更改首字母缩略词的定义(通过\newglossaryentry),请使用\glsname而不是\acrshort打印首字母缩略词的名称。

梅威瑟:

\RequirePackage{filecontents}

\begin{filecontents*}{glossaries-generic.tex}
\newglossaryentry{label-glossary-realnumber}{
  name={real number},
  description={
    include both rational numbers, such as $42$ and $\frac{-23}{129}$, and
    irrational numbers, such as $\pi$ and the square root of two; or, a real
    number can be given by an infinite decimal representation, such as
    $2.4871773339\ldots$ where the digits continue in some way; or, the real
    numbers may be thought of as points on an infinitely long number line
  },
  symbol={\ensuremath{\mathbb{R}}}
}
\end{filecontents*}

\begin{filecontents*}{acronyms-generic.tex}
\newglossaryentry{label-acronym-hbci}{
  type=\acronymtype,
  name={HBCI},
  description={Cascading Style Sheets},
  first={Home Banking Computer Interfaces (HBCI)}
}
\end{filecontents*}

\documentclass[
   final,
   12pt,
   a4paper,
   oneside
]{book}

\usepackage[acronym, nopostdot, toc, xindy]{glossaries}
\makeglossaries %% Add \makeglossaries to your preamble (before you start defining your entries)
\input{glossaries-generic}
\input{acronyms-generic}
%% Glossaries End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
If you just want to print the abbreviation use : \glsname{label-acronym-hbci}
For glossaries use {\textbackslash}gls like so: \gls{label-glossary-realnumber}

\backmatter
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 BEGIN
%% INFO IN /help/bugfix/printglossaries-bug/*
\def\findrootlanguage{%
   \def\rootlanguagename{\languagename}%
}
%% debug for http://comments.gmane.org/gmane.comp.tex.live/33611 END

\printglossary[type=\acronymtype, title=Acronyms\, Terms and Abbreviations, toctitle=Acronyms\, Terms and Abbreviations]
\printglossary[style=altlist, title=Glossary, toctitle=Glossary]

\end{document} 

输出与上面相同。


顺便说一句,你可能想写

title={Acronyms, Terms and Abbreviations}

代替

title=Acronyms\, Terms and Abbreviations

要得到

在此处输入图片描述

相关内容