我正在嘗試使用額外的詞彙表來設定新的縮寫樣式,但有一個我無法弄清楚的幻影空間。
嘗試使德語縮寫的長名稱自動變為斜體,但英語縮寫則不會自動變為斜體。
當我列印詞彙表時,在短名稱之前會添加一個額外的空格,從而使德語縮寫產生偏移。見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}