TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using glossaries to generate my acronyms. Sometimes the first definition of the acronym is placed in a section or chapter title. When I generate the ToC, then obviously that will become the first occurrence and will be expanded, but the acronym in the tile will not. Is it possible to have them expand either in both places or only in the tile, not the ToC? I'd like a general solution, meaning that I don't want to manually reset the glossary before the title where the acronym appears.

Here's a very short example of what I have:

\documentclass{amsbook}

\usepackage[acronym,nonumberlist]{glossaries}
\newacronym{MOSFET}{MOSFET}{metal-oxide semiconductor field-effect transistor}
\makeglossaries

\begin{document}
\tableofcontents
\chapter{\Gls{MOSFET}}
\printglossaries
\end{document}

EDIT: This post is related, but doesn't really do...

share|improve this question
up vote 2 down vote accepted
{\let\gls\glsfirst
\let\Gls\Glsfirst
\tableofcontents}

will make it use the expanded form in the title and the toc

share|improve this answer
    
That's nice! I see the braces are essential. – Count Zero Sep 30 '12 at 12:00
    
@davidcarlisle is there anyway of not expanding in TOC or titles. The think is otherwise the first time in text is not expanded. For instance, one in toc if I talk about a term in the introduction it is not expanded. Should I use \glsresetall{}? – jlanza Jan 26 '14 at 12:14

David's answer works fine because your MWE has the location list suppressed (nonumberlist) and doesn't use hyperref. However I thought I'd better add this in case others have a similar problem but need a more general solution that works with the number list and hyperref.

In general it's best not to use commands like \Gls in chapter/section headings. There's more of a problem than just prematurely triggering the first use flag. It will also cause the table of contents to be added to the entry's location list, which isn't particularly helpful to the reader, and can cause nested hyperlinks and problems with PDF bookmarks. Depending on the page style, you can also end up indexing the entry on every page that the chapter/section title appears in the page header.

If you're happy to extend the glossaries package with glossaries-extra, then a better approach is to use commands like \glsfmtshort, \glsfmtlong or \glsfmtfull in the chapter/section heading. For example:

\documentclass{amsbook}

\usepackage{hyperref}
\usepackage[acronym,toc=false]{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short}
\newacronym{MOSFET}{MOSFET}{metal-oxide semiconductor field-effect
transistor}

\begin{document}
\tableofcontents

\chapter{\Glsfmtfull{MOSFET}}
\printglossaries
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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