0

I used glossaries package to create a list of acronyms and made my own glossary style, like in MWE:

\documentclass{article}
\usepackage[nopostdot,nonumberlist,acronym]{glossaries}

\newglossarystyle{acronym}
{%
    \setglossarystyle{long}
    \renewenvironment{theglossary}%
    {\begin{longtable}[l]{p{0.13\textwidth}p{0.7\textwidth}}}%
        {\end{longtable}}
}

\newacronym{PNG}{PNG}          {Portable Network Graphics }
\newacronym{SVG}{SVG}          {Scalable Vector Graphics}
\newacronym{JPEG}{JPEG}        {Joint Photographic Experts Group}

\makeglossaries

\begin{document}

    \glsaddall
    \printglossary[type=acronym,style=acronym,title={}]

    First use of \gls{JPEG} and \gls{PNG}. Second use of \gls{PNG} and \gls{JPEG}.

\end{document}

enter image description here

I started to use glossaries-extra package and tried to use \newabbreviationstyle command to adjust my style for abbreviations in glossaries-extra, but it fails with Paragraph ended before \newabbreviationstyle was complete error:

\documentclass{article}
\usepackage[nopostdot,nonumberlist,acronym]{glossaries-extra}

\newabbreviationstyle{acronym-user}
{%
    \setglossarystyle{long}
    \renewenvironment{theglossary}%
    {\begin{longtable}[l]{p{0.13\textwidth}p{0.7\textwidth}}}%
        {\end{longtable}}
}

\setabbreviationstyle{acronym-user}

\newabbreviation{PNG}{PNG}          {Portable Network Graphics }
\newabbreviation{SVG}{SVG}        {Scalable Vector Graphics}
\newabbreviation{JPEG}{JPEG}        {Joint Photographic Experts Group}

\makeglossaries

\begin{document}

    \glsaddall
    \printglossary[type=acronym,style=acronym-user,title={}]

    First use of \gls{JPEG} and \gls{PNG}. Second use of \gls{PNG} and \gls{JPEG}.

\end{document}

How to reach the same result with glossaries-extra package?

1 Answer 1

0

I solved the problem by redefying \newacronym macros with the first option field.

\documentclass{article}
\usepackage[nopostdot,nonumberlist,acronym]{glossaries-extra}

\renewcommand{\newacronym}[3]{%
    \newglossaryentry{#1}{%
        type=acronym, 
        name=#2,
        description={#3},
        first={{#3} ({#2})},
    }
}

\newglossarystyle{acronym}
{%
    \setglossarystyle{long}
    \renewenvironment{theglossary}%
    {\begin{longtable}[l]{p{0.2\textwidth}p{0.7\textwidth}}}%
        {\end{longtable}}
}


\newacronym{PNG}{PNG}          {Portable Network Graphics }
\newacronym{SVG}{SVG}        {Scalable Vector Graphics}
\newacronym{JPEG}{JPEG}        {Joint Photographic Experts Group}

\makeglossaries

\begin{document}

    \glsaddall
    \printglossary[type=acronym,style=acronym,title={}] 

    First use of \gls{JPEG} and \gls{PNG}. Second use of \gls{PNG} and \gls{JPEG}.

\end{document}
1
  • I doubt that this is the preferred way of using \newacronym -- by redefining it
    – user31729
    Commented Dec 25, 2018 at 14:45

You must log in to answer this question.

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