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}
  • 1
    Did you try \printacronyms[heading=addchap]? – clemens Jul 23 '18 at 19:50
  • @clemens Not until you mention it. But your solution is working fine. Thanks – faltfe Jul 23 '18 at 19:53
  • @clemens do you want to post a (short) answer? – faltfe Jul 24 '18 at 7:56
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]

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.