용어집의 유령 공간

용어집의 유령 공간

Glossaries-extra를 사용하여 새로운 약어 스타일을 설정하려고 하는데 알 수 없는 팬텀 공간이 있습니다.

독일어 약어에서는 긴 이름이 자동으로 이탤릭체로 표시되지만 영어에서는 그렇지 않도록 만들려고 합니다.

용어집을 인쇄할 때 짧은 이름 앞에 추가 공백이 추가되어 독일어 약어가 오프셋됩니다. 음 참조하세요.

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}

여기에 이미지 설명을 입력하세요

공유라텍스 링크:https://www.sharelatex.com/read/zdfmqjnmkrkv

빠른 수정으로 \newabbreviation 호출(예: {ccc}{CCC}{\textit{Foo Foo Foo}})에서 수동으로 강조를 설정하고 있지만 더 우아한 솔루션을 찾고 있습니다.

답변1

%라인 에서 누락되었습니다 }{. 다양한 레벨을 더 잘 표시하기 위해 다른 형식을 다시 지정했습니다.

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

관련 정보