多个词汇表的样式问题

多个词汇表的样式问题

我正在处理一个非常大的文档,我想使用带有 bib2gls 的 glossaries-extra 包创建词汇表、缩写/首字母缩略词列表和索引。为了有一个更实际的例子,假设我有下一个文档.tex

\documentclass{article}
\usepackage{amsmath}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{cleveref}
\usepackage[
    stylemods={all},
    record,
    index,
    abbreviations,
    nohypertypes={index}
    ]{glossaries-extra}


\begin{filecontents}{glossary.bib}
    % Encoding: UTF-8
    @entry{duck,
        name = {duck},
        description = {a waterbird with webbed feet}
    }

    @entry{parrot,
        name = {parrot},
        description = {mainly tropical bird with bright plumage}
    }

    @entry{dummy,
        name={dummy},
        description={person who is stupid}
    }

    @entry{abnormal,
        name={abnormal},
        description={not normal}
    }

    @entry{zebra,
        name={zebra},
        description={a horse with black and white stripes}
    }
    @abbreviation{sra,
        short = {SRA},
        long = {Some Random Abbreviation}
    }

    @abbreviation{ttl,
        short = {TTL},
        long = {Time To Live}
    }

    @abbreviation{html,
        short={html},
        long={hypertext markup language}
    }

    @abbreviation{xml,
        short={xml},
        long={extensible markup language}
    }

    @abbreviation{svm,
        short={SVM},
        long={support vector machine}
    }

    @index{goose,
        plural={geese}
    }

    @index{cat,
        plural={cats}
    }

    @index{carrot,
        plural={carrots}
    }

    @index{dog,
        plural={dogs}
    }

    @index{giraffe,
        plural={giraffes}
    }

    @index{rat,
        plural={rats}
    }
\end{filecontents}

\GlsXtrLoadResources[
    src={glossary},% data in glossary.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={entry}},% only select@entry
    type={main}% put these entries in the 'main' glossary
]

\GlsXtrLoadResources[
    src={glossary},% data in abbreviations.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={abbreviation}},% only select@abbreviation
    type={abbreviations},% put these in the 'abbreviations' glossary
    save-locations=false
]

\GlsXtrLoadResources[
src={glossary},% data in index.bib
sort={en-US},% sort according to 'en-US' locale
match={entrytype={index}},% only select@index
type={index}% put these in the 'index' glossary
]

\begin{document}

    A \gls{duck} and a \gls{parrot}. Lots of \glspl{duck}. \Gls{dummy}, \gls{abnormal} and \gls{zebra}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm} and \gls{xml}.

    \Gls{cat}, \gls{carrot}, \gls{dog}, \gls{giraffe}, \gls{rat} and \gls{goose}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm},  and \gls{xml}.

    \printunsrtglossary[style=altlistgroup]
    \printunsrtglossary[type={abbreviations}]
    \printunsrtglossary[type={index},title=Index,style=bookindex]

\end{document}

它产生下一个输出: 在此处输入图片描述

我有一些问题:

  1. 在主词汇表中,虽然我使用的是altlistgroup 样式,尚未进行分组。
  2. 在主词汇表中,我也希望在描述的末尾有一个点。
  3. 对于缩写,我希望将它们分组(例如这个文件)。另外,我希望文中的缩写链接不要带有颜色。
  4. 在索引中,尽管我使用的是bookindex 样式

我花了很多时间寻找解决方案,但还是没找到。如果能得到任何帮助,我将不胜感激。

答案1

这几乎可行:

\documentclass{article}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage[
    nostyles,
    stylemods={all},
    postdot,
    record,
    index,
    abbreviations,
    nohypertypes={index}
    ]{glossaries-extra}

\setglossarystyle{long-booktabs}

\begin{filecontents}{glossary.bib}
    % Encoding: UTF-8
    @entry{duck,
        name = {duck},
        description = {a waterbird with webbed feet}
    }

    @entry{parrot,
        name = {parrot},
        description = {mainly tropical bird with bright plumage}
    }

    @entry{dummy,
        name={dummy},
        description={person who is stupid}
    }

    @entry{abnormal,
        name={abnormal},
        description={not normal}
    }

    @entry{zebra,
        name={zebra},
        description={a horse with black and white stripes}
    }
    @abbreviation{sra,
        short = {SRA},
        long = {Some Random Abbreviation}
    }

    @abbreviation{ttl,
        short = {TTL},
        long = {Time To Live}
    }

    @abbreviation{html,
        short={html},
        long={hypertext markup language}
    }

    @abbreviation{xml,
        short={xml},
        long={extensible markup language}
    }

    @abbreviation{svm,
        short={SVM},
        long={support vector machine}
    }

    @index{goose,
        plural={geese}
    }

    @index{cat,
        plural={cats}
    }

    @index{carrot,
        plural={carrots}
    }

    @index{dog,
        plural={dogs}
    }

    @index{giraffe,
        plural={giraffes}
    }

    @index{rat,
        plural={rats}
    }
\end{filecontents}

\GlsXtrLoadResources[
    src={glossary},% data in glossary.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={entry}},% only select@entry
    type={main}% put these entries in the 'main' glossary
]

\GlsXtrLoadResources[
    src={glossary},% data in abbreviations.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={abbreviation}},% only select@abbreviation
    type={abbreviations},% put these in the 'abbreviations' glossary
    save-locations=false
]

\GlsXtrLoadResources[
src={glossary},% data in index.bib
sort={en-US},% sort according to 'en-US' locale
match={entrytype={index}},% only select@index
type={index}% put these in the 'index' glossary
]

\begin{document}

    A \gls{duck} and a \gls{parrot}. Lots of \glspl{duck}. \Gls{dummy}, \gls{abnormal} and \gls{zebra}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm} and \gls{xml}.

    \Gls{cat}, \gls{carrot}, \gls{dog}, \gls{giraffe}, \gls{rat} and \gls{goose}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm},  and \gls{xml}.

    \printunsrtglossary[style=altlistgroup]


    \printunsrtglossary[type={abbreviations}]
    \printunsrtglossary[type={index},title=Index,style=bookindex]

\end{document}

您需要什么风格的缩写?

相关内容