MakeIndex, Nomenclature, Glossaries and AcronymsAcronym section showing abbreviation

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Acronym section showing abbreviation

Post by LeonardLopes »

I have a simple MWE where I have an acronym that I reference. The first time it puts out the full name with the acronym and every subsequent time it puts out just the acronym. Well that's all find and dandy, but when it puts out the acronym list, the title of the acronym is the abbreviation. I want the full name with the abbreviation to be there (i.e. "minimal working example (MWE)" instead of just "MWE"). It seems that the name of the glossary entry in the acronym section is tied to \glsentryname (I think).

Code: Select all

\documentclass{report}
\usepackage[acronym,nonumberlist,description]{glossaries}
\newglossaryentry{mwe}
{
  type=\acronymtype,
  name={MWE},
  description={A short example to illustrate a problem},
  long={minimal working example},
  first={minimal working example (\glsentryname{mwe})}
}
\setglossarystyle{altlist}
\makeglossaries
\begin{document}
\gls{mwe}
\gls{mwe}
\glsaddall
\printglossaries
\end{document}
I've tried fiddling with the name of the acronym, short, long, etc. but can't seem to find the combination that results in my desired behavior.
Attachments
MWE.pdf
Minimal working example
(31.89 KiB) Downloaded 455 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Acronym section showing abbreviation

Post by Johannes_B »

The list is for looking up the acronyms, consider CTAN which you used a few time in your document. The reader who wants to know the long form has to read through all the entries with C till he gets to Comprehensive TeX Archive Network. This might be quite some reading and the purpose of a fast lookup is gone.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Re: Acronym section showing abbreviation

Post by LeonardLopes »

I understand what you are saying and it is probably a good point. I have checked the formatting requirements for the document I am generating and of course they don't have any.
LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Re: Acronym section showing abbreviation

Post by LeonardLopes »

Is there a way to have the acronym first, then the length?

CTAN: Comprehensive TeX Archive Network
DESCRIPTION
LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Acronym section showing abbreviation

Post by LeonardLopes »

I have decided to go down this route:

http://tex.stackexchange.com/questions/ ... d-glossary

Thanks for your help!
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Acronym section showing abbreviation

Post by Johannes_B »

Define your own style and use it.

Code: Select all

\documentclass{report}
\usepackage[acronym,nonumberlist,description]{glossaries}
\newglossaryentry{gls:Acoustic}
{
	name=acoustic,
	description=
	{Associated with sound, or more generally with mechanical wave propagation in a
		medium.
	},
}
\newglossaryentry{ctan}
{
	type=\acronymtype,
	name={CTAN},
	description={this is a long description},
%	long={},%no long form
	first={just for testing  (\glsentryname{ctan})}
}
\newglossaryentry{mwe}
{
	type=\acronymtype,
	name={MWE},
	description={A short example to illustrate a problem},
	long={minimal working example},
	first={minimal working example (\glsentryname{mwe})}
}

\setglossarystyle{altlist}

\makeatletter
\newglossarystyle{leonard}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
      \glstarget{##1}{\glossentryname{##1}}]%
      \glsentrylong{##1}
      \mbox{}\par\nobreak\@afterheading
      \glossentrydesc{##1}\glspostdescription\space ##2}%
  \renewcommand{\subglossentry}[3]{%
    \par
    \glssubentryitem{##2}%
    \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space ##3}%
}
\makeatother
\makeglossaries
\begin{document}
\gls{mwe} and later just
\gls{mwe}

\gls{ctan} and later just
\gls{ctan}
\glsaddall
\printacronyms[style=leonard]
\printglossaries
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply