# Bug Tracker

ID 204🔗 2022-06-09 19:44:03 2022-06-17 14:10:49 Open Sign in if you want to bump this report. glossaries-extra 1.48 glossaries-extra discardperiod and abbreviation long form

## Description

Hi Nicola,

When using the discardperiod feature of glossaries-extra, the package will discard a period after an explicit long form abbreviation of an unset entry.

I know the functionality is designed (and documented) to distinguish the first from subsequent uses of \gls-like commands (with retainfirstuseperiod), and can also handle plurals (with pluraldiscardperiod). So it is arguable if this is really a "bug". But it is at least unfortunate that the period gets discarded after a long form abbreviation, because we then have to "remember" not to use explicit long forms of a category which has discardperiod enabled.

I understand it complicates things, but ideally the functionality would be able to identify name/text or short/long/full, instead of first/subsequent, just like it is able to distinguish the singular/plural cases.

I have found a workaround for the case, even if it is a somewhat fragile one, as it relies on passing around a globally set boolean, so that its resetting critically depends on \glsxtrpostlink always being called, so that the assignment won't "leak". But, if it is useful as a concept, I'd be glad.

Best regards,
Gustavo.

## MWE

\documentclass{article}

\usepackage[
abbreviations,
shortcuts=abbr,
]{glossaries-extra}

\glssetcategoryattribute{abbreviation}{retainfirstuseperiod}{true}

\newabbreviation{dr}{Dr.}{Doctor}

\begin{document}

% This is OK.
\ab{dr}. \ab{dr}.

% This is still OK.
\as{dr}.

% This period gets unduly discarded.
\al{dr}.

\end{document}

## Evaluation

This will be fixed in v1.49. That version, which is still under development, is a major release and has had a knock-on effect for related packages (mfirstuc, bib2gls and the TeX parser library used by bib2gls). I need to co-ordinate all these updates before releasing them all, which may take a while.

A workaround for older versions is to put the period in the optional argument:

\al{dr}[.]

🔗Comment from anonymous
Date: 2022-06-17 13:31:29

Hi Nicola,

I'm testing here version 1.48b, as you requested and, taking things in parts, a comment on this issue.

I see that this is already handled by the new \glsxtrsetlongfirstuse, which indeed works for the particular case reported.

Consider, however, the following document:

\documentclass{article}

\usepackage[
abbreviations,
shortcuts=abbr,
]{glossaries-extra}

\glssetcategoryattribute{abbreviation}{retainfirstuseperiod}{true}

\newabbreviation[user1=Docteur]{dr}{Dr.}{Doctor}

\newabbreviation
[user1={German Speaking \TeX\ User Group}]
{dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\ e.V.}

\begin{document}

% This is OK.
\ab{dr}. \ab{dr}.

% This is still OK.
\as{dr}.

% This period no longer gets unduly discarded.
\al{dr}.

% But this one still does.
\glsuseri{dr}.

% And this one doesn't, when it should.
\al{dante}.

\end{document}

Two things to consider there. First, while the fix works for the long form, other fields are not covered, such as user1. I know this is documented, and that the recommended workaround is \glsuseri{dante}[.]. I'd say it is still unfortunate. Second, there might be a mix of entries where some have ending dots only in the short form, and some have them in both long and short forms. If that happens, whatever the definition of \glsxtrsetlongfirstuse is, it will only work for part of the entries.

When I originally approached this problem, my main attempt was to find out what the field being printed was at the post link hook. But, as far as I can tell, this is not tracked at all. And, even if it where, the "mixed cases" case would still beat us. This might be dealt with by category attributes, but I doubt it would be much practical. I eventually went with signalling from the entry field itself in [TeX.SX Link] and, at this point, I think this is the only way to make things flexible enough. True, as I've implemented it, "from the outside", its a little fragile, but it need not be on your side. On the other hand, true, breaking UI change...

My general comment here is that I think you'd be better off in the longer term by a more general approach, instead of fighting the uphill battle of adding one exception at a time.

Granted, though, of course, that the long form is probably the most frequent case where this is a problem, so the current fix is an improvement, for which I thank you.

Best regards,
Gustavo.

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

🔗Comment from Nicola Talbot 🦜
Date: 2022-06-17 13:43:01
Repying to: anonymous 2022-06-17 13:31:29

Thank you for your feedback. One possibility is to allow the value of the discardperiod attribute to be a comma-separated list of fields to which the setting should apply. The "true" value could mean only with the \gls-like or abbreviation commands, although that might cause a problem with backward-compatibility. I could allow "all" as a value to behave as in previous versions.

The post-link hook can pick up whether it's following \gls-like or \glstext-like commands with \glsxtrifwasglslike. I would then need to add another placeholder command to pick up the field name for the \glstext-like commands.

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

🔗Comment from anonymous
Date: 2022-06-17 14:01:23
Repying to: Nicola Talbot 🦜 2022-06-17 13:43:01

This sounds great! It would require a possible multiplication of categories (...-dotted, ...-doubledotted), but it seems both more robust and more manageable regarding backward compatibility than the signalling approach. (Btw, has anyone already suggested you that category be a list? I won't do it now, 'cause I'm afraid to have spent all my "pestering quota" for a good stretch of time :-).

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

🔗Comment from Nicola Talbot 🦜
Date: 2022-06-17 14:10:49
Repying to: anonymous 2022-06-17 14:01:23

There are some instances where control sequence names that include the entry's category name need to expand, and that wouldn't work with a list of categories. One possibility might be to have a main category and subsidiary categories for minor adjustments, but that would definitely have to wait for another version.

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.