2

I am currently finishing my work on my bachelor thesis. I have one issue left, that I did not manage to fix myself. Again it is related to the glossaries package. The problem occurred when I had to move my glossary into the appendix.

Before showing you my MWE I'd like to explain how I am using the glossary. Beside the glossary entries it does also manage my acronyms. Acronyms shall be included before the thesis and therefore printed as chapter. Thats working fine. The glossary is part of of the appendix. Therefore it needs to become a section.

I found some questions on tex.stackexchange that are comparable. But none of those do use the acronyms: glossary as appendix or section numbering for glossary. Both presented solutions have the drawback that my acronyms become a section as well.

Is it possible to print the acronyms as chapter and the glossary as section? If this is not possible I probably have to put the glossary at last. This way it would not damage the appendix as much as it does currently.

here follows my minimal working example:

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

I am generating the document using pdflatex -> makeglossaries -> pdflatex (-> pdflatex if neccessary), using TexLive 2020.20210202-3 installed via debian repository.

thanks in advance, chris

2 Answers 2

2

A solution is create a section \section{Glossary}, then issue \printglossary with no title, and suppress the new page he wanted to start by locally nullifying \clearpage.

a

d

Lines added or changes are marked with <<<<<<

% !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}
0

You can simply redefine the \@@glossarysec macro, which also contains whatever the section= option was set to.

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

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

% ...

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.