3

With a dual entry I am able to both list Glossary and Acronyms in the same command

\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
  \newglossaryentry{gls-#3}{name={#5},text={#5\glsadd{#3}},
    description={#6},#1
  }
  \makeglossaries
  \newacronym[see={[Glossary:]{gls-#3}},#2]{#3}{#4}{#5\glsadd{gls-#3}}
}

I've created the following minimal viable product

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

\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
  \newglossaryentry{gls-#3}{name={#5},text={#5\glsadd{#3}},
    description={#6},#1
  }
  \makeglossaries
  \newacronym[see={[Glossary:]{gls-#3}},#2]{#3}{#4}{#5\glsadd{gls-#3}}
}

\makeglossaries

\newdualentry{st}{ST}{Sample Test}{This is a sample test}

\begin{document}

Lorem ipsum \gls{st}

\printglossary[type=\acronymtype]
\printglossary

\end{document}

Which produces a text, with the acronym entry, and lastly it includes a section called acronyms and glossaries.

Example output

I would like the output of the Acronym and Glossary to be together, such that I get firstly the acronym, and then the definition of the word, just like so (or at least similarly):

Acronym and Glossary:

ST - Sample Test This is a sample test.

5
  • 1
    Have you tried name={#4 -- #5} in the \newglossaryentry command?
    – gernot
    Jan 10, 2022 at 18:19
  • If you add this as an answer, I'll reward you with the bounty @gernot Jan 11, 2022 at 7:14
  • Thanks, very generous, but this simple answer does not deserve the bounty. I will make it an answer, then you can accept it to close this "issue", but please keep the bounty. You may need it for more complicated questions.
    – gernot
    Jan 11, 2022 at 11:01
  • Well, you'd receive the bounty after seven days anyhow. :-) Jan 11, 2022 at 11:46
  • As far as I know there is no automatism. You can decide after seven days whether you want to grant the bounty or not.
    – gernot
    Jan 11, 2022 at 16:44

1 Answer 1

2
+50

Add the acronym to the name of the glossary entry: name={#4 -- #5} instead of name={#5}, i.e.,

\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
  \newglossaryentry{gls-#3}{name={#4 -- #5},text={#5\glsadd{#3}},
    description={#6},#1
  }
  \makeglossaries
  \newacronym[see={[Glossary:]{gls-#3}},#2]{#3}{#4}{#5\glsadd{gls-#3}}
}

You must log in to answer this question.

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