Phantomraum im Glossar

Phantomraum im Glossar

Ich versuche, einen neuen Abkürzungsstil mit „Glossare-Extra“ einzurichten, habe aber einen Phantomraum, den ich nicht herausfinden kann.

Ich versuche, es so einzurichten, dass der Langname bei deutschsprachigen Abkürzungen automatisch kursiv geschrieben wird, bei englischsprachigen jedoch nicht.

Beim Drucken des Glossars wird vor der Kurzbezeichnung ein zusätzliches Leerzeichen eingefügt, um die deutschsprachigen Abkürzungen hervorzuheben. Siehe 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}

Bildbeschreibung hier eingeben

Sharelatex-Link:https://www.sharelatex.com/read/zdfmqjnmkrkv

Als schnelle Lösung setze ich manuell die Hervorhebung im \newabbreviation-Aufruf, z. B. {ccc}{CCC}{\textit{Foo Foo Foo}}, suche aber nach einer eleganteren Lösung

Antwort1

Es fehlt %die }{Zeile. Ich habe einige andere Neuformatierungen vorgenommen, um die verschiedenen Ebenen besser anzuzeigen.

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

verwandte Informationen