Estou tentando configurar um novo estilo de abreviação com glossários extras, mas tenho um espaço fantasma que não consigo descobrir.
Tentando fazer com que o nome longo fique automaticamente em itálico para abreviações no idioma alemão, mas não para o idioma inglês.
Quando imprimo o glossário, um espaço extra é adicionado antes do nome abreviado, compensando as abreviações do idioma alemão. veja mwe.
MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[toc=true, section=chapter, nonumberlist]{glossaries-extra}
\makeglossaries
\newabbreviationstyle{long-short-user-em}{
%\GlsXtrUseAbbrStyleSetup{long-short-user}
\renewcommand*{\CustomAbbreviationFields}{%
name={\protect\glsabbrvfont{\the\glsshorttok}},
sort={\the\glsshorttok},
first={\protect\glsfirstlongemfont{\the\glslongtok}%
\protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}%
{\the\glslabeltok}},%
firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}%
\protect\glsxtruserparen
{\protect\glsfirstabbrvuserfont{\the\glsshortpltok}}{\the\glslabeltok}},%
plural={\protect\glsabbrvfont{\the\glsshortpltok}},%
description={\protect\glslongfont{\the\glslongtok}}
}%
}{
\GlsXtrUseAbbrStyleFmts{long-short-user}%
\renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
\renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
}
\setabbreviationstyle{long-short-user}
\setabbreviationstyle[german]{long-short-user-em}
\setabbreviationstyle[english]{long-short-user}
\newabbreviation{DTA}{DTA}{Some acronym long}
\newabbreviation{DTB}{DTB}{some other acronym long}
\newabbreviation{DTF}{DTF}{blah foo blah}
\newabbreviation[category=german]{aaa}{AAA}{Some Italicised german word}
\newabbreviation[category=german]{bbb}{BBB}{Some other Italicised german word}
\newabbreviation[category=german]{ccc}{CCC}{Foo Foo Foo}
\glsaddall
\begin{document}
\printglossary[title=List of Abbreviations]
\end{document}
link sharelatex:https://www.sharelatex.com/read/zdfmqjnmkrkv
Como uma solução rápida, estou definindo manualmente a ênfase na chamada \newabbreviation, por exemplo, {ccc}{CCC}{\textit{Foo Foo Foo}} mas procurando uma solução mais elegante
Responder1
É o que falta %
na }{
linha; Fiz outra reformatação para melhor mostrar os vários níveis.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[toc=true, section=chapter, nonumberlist]{glossaries-extra}
\makeglossaries
\newabbreviationstyle{long-short-user-em}{% <-- not really necessary
%\GlsXtrUseAbbrStyleSetup{long-short-user}
\renewcommand*{\CustomAbbreviationFields}{%
name={\protect\glsabbrvfont{\the\glsshorttok}},
sort={\the\glsshorttok},
first={%
\protect\glsfirstlongemfont{\the\glslongtok}%
\protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}%
{\the\glslabeltok}%
},
firstplural={%
\protect\glsfirstlongemfont{\the\glslongpltok}%
\protect\glsxtruserparen{%
\protect\glsfirstabbrvuserfont{\the\glsshortpltok}%
}{\the\glslabeltok}
},
plural={\protect\glsabbrvfont{\the\glsshortpltok}},
description={\protect\glslongfont{\the\glslongtok}},
}%
}{% <-- this was the missing one
\GlsXtrUseAbbrStyleFmts{long-short-user}%
\renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}%
\renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}%
}
\setabbreviationstyle{long-short-user}
\setabbreviationstyle[german]{long-short-user-em}
\setabbreviationstyle[english]{long-short-user}
\newabbreviation{DTA}{DTA}{Some acronym long}
\newabbreviation{DTB}{DTB}{some other acronym long}
\newabbreviation{DTF}{DTF}{blah foo blah}
\newabbreviation[category=german]{aaa}{AAA}{Some Italicised german word}
\newabbreviation[category=german]{bbb}{BBB}{Some other Italicised german word}
\newabbreviation[category=german]{ccc}{CCC}{Foo Foo Foo}
\glsaddall
\begin{document}
\printglossary[title=List of Abbreviations]
\end{document}