类似缩写及词汇表

类似缩写及词汇表

如何使用词汇表功能生成以下句子:

在操作阶段 1(OP1)中我们这样做了。在接下来的 OP2 和 OP3 中我们更改了设置。

tex 代码看起来类似于:

In \gls{OP1} we did such. In the following \gls{OP2} and \gls{OP3} we changed the settings.

当然缩写定义

\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP2}{OP2}{operation phase~2}

会导致所有首字母缩略词都展开,而我只需要展开第一个短语。此功能是否包含在内或存在问题?

可编译示例文档:

\documentclass{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}         

\usepackage[acronym, nomain, nonumberlist, toc, automake=immediate]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short-user}

\makeglossaries


\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP3}{OP3}{operation phase~3}

\begin{document}
In \gls{OP1} we did such. In the following \gls{OP2} and \gls{OP3} we changed the settings.

\printglossaries

\end{document}

答案1

\glsentryshort您可以使用和的组合来实现所需的输出,\glsadd如以下示例所示:

\documentclass{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}         

\usepackage[acronym, nomain, nonumberlist, toc, automake]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short-user}

\makeglossaries


\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP3}{OP3}{operation phase~3}

\begin{document}
In \gls{OP1} we did such. In the following \glsentryshort{OP2} and \glsentryshort{OP3} we changed the settings.


\printglossaries
\glsadd{OP2}\glsadd{OP3}
\end{document}

在此处输入图片描述

相关内容