![词汇表及其缩写词选项存在问题](https://linux22.com/image/348898/%E8%AF%8D%E6%B1%87%E8%A1%A8%E5%8F%8A%E5%85%B6%E7%BC%A9%E5%86%99%E8%AF%8D%E9%80%89%E9%A1%B9%E5%AD%98%E5%9C%A8%E9%97%AE%E9%A2%98.png)
目前,我尝试排版一个包含词汇表和首字母缩略词列表的较大文档。我使用软件包处理这些内容。但我在设计样式方面遇到了问题。我希望它在第一个宏glossaries
中显示描述。\gls{key}
对于缩写,我开始使用以下代码这里。我只是对其进行了调整,将文本(首次使用时的描述)打印到页边空白处,而不是设置脚注。
现在我的问题是如何将这种行为转移到主词汇表,该词汇表应被 视为首字母缩略词列表acronymlists={main}
。是否可以为主词汇表编写这样的脚注样式?
\documentclass[twoside=semi,DIV=calc,BCOR=1mm]{scrreprt}
\usepackage{scrlayer-notecolumn,xparse,tcolorbox} % for implementation
\tcbuselibrary{most}
% scrlayer-notecolumn for twoside=semi
\RedeclareNoteColumn[position=\oddsidemargin+1in+\textwidth+\marginparsep,width=\marginparwidth,font=\footnotesize]{marginpar}
\DeclareDocumentCommand{\xmarginnote}{O{0pt} +m}{%
\makenote[marginpar]{\hbox{}\vskip#1\setlength{\parindent}{0.5pc}\setlength{\parskip}{0pt}\noindent #2}%
}
\usepackage[makeindex,acronym,acronymlists={main},nopostdot]{glossaries}
\ProvideDocumentCommand{\printglossdef}{o m}{\xmarginnote{#1: #2}}
\newacronymstyle{ex-footnote}%
{\GlsUseAcrEntryDispStyle{footnote}}%
{%
\GlsUseAcrStyleDefs{footnote}%
\renewcommand*{\genacrfullformat}[2]{%
\firstacronymfont{\glsentryshort{##1}}##2%
\expandafter\printglossdef\expandafter[\expandafter\glsentryshort\expandafter{##1}]{\expandafter\glsentrylong\expandafter{##1}}
}%
\renewcommand*{\Genacrfullformat}[2]{%
\firstacronymfont{\Glsentryshort{##1}}##2%
\expandafter\printglossdef\expandafter[\expandafter\Glsentryshort\expandafter{##1}]{\expandafter\glsentrylong\expandafter{##1}}
}%
\renewcommand*{\genplacrfullformat}[2]{%
\firstacronymfont{\glsentryshortpl{##1}}##2%
\expandafter\printglossdef\expandafter[\expandafter\glsentryshortpl\expandafter{##1}]{\expandafter\glsentrylongpl\expandafter{##1}}
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\firstacronymfont{\Glsentryshortpl{##1}}##2%
\expandafter\printglossdef\expandafter[\expandafter\Glsentryshortpl\expandafter{##1}]{\expandafter\glsentrylongpl\expandafter{##1}}
}%
}
\setacronymstyle{ex-footnote}
\GlsSetQuote{*}
\newglossaryentry{hurenkind}{name={Hurenkind},plural={Hurenkinder},description={der Absatz befindet sich auf einer Seite, bis auf die als \emph{Hurenkind} bezeichnete letzte Zeile auf der nächsten}}
\newacronym{test}{TEST}{TEst is a test}
\makeglossaries
\begin{document}
This is a test. \gls{hurenkind} does not work.\\\par
\gls{test} is just fine.\\\par
\printglossaries
\end{document}
答案1
我认为您可能会发现使用扩展包更容易glossaries-extra
:
\documentclass[twoside=semi,DIV=calc,BCOR=1mm]{scrreprt}
\usepackage{scrlayer-notecolumn,xparse,tcolorbox} % for implementation
\tcbuselibrary{most}
% scrlayer-notecolumn for twoside=semi
\RedeclareNoteColumn[position=\oddsidemargin+1in+\textwidth+\marginparsep,width=\marginparwidth,font=\footnotesize]{marginpar}
\DeclareDocumentCommand{\xmarginnote}{O{0pt} +m}{%
\makenote[marginpar]{\hbox{}\vskip#1\setlength{\parindent}{0.5pc}\setlength{\parskip}{0pt}\noindent #2}%
}
\usepackage[acronym]{glossaries-extra}
\ProvideDocumentCommand{\printglossdef}{o m}{\xmarginnote{#1: #2}}
\GlsSetQuote{*}
\makeglossaries
\newcommand{\glsxtrpostlinkmarginnote}{%<-- hook for 'marginnote' category
\glsxtrifwasfirstuse
{\printglossdef[\glsentryname{\glslabel}]{\glsentrydesc{\glslabel}}}{}%
}
\newglossaryentry{hurenkind}{category={marginnote},% <-- set category to 'marginnote'
name={Hurenkind},
plural={Hurenkinder},
description={der Absatz befindet sich auf einer Seite,
bis auf die als \emph{Hurenkind} bezeichnete letzte
Zeile auf der nächsten}
}
\newacronym[category=marginnote]{test}{TEST}{TEst is a test}
\begin{document}
This is a test. \gls{hurenkind}.
\gls{test} is just fine.
\printglossaries
\end{document}
第一页:
第二页:
第三页: