# Paragraph style glossaries acronym list

So I have started developing an acronym style that is paragraph based.

I have a general paragraph working except for two problems"

• one, I haven't figured out how to remove the list separation punctuation from the last element
• and two, if I use my glossary counts attribute on a custom field that I called "category", I don't get a list... at all:

Here's a MWE that doesn't produce a list at all.

\documentclass{article}

\usepackage{textgreek}

\usepackage[savewrites=true,nogroupskip,style=tree]{glossaries-extra}

\newcommand{\acrinverse}[1]{{\acrshort{#1}}\xspace{\acrlong{#1}}}

\newglossary[alg]{acronym}{acr}{acn}{List of Acronyms}

\makeindex
\makeglossaries

\glsenableentrycount % enable \cgls, \cglspl, \cGls, \cGlspl
\glssetcategoryattribute{acronym}{entrycount}{1}

% Not using \newabbreviation so redefine \cglsformat
% to just check for the long field.
\renewcommand*{\cglsformat}[2]{%
\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}#2%
}

\AtEndPreamble{%
\let\ncgls\gls
\let\ncglspl\glspl
\let\ncGls\Gls
\let\ncGlspl\Glspl

\let\gls\cgls
\let\glspl\cglspl
\let\Gls\cGls
\let\Glspl\cGlspl
}
%==================================================================================================================================================================

\newglossarystyle{paragraphAcronymList}{%
\setglossarystyle{tree}% base this style on the list style
\renewcommand{\glspostdescription}{;}
\renewcommand*{\glossentry}[2]{%
\glstarget{##1}{\glossentryname{##1}}:~\space\glossentrydesc{##1}\glspostdescription\space}%
%\space\glspostdescription\space}%
}

%==================================================================================================================================================================

\newglossaryentry{TNF}{
type={acronym},
category={acronym},
sort={tumor necrosis factor},
name={TNF},
first={tumor necrosis factor (TNF)},
description={tumor necrosis factor}
}

\glssetnoexpandfield{first}
\glssetnoexpandfield{firstpl}

\newcommand{\TNFalpha}{TNF--{\textalpha}}

\newglossaryentry{TNFalpha}{
type={acronym},
category={acronym},
sort={tumor necrosis factor alpha},
name={\TNFalpha},
first={\ifglsused{TNF}{\TNFalpha}{\glsunset{TNF}tumor necrosis factor alpha~(\TNFalpha)}},
description={tumor necrosis factor alpha}
}
\newglossaryentry{HDPE}
{
type={acronym},
category={acronym},
name={HDPE},
short={HDPE},
long={high density polyethylene},
first={high density polyethylene (HDPE)},
description={high density polyethylene}
}

\newglossaryentry{SHG}{%
type={acronym},
category={acronym},
name={SHG},
short={SHG},
long={second harmonic generation},
description={second harmonic generation},
first={second harmonic generation (SHG)},
sort={second harmonic generation}
}%

\newglossaryentry{SRS}{%
type={acronym},
category={acronym},
name={SRS},
short={SRS},
long={stimulated Raman scattering},
description={stimulated Raman scattering},
first={stimulated Raman scattering (SRS)},
sort={stimulated Raman scattering}
}%

\newglossaryentry{TPEF}{%
type={acronym},
category={acronym},
name={TPEF},
short={TPEF},
long={two-photon-excited fluorescence},
description={two-photon-excited fluorescence},
first={two-photon-excited fluorescence (TPEF) },
sort={two-photon-excited fluorescence}
}%

\begin{document}

\gls{TNFalpha}
\gls{TNFalpha}

\gls{TNF}
\gls{TNF}

\gls{HDPE}
\gls{HDPE}

\gls{TPEF}
\gls{TPEF}

\gls{SHG}
\gls{SHG}

\gls{SRS}
\gls{SRS}

\printglossary[type=acronym,style=paragraphAcronymList]\clearpage

\end{document}

• Perhaps one of the tree styles might be a better base style. They just use \parindent and \hangindent rather than lists or tabulated material. – Nicola Talbot Nov 1 '16 at 23:04
• @NicolaTalbot Thanks, I've been reading through the link you provided, glossary-inline also looks like it has potential. Still investigating! – EngBIRD Nov 1 '16 at 23:38
• @NicolaTalbot Well, I've been working on a custom style creation that formatted correctly, but only created two entries. Then I tried style=tree to the optional package arguments. Unfortunately, I still only get two entries. Not even the first alphabetical terms, but my two most frequently used terms. I will tackle a MWE for this behavior as soon as I get some time. Just wanted to follow up from your suggested direction. The complete document makes use of things like glossary counting and glossaries-extra that aren't in the original MWE so these need to be tested for the MWE. – EngBIRD Nov 4 '16 at 1:53
• That doesn't sound like a problem with the style, but more likely with the generation of the external file used by \printglossary. Are there any error messages or warnings in the makeindex log file? There's also a diagnostic application makeglossariesgui that can check for common problems. – Nicola Talbot Nov 4 '16 at 15:17
• @NicolaTalbot Well, troubleshooting this has been interesting. I believe \glssetcategoryattribute{acronym}{entrycount}{1} is the problem line. If I remove this line, it works (except for my semicolon issue on the last entry) but then my counts won't work properly. I've written an entirely new question and MWE to illustrate. Thanks. – EngBIRD Nov 11 '16 at 2:22

For your custom glossary style, the problem is essentially displaying a list with a separator between each item but not before or after the first or last entry. For this we can use the same method described in Iteration Tips and Tricks. Like this:

\newglossarystyle{paragraphAcronymList}{%
\setglossarystyle{tree}% base this style on the list style
\def\entrysep{\def\entrysep{; }}%
\renewenvironment{theglossary}%
{\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt plus 0.3pt}}%
{.}%
\renewcommand*{\glossentry}[2]{%
\entrysep\glstarget{##1}{\glossentryname{##1}}:~\space\glossentrydesc{##1}\glspostdescription}%
}


The entry counting problem is probably best posted as a separate question.