add tag
Anonymous 9229
I have a glossary with short and long titles for bibliography items. My goal is the following: when an entry occurs first, I want to print to glossary description [THIS is the main question!]. If an entry occurs twice in a row, in the second case I want to print Ibid. instead of its title [this is done]. Otherwise I want to print the glossary name for the entry. I tried list handling and other conditionals, but wasn't succesful. I'd appreciate your help.

As I have a rather large document with more than 500 references, I'd like to keep the codes already done, but I'm open to any solution.

Here is the code which I already have:

```
\documentclass{article}
\usepackage{xparse}
\usepackage{glossaries}

\def\mygls{empty}
\def\myftncounter{0}

\DeclareDocumentCommand{\footcite}{m}{%
    \ifthenelse{\equal{\mygls}{#1}}{%
        \ifthenelse{%
            \equal{\myftncounter}{\thefootnote}%
            }{%
            \edef\thisgls{Ibid}%
            }{%
            \edef\thisgls{\gls{#1}}%
            }%
    }{%
        \edef\thisgls{\gls{#1}}%
        \xdef\mygls{#1}%
    }%
    \footnote{\thisgls}%
    \xdef\myftncounter{\thefootnote}%   
}

\newglossaryentry{G1}{name={short1},description={long1}}
\newglossaryentry{G2}{name={short2},description={long2}}

\begin{document}
    
Lorem\footcite{G1} ipsum\footcite{G1} dolor\footcite{G2} sit\footcite{G1} amet.

\end{document}

enter image description here
```

![kép.png](/image?hash=fba8ac209692f4fcb2b53b100b0cf05351cd67590b4af680731982d97cce57db)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.