5

I have been trying to get participle endings on acronyms using glossaries, have so far managed to get the ending right using the procedure pasted from the users guide:

    \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}

However, this only gives me the long text, and i also need the abbreviation. More concrete, I want the output of \glsing{t} to be "texting (Ting)", not just "texting", and then any subsequent \glsing{t} to show "Ting".

I have tried duplicating it for the second command that's apparently needed (trying to copy the interface for the "plural" modifier):

            \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}

Apparently (and perhaps obviously) the program doesn't tolerate duplicate commands, and after consulting the manual, i realize that I'm way over my head in this.

Does anybody have any experience with this problem, and did you come up with a solution?

2
  • 1
    Welcome to TeX.SX! Can you state what you expect from \glsing{t}? What should be the output? At the moment I don't understand what you're after...
    – user31729
    Commented Nov 16, 2015 at 17:29
  • Why thank you! I haven't actually had to post here before, thanks to all you excellent people. :-) I want the output of \glsing{t} to be "texting (Ting)", not just "texting", and then any subsequent \glsing{t} to show "Ting". I also edited this into the original post.
    – FredrikH-R
    Commented Nov 17, 2015 at 18:07

2 Answers 2

4

It sounds as though you're looking for something like this:

\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}

This produces:

image of result

Edit:

A minor modification to \glsing will unset the "first use flag":

\newcommand{\glsing}[1]{%
  \ifglsused{#1}{\glsshorting{#1}}{\glslonging{#1} (\glsshorting{#1})\glsunset{#1}}%
}

Upper case versions:

\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}}%
}
5
  • Yes, that's it, almost. Now the abbreviations show up, and it conforms to other abbreviations, but the ´\glsing´ in itself still doesn't quite seem to affect other commands, as illustrated: \begin{document} \printacronyms[title=List of abbreviations] \chapter{Some scribbles} \glsing{t} \glsing{t} \glsing{t} \gls{t} \gls{t} \gls{t} \glsing{t} \end{document}
    – FredrikH-R
    Commented Nov 18, 2015 at 12:42
  • @DJHellduck I've edited my answer. Commented Nov 18, 2015 at 13:06
  • It works! But how can i get it to recognize the uppercase commands? Like: \glsing{t} \Glsing{t} \GLSing{t}
    – FredrikH-R
    Commented Nov 18, 2015 at 14:26
  • @DJHellduck You just need to add similar definitions. I've updated my answer. Commented Nov 19, 2015 at 10:07
  • Oh no, i seem to have forgotten to mark your answer correct. This absolutely work very well as far as i can tell. Thank you!
    – FredrikH-R
    Commented Feb 3, 2016 at 12:49
0

Nicola Talbot’s great answer works well with Acronyms. However, the plain glossary entries are missing, so I exended the solution to also support them:

\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}

Output:

Compiled tex example with participle of acronym and glossary

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .