词汇表作为章节,其缩写作为章节(词汇表包)

词汇表作为章节,其缩写作为章节(词汇表包)

我目前正在完成我的学士论文。还有一个问题,我自己没能解决。它又与词汇表包有关。问题发生在我必须将词汇表移到附录时。

在向您展示我的 MWE 之前,我想解释一下我是如何使用词汇表的。除了词汇表条目之外,它还管理我的首字母缩略词。首字母缩略词应包含在论文之前,因此应作为章节打印。这很好。词汇表是附录的一部分。因此它需要成为一个部分。

我在 tex.stackexchange 上找到了一些类似的问题。但这些问题都没有使用以下缩写词: 附录中的词汇表或者词汇表的章节编号。提出的两种解决方案都有一个缺点,那就是我的首字母缩略词也成为一个部分。

是否可以将首字母缩略词打印为章节,将词汇表打印为部分?如果这不可能,我可能不得不将词汇表放在最后。这样它就不会像现在这样损坏附录。

以下是我的最小工作示例:

\documentclass[12pt]{scrreprt}
\usepackage[twoside, outer=4cm, inner=2cm, bottom=2.5cm, top=3.5cm]{geometry}
\usepackage[ngerman,english]{babel}
\usepackage{lipsum}

\usepackage[utf8]{inputenc}
%----------------- headers -----------------------------
\usepackage[automark,headsepline]{scrlayer-scrpage}
\automark[section]{chapter}
\pagestyle{scrheadings}
\ohead{page \pagemark}
\ihead{\headmark}
\ofoot*{ }      % overwrite page number in footer

%---------------- glossary -----------------------------
\usepackage[acronym]{glossaries}
\makeglossaries

\newglossaryentry{apig}{
        name=Application Programming Interface,
        description={is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API}
}
\newacronym[see={[glossary:]{apig}}]{api}{API}{Application Programming Interface\glsadd{apig}}    

%----------------- document -----------------------------
\begin{document}

\selectlanguage{english}

\tableofcontents

%\phantomsection
\addcontentsline{toc}{chapter}{acronyms}
\printglossary[type=\acronymtype, title=Table of Acronyms, toctitle=Table of Acronyms]


\chapter{Introduction}
\acrfull{api} are ... The ... \Gls{apig} is used to ... 
\lipsum[1]

\section{a example section}
\lipsum[2]


% ----------------- appendix -----------------------
\appendix

\cleardoublepage
% change numbering etc. \pagenumbering{Roman}


\chapter{appendix}
\label{ch:appendix}


%\phantomsection
\addcontentsline{toc}{section}{Glossary}
\printglossary[title=Glossary, toctitle=Glossary]

% following sections are actually included through \include but thats not the issue
\section{first section in appendix}
\lipsum[2-6]

\section{second section in appendix}
\lipsum[6-9]

\section{third section in appendix}
\lipsum[9-11]

\end{document}

我正在使用 pdflatex -> makeglossaries -> pdflatex(如果需要则为 -> pdflatex)生成文档,使用通过 debian 存储库安装的 TexLive 2020.20210202-3。

提前致谢,克里斯

答案1

一个解决方案是创建一个部分 \section{Glossary},然后发布\printglossary 没有标题的内容,并通过本地无效化来抑制他想要开始的新页面 \clearpage

A

d

添加的行或更改的内容用<<<<<<

% !TeX TS-program = pdflatex

\documentclass[12pt]{scrreprt}
\usepackage[twoside, outer=4cm, inner=2cm, bottom=2.5cm, top=3.5cm]{geometry}
\usepackage[ngerman,english]{babel}
\usepackage{lipsum}

\usepackage[utf8]{inputenc}
%----------------- headers -----------------------------
\usepackage[automark,headsepline]{scrlayer-scrpage}
\automark[section]{chapter}
\pagestyle{scrheadings}
\ohead{page \pagemark}
\ihead{\headmark}
\ofoot*{ }      % overwrite page number in footer

%---------------- glossary -----------------------------
\usepackage[acronym]{glossaries}
\makeglossaries

\newglossaryentry{apig}{
    name=Application Programming Interface,
    description={is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API}
}
\newacronym[see={[glossary:]{apig}}]{api}{API}{Application Programming Interface\glsadd{apig}}      

%----------------- document -----------------------------
\begin{document}
    
\selectlanguage{english}

\tableofcontents

%\phantomsection
\addcontentsline{toc}{chapter}{acronyms}
\printglossary[type=\acronymtype, title=Table of Acronyms, toctitle=Table of Acronyms]  

\chapter{Introduction}
\acrfull{api} are ... The ... \Gls{apig} is used to ... 
\lipsum[1]

\section{a example section}
\lipsum[2]  

% ----------------- appendix -----------------------
\appendix

\cleardoublepage
% change numbering etc. \pagenumbering{Roman}   

\chapter{appendix}
\label{ch:appendix}

%\phantomsection
%\addcontentsline{toc}{section}{Glossary}

\section{Glossary}% added <<<<<<<<<<    

\begingroup % added <<<<<<<<<<<
    \renewcommand{\clearpage}{} % clearpage does nothing
    \printglossary[title=\normalsize\vspace*{-6\baselineskip}, toctitle=] % changed <<<<<<<<<<<
    \lipsum[2-6] % test that pagebreak will work with longer glossaries
\endgroup

% following sections are actually included through \include but thats not the issue
\section{first section in appendix}
\lipsum[2-6]

\section{second section in appendix}
\lipsum[6-9]

\section{third section in appendix}
\lipsum[9-11]
    
\end{document}

答案2

您可以简单地重新定义\@@glossarysec宏,它还包含section=选项所设置的内容。

% ...
\usepackage[section=chapter]{glossaries}

% ...
% will be printed using \chapter{title}
\printglossary[type=\acronymtype]

% ...

\makeatletter
\renewcommand*{\@@glossarysec}{section}
\makeatother
% will be printed using \section
\printglossary

相关内容