2

Is it possible to convert errors into warnings and not stop compilation when using glossaries?

If P2P is not defined, a message is issued and compilation stopped:

Package glossaries Error: Glossary entry '3GPP' has not been defined.

Probably this is a simple feature that I didn't find in the documentation. For example using acro with option silent=true, or with acronym package it is possible.

This is useful because I am copying my own text from other documents to other single document and at beginning just test the layout; and after define the acronym.

\documentclass{article}

\usepackage[acronym,shortcuts]{glossaries}
\makeglossaries
\newacronym{P2P}{P2P}{Peer-to-Peer}


\begin{document}
\printglossary[type=\acronymtype]

\ac{P2P}
\ac{3GPP}

\end{document}

1 Answer 1

2

Yes:

\documentclass{article}

\usepackage[acronym,shortcuts]{glossaries}
\let\glsdoifexists\glsdoifexistsorwarn

\makeglossaries
\newacronym{P2P}{P2P}{Peer-to-Peer}


\begin{document}
\printglossary[type=\acronymtype]

\ac{P2P}
\ac{3GPP}

\end{document}

I get

Package glossaries Warning: Glossary entry `3GPP' has not been defined on input line 14.

A different solution prints the offending entry between exclamation marks, in bold face.

\documentclass{article}

\usepackage[acronym,shortcuts]{glossaries}
\renewcommand{\glsdoifexists}[2]{%
  \ifglsentryexists{#1}{#2}{%
    \textbf{!#1!}\PackageWarning{glossaries}{Glossary entry `\glsdetoklabel{#1}'
    has not been defined}}%
}

\makeglossaries
\newacronym{P2P}{P2P}{Peer-to-Peer}


\begin{document}
\printglossary[type=\acronymtype]

\ac{P2P}
\ac{3GPP}

\end{document}

enter image description here

5
  • It is a good start. Thanks. However, I would like that something could be printed. In my MWE, 3GPP should be printed as the packages that I mention do.
    – cacamailg
    Sep 7, 2015 at 22:04
  • @cacamailg Here it is; maybe you can ask for a new feature in the package.
    – egreg
    Sep 7, 2015 at 22:26
  • This would be a very good feature to add.
    – cacamailg
    Sep 8, 2015 at 18:14
  • How can I ask for it?
    – cacamailg
    Sep 8, 2015 at 18:21
  • @cacamailg dickimaw-books.com/cgi-bin/feature-request.cgi
    – egreg
    Sep 8, 2015 at 19:19

You must log in to answer this question.

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