Espacio fantasma en glosario

Espacio fantasma en glosario

Estoy intentando configurar un nuevo estilo de abreviatura con glosarios adicionales, pero tengo un espacio fantasma que no puedo entender.

Intentando que el nombre largo aparezca automáticamente en cursiva para las abreviaturas en alemán, pero no para las abreviaturas en inglés.

Cuando imprimo el glosario, se agrega un espacio adicional antes del nombre corto, lo que hace que las abreviaturas en alemán se desplacen. ver 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}

ingrese la descripción de la imagen aquí

enlace compartir látex:https://www.sharelatex.com/read/zdfmqjnmkrkv

Como solución rápida, estoy poniendo énfasis manualmente en la llamada \newabbreviation, por ejemplo, {ccc}{CCC}{\textit{Foo Foo Foo}}, pero busco una solución más elegante.

Respuesta1

Son los desaparecidos %en la }{línea; Hice algunos otros reformateos para mostrar mejor los distintos niveles.

\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}

información relacionada