[Tex/LaTex] Remove appendix page numbers in TOC while using appendix package

appendicestable of contents

I'm using \usepackage[title,titletoc]{appendix} and putting my appendices in the appendices environment. I'm trying to remove the appendix page numbers from the TOC.

I've looked at the documentation for the appendix packaged and tried using \noappendicestocpagenum without success.

\documentclass{article}
\usepackage[title,titletoc]{appendix}
\usepackage{lipsum}

\begin{document}

    \tableofcontents
    \clearpage
    \section{first}
    \section{second}
    \pagebreak
    \begin{appendices}

        \section{additional material}
        \setcounter{page}{1}
        \renewcommand{\thepage}{\thesection -\arabic{page}}

        \lipsum

        \pagebreak
        \section{more of it}
        \setcounter{page}{1}
        \renewcommand{\thepage}{\thesection -\arabic{page}}

        \lipsum

    \end{appendices}
\end{document}

Page Numbers to be removed

Advice on better formatting of my page numbers would also be welcome.

Best Answer

Use this solution. Add the package tocloft and after appendices environment do \addtocontents{toc}{\cftpagenumbersoff{section}}

Your code will be reworked as

\documentclass{article}
\usepackage[title,titletoc]{appendix}
\usepackage{tocloft}
\usepackage{lipsum}

\begin{document}

  \tableofcontents
  \clearpage
  \section{first}
  \section{second}
  \pagebreak
  \begin{appendices}
    \addtocontents{toc}{\cftpagenumbersoff{section}}
    \section{additional material}
    \setcounter{page}{1}
    \renewcommand{\thepage}{\thesection -\arabic{page}}

    \lipsum

    \pagebreak
    \section{more of it}
    \setcounter{page}{1}
    \renewcommand{\thepage}{\thesection -\arabic{page}}

    \lipsum

  \end{appendices}
\end{document}

enter image description here