2

Coming up from my previous question Remove page numbers of LoF/LoT in TOC I encounter a new problem using the acro package. (switching to glossaries is no alternative at this point tome)

I try to add a unnumbered ToC entry for my acronyms. The package provide the command \printacronyms[heading=chapter*] which produce an unnumbered chapter but no ToC entry. Actually using \addchap{Acronyms} would produce the desired result but I'm unable to combine it with the acro package.

\documentclass[listof = totoc]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{duckuments}% only for dummy text
\usepackage{scrlayer-scrpage}
\usepackage{acro}
\usepackage{graphicx}

\DeclareAcronym{Team}{
    short = Team,
    long = {Toll ein anderer macht's}
}

\RedeclareSectionCommand[
    tocpagenumberformat=\tocchapterpagenumberformat
]{chapter}

\newif\ifgobblechaptertocpagenumber
\newcommand*\tocchapterpagenumberformat[1]
{{\ifgobblechaptertocpagenumber\else{\usekomafont{chapterentrypagenumber}#1}\fi}}


\begin{document}
    \renewcommand*\chapterpagestyle{empty}
    \pagestyle{empty}
    \addtocontents{toc}{\protect\gobblechaptertocpagenumbertrue}

    \tableofcontents
    \listoffigures
    \printacronyms[heading=chapter*]%
    % \addchap{Acronyms} % Desired result

    \cleardoubleoddpage
    \pagenumbering{arabic}
    \renewcommand\chapterpagestyle{plain}
    \pagestyle{scrheadings}
    \addtocontents{toc}{\protect\gobblechaptertocpagenumberfalse}

    \duckument

    \begin{figure}
        \includegraphics{example-image-duck}
        \caption{\ac{Team}}
    \end{figure}
\end{document}
faltfe
  • 519

1 Answers1

2

You are using a KOMA-Script class which provide commands for unnumbered chapters and section with an entry in the TOC: \addchap, \addsec, …

acro allows you to use those:

\printacronyms[heading=addchap]
cgnieder
  • 66,645