使用词汇表包中的双语条目

使用词汇表包中的双语条目

我正在用我的母语(斯洛文尼亚语)撰写博士论文。我想创建一个词汇表,其中包含这些术语的斯洛文尼亚语版本及其英语版本。描述将使用斯洛文尼亚语。

我想要实现的目标可以通过一个小例子来最好地证明:

\documentclass{article}

\begin{document}

On its first use, the acronym would look something like: \textit{slovene
translation of the expanded acronym} (angl. \textit{expanded acronym in
english, ACR}), where \textit{ACR} is the english acronym.
On second use, it would look like: ACR.

For ordinary glossary entries, the first occurence would look like:
\textit{slovene translation of the term} (angl. \textit{english term}).
Further occurences would look like: slovene translation of the term.

\vspace*{24pt}

The Glossary would contain something along the lines below:

\section*{Glossary}

\textbf{ACR} \quad Expanded acronym in english. See: slovene translation of the
expanded acronym.

\vspace*{12pt}

\noindent\textbf{\textit{slovene translation of the expanded acronym} (angl.
\textit{expanded acronym in english}, ACR)} \quad Slovene description of the
acronym.

\vspace*{12pt}

\noindent\textbf{\textit{slovene translation of the term} (angl.
\textit{english term})}
\quad Slovene description of the term.

\end{document}

上面的例子产生: 在此处输入图片描述

请注意,首字母缩略词的条目列出了两次:一次列出了英文首字母缩略词(例如 ACR)及其扩展的英文版本和对斯洛文尼亚语条目的引用,另一次是普通条目,其中包含扩展首字母缩略词的斯洛文尼亚语翻译、英文扩展首字母缩略词和英文首字母缩略词本身。

我很高兴看到哪怕是部分答案。

答案1

以下是针对您的查询的第二部分的解决方案:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

% syntax: \addterm[options]{label}{Slovene}{Slovene
% plural}{English}{English plural}{Slovene description}

\newcommand{\addterm}[7][]{%
  \newglossaryentry{#2}{name={\textit{#3} (angl.\ \textit{#5})},
     first={\textit{#3} (angl.\ \textit{#5})},
     firstplural={\textit{#4} (angl.\ \textit{#6})},
     text={#3},
     plural={#4},
     sort={#3},
     description={#7},#1}%
}

\addterm
 {sample}% label
 {slovene translation of the term}%
 {plural form of slovene translation of the term}%
 {english term}%
 {plural english term}%
 {slovene description of the term}

\begin{document}

For ordinary glossary entries, the first occurrence would look like:
\gls{sample}.
Further occurrences would look like: \gls{sample}.

Reset and try plural forms:\glsreset{sample}

For ordinary glossary entries, the first occurrence would look like:
\glspl{sample}.
Further occurrences would look like: \glspl{sample}.


\printglossaries

\end{document}

(请注意,我认为如果第一次使用出现在斜体环境中,例如斜体摘要或定理,最好使用\emph而不是。)\textit

上面的例子产生:

生成的文档的图像

答案2

建立在Nicola Talbot 的回答,我想到了一个相当简单的方法来满足这个问题的另外两个要求:

  • 提供双语缩略词支持(以比解释更简单的方式这里
  • 列出两次首字母缩略词:一次列出英文首字母缩略词及其长版本以及对斯洛文尼亚语条目的引用,另一次列出普通条目及其斯洛文尼亚语长版本、英文长版本和英文首字母缩略词本身。

以下是涵盖整个问题的代码:

\documentclass{article}

\usepackage[hidelinks]{hyperref}

\usepackage{glossaries}

\makeglossaries

% A new command that enables us to enter bi-lingual (Slovene and English) terms
% syntax: \addterm[options]{label}{Slovene}{Slovene first use}{English}{Slovene
% description}
\newcommand{\addterm}[6][]{
  \newglossaryentry{#2}{
    name={#3 (angl.\ #5)},
    first={\emph{#4} (angl.\ \emph{#5})},
    text={#3},
    sort={#3},
    description={#6},
    #1 % pass additional options to \newglossaryentry
  }
}

% A new command that enables us to enter (English) acronyms with bi-lingual
% (Slovene and English) long versions
% syntax: \addacronym[options]{label}{abbreviation}{Slovene long}{Slovene first
% use long}{English long}{Slovene description}
\newcommand{\addacronym}[7][]{
  % Create the main glossary entry with \newacronym
  % \newacronym[key-val list]{label}{abbrv}{long}
  \newacronym[
    name={#4 (angl.\ #6,\ #3)},
    first={\emph{#5} (angl.\ \emph{#6},\ \emph{#3})},
    sort={#4},
    description={#7},
    #1 % pass additional options to \newglossaryentry
    ]
    {#2}{#3}{#4}
  % Create a cross-reference from the abbreviation to the main glossary entry by
  % creating an auxiliary glossary entry (note: we set the label of this entry
  % to '<original label>_auxiliary' to avoid clashes)
  \newglossaryentry{#2_auxiliary}{
    name={#3},
    sort={#3},
    description={\makefirstuc{#6}},
    see=[See:]{#2}
  }
}

% Change the text of the cross-reference links to the Slovene long version.
\renewcommand*{\glsseeitemformat}[1]{\emph{\acrlong{#1}}.}

\addterm
 {sample} % label
 {slovene translation of the term}
 {first use of the slovene translation of the term}
 {english term}
 {slovene description of the term}

\addacronym
 {sample_acronym} % label
 {ACR} % abbreviation
 {slovene long version of the acronym}
 {first use of the slovene long version of the acronym}
 {english long version of the acronym}
 {slovene description of the term}

\begin{document}

For ordinary glossary entries, the first occurrence would look like:
\gls{sample}.
Further occurrences would look like: \gls{sample}.

For acronyms, the first occurrence would look like:
\gls{sample_acronym}.
Further occurrences would look like: \gls{sample_acronym}.

\printglossaries

\end{document}

该示例生成: 在此处输入图片描述

请注意,之所以有两个条目:Slovene和,Slovene first use是因为斯洛文尼亚语有六种名词格。我发现自动处理所有这六个格有点麻烦,所以我将第一个用例硬编码到术语定义中。不幸的是,这意味着我必须手动检查第一次出现并Slovene first use相应地更改条目。如果有人有更好的解决方案,请告诉我。

相关内容