Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

Bug Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 146🔗
Date: 2020-01-30 12:12:04
Status Closed (Duplicate)
Category glossaries
Version v4.42
Summary Inserting \null breaks legit use case
Cross Ref 102

Sign in to subscribe to notifications about this report.

Description

Hi Nicola,

this is a report on the border line between a bug report and a feature request but since it breaks my intended behavior and I think it needs to be fixed in the core I put it here.

My problem is that I want to use an "invisible" \printglossary to count the number of acronyms used in the text AtBeginDocument via a custom style (cf. glossaries: count the number of used abbreviations (i.e. those to be output by \printacronyms)). Unfortunately this inserts a \null if there are no abbreviations used that breaks the layout of my slides (I am using beamer, which is the reason why I need to count the number of abbreviations in the first place :).

From reading the documentation I do not completely understand why the \nulls are a feature and not a bug (cf. [TeX.SX Link]) but in any case it would be nice to make it optional (or at least provide a way to turn it off).

KR

MWE

Download (1.04K)

\documentclass{beamer}

\usepackage[nomain,acronym]{glossaries}

\newacronym{TEST}{TEST}{Test}

\makeglossaries

\newcounter{acronum}
\makeatletter
  \newglossarystyle{countentries}{%
    \setcounter{acronum}{0}
    \renewenvironment{theglossary}{}{}%
    \let\glossaryheader\@empty
    \let\glsgroupheading\@gobble
    \let\glsgrouptitle\@gobble
    \let\glsnavhypertarget\@gobbletwo
    \let\glsnavigation\@empty
    \let\glsgroupskip\@empty
    \let\glsentryitem\@gobble
    \let\glsentrycounterlabel\@empty
    \let\glstarget\@gobbletwo
    \let\glossaryentrynumbers\@gobble
    \let\subglossentry\@gobblethree
    \let\glssubentryitem\@gobble
    \let\glssubentrycounterlabel\@empty
    \let\currentglossary\@empty
    \renewcommand\glossarysection[2][]{}%
    \let\glossarypreamble\@empty
    \let\glossarypostamble\@empty
    \let\glsresetentrylist\@empty
    \renewcommand\glossentry[2]{\stepcounter{acronum}}%
  }
  \AtBeginDocument{\printacronyms[style=countentries]}
\makeatother

\begin{document}

\begin{frame}{1. slide}
\end{frame}

\end{document}

Evaluation

Duplicate of \printglossary outputs extra empty pages when there is no glossary file yet.

The use of \null is mentioned in the user manual. (I will add a more detailed note in the next release.) The reason for it is hidden away in the documented code:

If the glossary file doesn't exist, do \null. (This ensures that the page is shipped out and all write commands are done.) This might produce an empty page, but at this point the document isn't complete, so it shouldn't matter.

This had to be added in response to an earlier bug report, so I'm not keen to revert it. Once the external glossary files have been created, \null is no longer used, so this shouldn't affect the document once a full build has been performed.

If you want to count the number entries that have been used in the document it would be simpler to just use \forallglsentries combined with \ifglsused at the end of the document and save the result in the aux file to be read in on the next run.

Comments

0 comments.


Add Comment

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.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=146