根据首字母缩略词参考生成词汇表

根据首字母缩略词参考生成词汇表

我期望以下代码在缩写列表旁边自动生成词汇表。然而,尽管其中包含对词汇表的引用,但只生成了缩写列表。

\documentclass{report}

\usepackage[
    toc,                % Shows glossary in the table of content
    xindy,              % Used superior indexing tool
    acronym,
    nopostdot,
    nostyles,
    ]{glossaries}

\makeglossaries         % used to generate the glossary

\newglossaryentry{fab region}{
   type        = \acronymtype,
   name        = {fab region},
   description = {fragment antigen-binding region},
   first       = {fragment antigen-binding region (fab region)},
   see         = {[Glossary:]{gls:fab region}}
}

\newglossaryentry{gls:fab region}{
    name= Fab region,
    description={The fragment antigen-binding region binds antigens. It is composed of the antibody's light chains and parts of the heavy chains}
}

\begin{document}

This is a test \gls{fab region}.

\printglossary[type=\acronymtype] % prints just the list of acronyms 
\printglossary

\end{document}

本人整理文件如下:

pdflatex
makeglossaries
pdflatex
pdflatex

如何实现将首字母缩略词列表中的引用添加到词汇表中?

答案1

fab region您只是在文档中引用(索引) 。如果您gls:fab region还想出现在列表中,那么您也需要对其进行索引。例如:

\documentclass{report}

\usepackage[
    toc,                % Shows glossary in the table of content
    xindy,              % Used superior indexing tool
    acronym,
    nopostdot,
    %nostyles
    ]{glossaries}

\makeglossaries         % used to generate the glossary

\newglossaryentry{fab region}{
   type        = \acronymtype,
   name        = {fab region},
   description = {fragment antigen-binding region},
   first       = {fragment antigen-binding region (fab region)},
   see         = [Glossary:]{gls:fab region}
}

\newglossaryentry{gls:fab region}{
    name= Fab region,
    description={The fragment antigen-binding region binds antigens. It is composed of the antibody's light chains and parts of the heavy chains}
}

\begin{document}

This is a test \gls{fab region}\glsadd{gls:fab region}.

\printglossary[type=\acronymtype] % prints just the list of acronyms 
\printglossary

\end{document}

我注释掉了该nostyles选项,因为必须至少定义一种样式,而您没有提供替代方案。如果nostyles存在,日志文件应该会包含一些有关它的警告。

首字母缩略词 fab 区域 片段 抗原结合区 1,词汇表:Fab 区域

术语表 Fab 区 抗原结合区片段,与抗原结合。它由抗体的轻链和重链的部分组成 1

这似乎是不必要的重复。这样做会更简单:

\documentclass{report}

\usepackage[
    toc,                % Shows glossary in the table of content
    xindy,              % Used superior indexing tool
    nopostdot,
    %nostyles
    ]{glossaries}

\makeglossaries         % used to generate the glossary

\setacronymstyle{long-short-desc}

\newacronym[
  description={The fragment antigen-binding region binds antigens. It is composed of the antibody's light chains and parts of the heavy chains}
]{fab region}{fab region}{fragment antigen-binding region}

\begin{document}

This is a test \gls{fab region}.

\printglossary[style=altlist]

\end{document}

第 1 页:

这是测试片段抗原结合区(fab 区域)。

第2页:

术语表 片段抗原结合区 (fab 区) 片段抗原结合区与抗原结合。它由抗体的轻链和重链的部分组成 1

如果你确实需要一个自动索引相关术语的双录入系统,你可能需要考虑使用扩展包glossaries-extrabib2gls(代替xindy)。

例如:

\documentclass{report}

\begin{filecontents*}{entries.bib}
% Encoding: UTF-8

@dualabbreviationentry{fab-region,
  short = {fab region},
  long = {fragment antigen-binding region},
  description={The fragment antigen-binding region binds antigens. It is composed of the antibody's light chains and parts of the heavy chains}
}
\end{filecontents*}

\usepackage[
    record,% use bib2gls
    abbreviations % create 'abbreviations' list
    ]{glossaries-extra}


\setabbreviationstyle{long-short}

\GlsXtrLoadResources[
 src=entries % data in the file entries.bib
]

\begin{document}

This is a test \gls{fab-region}.

\printunsrtglossary[type=abbreviations,title=Acronyms]
\printunsrtglossary

\end{document}

如果调用该文件myDoc.tex则文档构建为:

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc

或者如果你想要将词汇表分成字母组:

pdflatex myDoc
bib2gls -g myDoc
pdflatex myDoc

第 1 页与之前相同。第 2 页:

缩写 fab 区域 片段 抗原结合区 1

第 3 页:

术语表 片段抗原结合区 片段抗原结合区与抗原结合。它由抗体的轻链和重链的部分组成

如果您想要交叉引用:

\documentclass{report}

\begin{filecontents*}{entries.bib}
% Encoding: UTF-8

@dualabbreviationentry{fab-region,
  short = {fab region},
  long = {fragment antigen-binding region},
  description={The fragment antigen-binding region binds antigens. It is composed of the antibody's light chains and parts of the heavy chains}
}
\end{filecontents*}

\usepackage[
    record,% use bib2gls
    abbreviations % create 'abbreviations' list
    ]{glossaries-extra}


\setabbreviationstyle{long-short}

\GlsXtrLoadResources[
 src=entries, % data in the file entries.bib
 dual-field % create a field called 'dual' for cross-referencing
]

\renewcommand{\glsxtrpostdescabbreviation}{%
  \ifglshasfield{dual}{\glscurrententrylabel}
  {%
  .\space
  \emph{Glossary:} \glshyperlink{\glsxtrusefield{\glscurrententrylabel}{dual}}.%
  }%
 {}%
}

\begin{document}

This is a test \gls{fab-region}.

\printunsrtglossary[type=abbreviations,title=Acronyms]
\printunsrtglossary

\end{document}

第 2 页现在如下所示:

缩写 fab 区域 片段 抗原结合区。词汇表:fab 区域。1

这会将引用放在位置列表之前而不是之后(如第一个示例所示)。

相关内容