1

I would like to set up a glossary using the package glossaries-extra in such a way that the acronyms would be displayed in full at the beginning of each chapters for their first appearance and then only the acronym would appear.

\documentclass{book}
\usepackage{hyperref}
\usepackage[xindy]{glossaries-extra}

\makeglossary

\newacronym{lmi}{LMI}{Linear Matrix Inequality}

\begin{document}
\printglossary

Hello world

\chapter{First}
First use: \gls{lmi}
Second use: \gls{lmi}

\chapter{Second}
First use: \gls{lmi}
Second use: \gls{lmi} 

\end{document}

Basically, in the code above, I am looking for a macro that displays: Linear Matrix Inequality (LMI) for the first appearance in a chapter and then simply LMI for the next appearances.

Thanks.

Romain.

1

I think the simplest method is to add \glsresetall to the start of each chapter with etoolbox's \preto command. (etoolbox is automatically loaded by glossaries and therefore by glossaries-extra but I've loaded it explicitly below for clarity.)

\documentclass{book}
\usepackage{etoolbox}
\usepackage{hyperref}
\usepackage[xindy]{glossaries-extra}

\preto\chapter{\glsresetall}

\makeglossaries

\setabbreviationstyle[acronym]{long-short}
\newacronym{lmi}{LMI}{Linear Matrix Inequality}

\begin{document}
\printglossary

Hello world

\chapter{First}
First use: \gls{lmi}
Second use: \gls{lmi}

\chapter{Second}
First use: \gls{lmi}
Second use: \gls{lmi}

\end{document}

First chapter:

Chapter 1 First. First use: Linear Matrix Inequality (LMI) Second use: LMI

Second chapter:

Chapter 2 Second. First use: Linear Matrix Inequality (LMI) Second use: LMI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.