Bug Tracker
I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)
ID | 51🔗 |
---|---|
Date: | 2013-12-28 07:40:19 |
Status | Closed (Not a Bug) |
Category | glossaries |
Version | 4.01 |
Summary | Acronym disables glsentryfmt... |
Sign in to subscribe to notifications about this report.
Description
Adding the line makes the custom formatting go away...\newacronym{apa}{apa}{Apa per Apa}see the repro code.
MWE
Download (408B)
\documentclass{article} \usepackage{glossaries} \makeglossaries \renewcommand*{\glsentryfmt}{% \glsgenentryfmt \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% } \newglossaryentry{distance}{name=distance, description={The length between two points}, symbol={km}} \newacronym{apa}{apa}{Apa per Apa} \begin{document} First use: \gls{distance}. Next use: \gls{distance}. \end{document}
Evaluation
This isn't a bug but is a feature of having a mixture of acronyms and regular entries in the same glossary. There are two issues:
- As per section Acronym Options in the user manual, you can use the package option
acronymlists
to identify a glossary that contains acronyms. This sets up the display format for the given glossaries via\defglsentryfmt
.If
\newacronym
is used in a glossary that hasn't been identified in this way, then\newacronym
will automatically add that glossary to the list of acronyms and will use\defglsentryfmt
to setup the display style for that glossary. So to prevent\newacronym
from overriding the display style for a particular glossary you need to have already identified that glossary as a list of acronyms using theacronymlists
package option (or the equivalent\DeclareAcronymList
command).\usepackage[acronymlists=main]{glossaries}
or\DeclareAcronymList{main}
- Redefining
\glsentryfmt
only has an effect on glossaries that haven't had their display style changed via\defglsentryfmt
. Since using all acronyms set their display style using\defglsentryfmt
, the only way to change their style is to use\defglsentryfmt
rather than redefining\glsentryfmt
. So you would need to do:\defglsentryfmt{% \glsgenentryfmt \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% }
However, this will interfere with the way the acronyms are displayed so\gls{apa}
will produce "Apa per Apa (apa) ()" which has an unwanted set of parentheses. Instead you need to modify the argument of\defglsentryfmt
so that it checks if the entry is an acronym:\defglsentryfmt{% \glsgenentryfmt \ifglshaslong{\glslabel}% {}% this entry is an acronym so do nothing {\ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}}% }
\documentclass{article} \usepackage[acronymlists=main]{glossaries} \makeglossaries \defglsentryfmt{% \glsgenentryfmt \ifglshaslong{\glslabel}% {}% this entry is an acronym so do nothing {\ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}}% } \newglossaryentry{distance}{name=distance, description={The length between two points}, symbol={km}} \newacronym{apa}{apa}{Apa per Apa} \begin{document} First use: \gls{distance}. Next use: \gls{distance}. Acronym first use: \gls{apa}. Next use: \gls{apa}. \end{document}If you choose to upgrade to version 4.02, there's another approach:
\documentclass{article} \usepackage[acronymlists=main]{glossaries} \makeglossaries \newacronymstyle {my-custom-style}% style name {% display \ifglshaslong{\glslabel}% {\glsgenacfmt}% acronym {% not an acronym \glsgenentryfmt \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% }% }% {% style definitions \GlsUseAcrStyleDefs{long-short}% use the same style as 'long-short' } % switch to this new style: \setacronymstyle{my-custom-style} \newglossaryentry{distance}{name=distance, description={The length between two points}, symbol={km}} \newacronym{apa}{apa}{Apa per Apa} \begin{document} First use: \gls{distance}. Next use: \gls{distance}. Acronym: \gls{apa}. \gls{apa}. \end{document}
Comments
0 comments.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=51