[Tex/LaTex] Appendix without heading, only TOC entry

appendicesnumberingsectioningtable of contents

I'd like to add an appendix to the TOC without showing its headline over the continuous text.

Minimal Example:

\documentclass{scrartcl}
\begin{document}
    \tableofcontents

    \section{A Section}
    Lorem ipsum.

    \appendix
    \section{Appendix with Headline}
    This section has a headline.

    \section{Appendix without Headline}
    This section should not have a headline.
\end{document}

An idea would be using \addcontentsline instead of \section but then I lose the foregoing "B.":

\addcontentsline{toc}{section}{Appendix without Headline}

Best Answer

It's a somewhat strange requirement, but here you go. (Note that this does not take care of the numbering of additional "visible" sections.)

\documentclass{scrartcl}
\begin{document}
    \tableofcontents

    \section{A Section}
    Lorem ipsum.

    \appendix
    \section{Appendix with Headline}
    This section has a headline.

    \addcontentsline{toc}{section}{\protect\numberline{B}Appendix without Headline}
    \bigskip\noindent% Optional
    This section should not have a headline.
\end{document}