我一直在尝试使用来获得首字母缩略词的分词结尾glossaries
,到目前为止,已经设法使用从用户指南中粘贴的程序获得正确的结尾:
\documentclass[12pt, twoside, a4paper, english]{report}
\usepackage[acronym,nomain]{glossaries}
% Define "long-ing" key:
\glsaddkey* {ing}% key
{\glsentrytext{\glslabel}ing}% default value
{\glsentrying}% command analogous to \glsentrytext
{\Glsentrying}% command analogous to \Glsentrytext
{\glsing}% command analogous to \glstext
{\Glsing}% command analogous to \Glstext
{\GLSing}% command analogous to \GLStext
\newacronym[longplural={texts},shortplural={Ts},ing={texting}]{t}{T}{text}
\makeglossaries
\begin{document}
\printacronyms[title=List of abbreviations]
\chapter{Some scribbles}
writing writing \glsing{t} writing writing
\end{document}
但是,这只会给我长文本,我还需要缩写。更具体地说,我希望的输出\glsing{t}
是“texting (Ting)”,而不仅仅是“texting”,然后任何后续内容\glsing{t}
都显示“Ting”。
我尝试将其复制为显然需要的第二个命令(尝试复制“复数”修饰符的界面):
\documentclass[12pt, twoside, a4paper, english]{report}
\usepackage[acronym,nomain]{glossaries}
% Define "long-ing" key:
\glsaddkey* {ing}% key
{\glsentrytext{\glslabel}longing}% default value
{\glsentrying}% command analogous to \glsentrytext
{\Glsentrying}% command analogous to \Glsentrytext
{\glsing}% command analogous to \glstext
{\Glsing}% command analogous to \Glstext
{\GLSing}% command analogous to \GLStext
%% Define "short-ing" key:
\glsaddkey* {ing}% key
{\glsentrytext{\glslabel}shorting}% default value
{\glsentrying}% command analogous to \glsentrytext
{\Glsentrying}% command analogous to \Glsentrytext
{\glsing}% command analogous to \glstext
{\Glsing}% command analogous to \Glstext
{\GLSing}% command analogous to \GLStext
\newacronym[longplural={texts},shortplural={Ts},longing={texting},shorting={Ting}]{t}{T}{text}
\makeglossaries
\begin{document}
\printacronyms[title=List of abbreviations]
\chapter{Some scribbles}
writing writing \glsing{t} writing writing
\end{document}
显然(也许是很明显)该程序不容忍重复的命令,在查阅手册后,我意识到我在这方面做得远远超出了我的理解范围。
有人遇到过这个问题吗?您想出解决方案了吗?
答案1
听起来好像您正在寻找这样的东西:
\documentclass{report}
\usepackage[acronym,nomain]{glossaries}
% Define "long-ing" key:
\glsaddkey* {longing}% key
{\glsentrylong{\glslabel}ing}% default value
{\glsentrylonging}% command analogous to \glsentrytext
{\Glsentrylonging}% command analogous to \Glsentrytext
{\glslonging}% command analogous to \glstext
{\Glslonging}% command analogous to \Glstext
{\GLSlonging}% command analogous to \GLStext
%% Define "short-ing" key:
\glsaddkey* {shorting}% key
{\glsentryshort{\glslabel}ing}% default value
{\glsentryshorting}% command analogous to \glsentrytext
{\Glsentryshorting}% command analogous to \Glsentrytext
{\glsshorting}% command analogous to \glstext
{\Glsshorting}% command analogous to \Glstext
{\GLSshorting}% command analogous to \GLStext
\newacronym[longplural={texts},shortplural={Ts},longing={texting},shorting={Ting}]{t}{T}{text}
\newcommand{\glsing}[1]{%
\ifglsused{#1}{\glsshorting{#1}}{\glslonging{#1} (\glsshorting{#1})}%
}
\makeglossaries
\begin{document}
\printacronyms[title=List of abbreviations]
\chapter{Some scribbles}
writing writing \glsing{t} writing writing
\end{document}
得出的结果为:
编辑:
稍作修改\glsing
将取消设置“首次使用标志”:
\newcommand{\glsing}[1]{%
\ifglsused{#1}{\glsshorting{#1}}{\glslonging{#1} (\glsshorting{#1})\glsunset{#1}}%
}
大写版本:
\newcommand{\Glsing}[1]{%
\ifglsused{#1}{\Glsshorting{#1}}{\Glslonging{#1} (\glsshorting{#1})\glsunset{#1}}%
}
\newcommand{\GLSing}[1]{%
\ifglsused{#1}{\GLSshorting{#1}}{\GLSlonging{#1} (\GLSshorting{#1})\glsunset{#1}}%
}
答案2
Nicola Talbot 很棒回答与首字母缩略词配合得很好。但是,缺少普通词汇表条目,因此我扩展了解决方案以支持它们:
\documentclass{report}
\usepackage[acronym,nomain]{glossaries}
% Define "long-ing" key for acronym:
\glsaddkey* {longing}% key
{\glsentrylong{\glslabel}ing}% default value
{\glsentrylonging}% command analogous to \glsentrytext
{\Glsentrylonging}% command analogous to \Glsentrytext
{\glslonging}% command analogous to \glstext
{\Glslonging}% command analogous to \Glstext
{\GLSlonging}% command analogous to \GLStext
%% Define "short-ing" key for acronym:
\glsaddkey* {shorting}% key
{\glsentryshort{\glslabel}ing}% default value
{\glsentryshorting}% command analogous to \glsentrytext
{\Glsentryshorting}% command analogous to \Glsentrytext
{\glsshorting}% command analogous to \glstext
{\Glsshorting}% command analogous to \Glstext
{\GLSshorting}% command analogous to \GLStext
%% Define "-ing" key for glossary:
\glsaddkey* {participle}% key
{\glsentryname{\glslabel}ing}% default value
{\glsentryparticiple}% command analogous to \glsentrytext
{\Glsentryparticiple}% command analogous to \Glsentrytext
{\glsparticiple}% command analogous to \glstext
{\Glsparticiple}% command analogous to \Glstext
{\GLSparticiple}% command analogous to \GLStext
\newacronym[longplural={texts},shortplural={Ts},longing={texting},shorting={Ting}]{t}{T}{text}
\newglossaryentry{gloss}{name={gloss},participle={glossying},description={A sample glossary entry}}
\newcommand{\glsing}[1]{%
\ifglshasshort{#1}{%
\ifglsused{#1}{\glsshorting{#1}}{\glslonging{#1}\space(\glsshorting{#1})\glsunset{#1}}%
}{%
\glsparticiple{#1}\glsunset{#1}%
}%
}
\newcommand{\Glsing}[1]{%
\ifglshasshort{#1}{%
\ifglsused{#1}{\Glsshorting{#1}}{\Glslonging{#1}\space(\Glsshorting{#1})\glsunset{#1}}%
}{%
\Glsparticiple{#1}\glsunset{#1}%
}%
}
\newcommand{\GLSing}[1]{%
\ifglshasshort{#1}{%
\ifglsused{#1}{\GLSshorting{#1}}{\GLSlonging{#1}\space(\GLSshorting{#1})\glsunset{#1}}%
}{%
\GLSparticiple{#1}\glsunset{#1}%
}%
}
\makeglossaries
\begin{document}
\printacronyms[title=List of abbreviations]
\chapter{Some scribbles}
writing writing \glsing{t} writing \glsing{t} writing \glsing{gloss} writing writing
\end{document}