1

This is my first post so apologies if I break any conventions! I've decided to write my PhD thesis in LaTeX, and having some trouble formatting the acronyms/glossaries as I would like. I'm using the glossaries package, and want to use it for two distinct use cases, one of which (the standard use) I have working well.

The issue relates to trying to use glossaries to deal with manufacturers/companies when referencing e.g. a chemical. Conventionally, when you first list a chemical, it should be referenced along the lines of "Chemical X (Company Y, Sometown, USA)". If you use several products from one company, subsequent references to the company can just mention the company name without needing location. These company references should not appear in the list of acronyms.

With the help of previous answers on this site, I have managed to suppress the company name from the list of acronyms by defining a new 'fake' glossary that is not printed. I tried using \newignoredglossary but this also seemed to hide the acronym in the text, not sure why, but I am happy with the fake glossary solution.

However, first use of these company acronyms using \gls{} produces e.g. "Company, Sometown, USA (Company)". I'd like this to display without the company name repeated in parentheses at the end.

I realize that I could use:

\glsdesc{company} 

followed by

\glsunset{company} \gls{company} 

to achieve exactly the effect I am after - but this would involve having to manually find and tag the first use of each company name with \glsdesc{} followed by \glsunset{} - and given that it's likely the order of paragraphs could change during the writing of the thesis, I would much rather that this was handled automatically.

Here is a minimal working example:

\documentclass{article}

\usepackage[acronym]{glossaries}

\newglossary[flg]{fake}{fls}{flo}{Fake Entries}

\newacronym[type=fake]{bio}{Biohazard Inc}{Biohazard Inc, MA, USA}
\newacronym{pbs}{PBS}{Phosphate Buffered Saline}

\makeglossaries

\begin{document}

First use - \gls{bio}. Second use - \gls{bio}. Not displayed in glossary, but first use repeats company name in parentheses. 

\gls{pbs} should appear in the glossary. Second use \gls{pbs}.

\printglossary[type=\acronymtype]

\end{document}

Is there an easy way to achieve this in glossaries? I have wondered whether glossaries-extra might be able to deal with this better, but the documentation is not 100% clear to me, and I'm concerned that trying to convert might break what is currently a generally effective acronym list in what is already a complex, multi-file document, and not necessarily fix my issue!

0

Here's an alternative approach:

\documentclass{article}

\usepackage[acronym]{glossaries}

\newignoredglossary{ignored}

% syntax: \newcompany[extra options]{label}{name}{location}
\newcommand*{\newcompany}[4][]{%
 \newglossaryentry{#2}{type=ignored,%
  name={#3},%
  first={#3 (#4)},%
  description={#4},%
  #1}%
}

\glssetnoexpandfield{first}

% syntax: \newchemical[extra options]{company}{label}{short}{long}
\newcommand{\newchemical}[5][]{%
 \newglossaryentry{#3}{type=\acronymtype,%
  name={#4},%
  first={#5 (\ifglsused{#2}{\glsentryname{#2}}{\glsentryname{#2},
    \glsentrydesc{#2}\protect\glsunset{#2}})},%
  description={#5},%
  #1}%
}

\makeglossaries

\newcompany{bio}{Biohazard Inc}{MA, USA}
\newchemical{bio}{pbs}{PBS}{Phosphate Buffered Saline}

\begin{document}

First use - \gls{bio}. Second use - \gls{bio}.

\gls{pbs} should appear in the glossary. Second use \gls{pbs}.

Reset\glsresetall[ignored,\acronymtype] and try the other way.

\gls{pbs} should appear in the glossary. Second use \gls{pbs}.

First use - \gls{bio}. Second use - \gls{bio}.

\printglossary[type=\acronymtype]

\end{document}

This produces:

image of document

0

Using the first= option when each company acronym is defined produces exactly the result I'm after:

\newacronym[type=fake, first=\glsdesc{bio}]{bio}{Biohazard Inc}{Biohazard Inc, MA, USA}

The glossaries package is fantastic, but so feature packed that it can be difficult for a relative beginner like me to appreciate all the options.

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.